Undefined Reference to dl_iterate_phdr from libgcc_eh.a

Paul Pluzhnikov ppluzhnikov@google.com
Mon Oct 1 16:33:00 GMT 2012

On Mon, Oct 1, 2012 at 9:18 AM, abhisekpan@gmail.com
<abhisekpan@gmail.com> wrote:

> Interestingly if I use '-static' instead of '-Wl,static' the program
> compiles and I get a static binary.

That's because '-static' is actually a GCC flag (that is also passed on
to the linker). The link command GCC constructs is different when it sees

When you use '-Wl,-static', you are going "behind GCC's back", and changing
what GCC thinks is a dynamic link into a fully static one. Don't do that.

Paul Pluzhnikov

More information about the Libc-help mailing list