This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Undefined Reference to dl_iterate_phdr from libgcc_eh.a


Thanks Paul!
Following your directions, I ran both options in the verbose mode.
Using -static instead of -Wl,static leads to some changes in the
options passed to the collect2 command.
Perhaps the most relevant one here is that some libraries are now
enclosed by start-group .. end-group: --start-group -lgcc -lgcc_eh
-lpthread -lc --end-group.
I guess this solves the undefined reference problem by resolving some
circular references.
The -static option is now passed before any object files or libraries
are listed. I think this means now we have a pure static linkage
instead of a mixed
linkage?
Also crtbeginT.o is used instead of crtbegin.o, but I guess that is
not relevant to the error I was getting.

Thanks again!
Abhisek


On Mon, Oct 1, 2012 at 12:32 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> 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
> '-static'.
>
> 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.
>
> Cheers,
> --
> Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]