[PATCH] Fix -static linking with recent glibcs

Andreas Jaeger aj@suse.de
Sat Sep 13 08:58:00 GMT 2003


Jakub Jelinek <jakub@redhat.com> writes:

> Hi!
>
> Latest CVS glibc use _Unwind_Resume and __gcc_personality_v0 in some libc.a
> objects. Normally, gcc -static links with:
> -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
> Now, if nothing in the program itself requires anything from libgcc_eh.a
> but some object from libc.a which uses __attribute__((cleanup)) is required
> (e.g. big part of libio), unwind-dw2.o etc. are added to the link
> only at the last of the 5 above mentioned libraries. But unwind-dw2-glibc.o
> needs dl_iterate_phdr among other things, and that comes from libc.a (and
> very likely has not been included in the link), so linking fails.
> This patch fixes it by using
> --start-group -lgcc -lgcc_eh -lc --end-group
> when linking -static
> (and keeps current
> -lgcc -lgcc_eh -lc -lgcc -lgcc_eh for dynamic link, as it is faster).
> Bootstrapped/regtested on i386-redhat-linux.
> Ok to commit?

Shouldn't this to got both 3.3 and mainline?

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030913/0b7ff518/attachment.sig>


More information about the Gcc-patches mailing list