[Bug lto/105133] lto/gold: lto failed to link --start-lib/--end-lib in gold for duplicate libraries

luoxhu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 6 04:54:52 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105133

--- Comment #2 from luoxhu at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> (In reply to luoxhu from comment #0)
> > 
> > cat hellow.res
> > 3
> > hello.o 2
> > 192 ccb9165e03755470 PREVAILING_DEF main
> > 197 ccb9165e03755470 PREVAILING_DEF_IRONLY s
> > ./B/libhello.c.o 1
> > 205 68e0b97e93a52d7a PREEMPTED_REG hello
> > ./C/libhello.c.o 1
> > 205 18fe2d3482bfb511 PREEMPTED_REG hello
> 
> This looks like a gold bug - we have 'hello' pre-empted twice but no
> prevailing
> symbol in the IR - are you ending up with fat LTO objects?

It is not fat LTO objects since I didn't add -ffat-lto-objects when generating
lib:

nm libhello.a

libhello.c.o:
nm: libhello.c.o: plugin needed to handle lto object
0000000000000001 C __gnu_lto_slim


> 
> OTOH PREEMPTED_REG seems then handled wrongly by LTO as well - it should
> throw away both copies since the linker told us it found a preempting
> definition in a non-IR object file.  So I'd expect a unresolved reference
> to 'hello' rather than LTO complaining about multiple definitions ...

Will you fix it? :)

> 
> Note gold is really unmaintained, so you should probably avoid using it.

Thanks. Will try lld instead.


More information about the Gcc-bugs mailing list