On Sat, Nov 19, 2022 at 7:06 AM Alexey Kuznetsov <kuznetsov.ale...@gmail.com> wrote: > > Correction. When I'm using -buildmode pie it producing weired file static / > dynamic: > > # go install -ldflags "-extldflags -static" -buildmode pie > gitlab.com/axet/swap@swap-0.0.4 > > # file .go/bin/swap > .go/bin/swap: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), > dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go > BuildID=IdU-e_SYkwhiX9RUPRZ1/FCjd89you8IzAl7nDax_/7ww2AvzWZX8UIdMsxhe8/o5djfvZtYWIn7ldfOiOl, > with debug_info, not stripped > > # ldd .go/bin/swap > statically linked
Those are telling you two different things. The file command is telling you that the executable requires the dynamic linker. That is always true for PIE: the dynamic linker relocates the executable at run time. The ldd command is telling you that the executable is not linked against any dynamic libraries. It needs the dynamic linker, but no dynamic libraries. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWYV_FKfcvBLB6Vw-BMcMv7OkpibaH9DT9h9XQGL%3DdG0g%40mail.gmail.com.