Closed intelfx closed 6 months ago
Can you upload your utf8_validity.cc.o
file so that I can take a look at that file?
@rui314 Apologies, this was a PEBKAC-type error (or perhaps PEBUAD, standing for "problem exists between upstream and distribution").
My distribution shipped parts of the protobuf library used by the code in question (the libutf8_range
and libutf8_validity
) as static archives, which turned out to only contain GCC bitcode due to said distribution using -flto
across the board and gcc defaulting to -fno-fat-lto-objects
when linker plugin is available:
$ pacman -Qql protobuf | grep '\.a$' | xargs readelf -s
File: /usr/lib/libutf8_range.a(naive.c.o)
Symbol table '.symtab' contains 2 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000001 1 OBJECT GLOBAL DEFAULT COM __gnu_lto_slim
File: /usr/lib/libutf8_range.a(range2-neon.c.o)
Symbol table '.symtab' contains 2 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000001 1 OBJECT GLOBAL DEFAULT COM __gnu_lto_slim
File: /usr/lib/libutf8_range.a(range2-sse.c.o)
Symbol table '.symtab' contains 2 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000001 1 OBJECT GLOBAL DEFAULT COM __gnu_lto_slim
File: /usr/lib/libutf8_validity.a(utf8_validity.cc.o)
Symbol table '.symtab' contains 2 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000001 1 OBJECT GLOBAL DEFAULT COM __gnu_lto_slim
The build failure did not appear reproducible with ld.bfd because the program in question did not, in fact, use any of the symbols therein (so apparently ld.bfd just skipped those archives entirely, whereas mold rightfully complained).
Problem solved by building protobuf with -ffat-lto-objects
until upstream learns to honor the static/shared preference for all of its libraries.
Thanks, and sorry for the noise!
Description
When trying to build a certain project and link it against system libraries, I'm getting a spurious "not claimed" error from mold even though no LTO is used in the entire project:
LTO is not used:
Unfortunately I don't know how to narrow it down or produce a minimal reproducer. I'm ready to provide whatever information or test-compiles that you request; if you could help me to narrow this down I'd be grateful.
Full build log: mold-issue-1225.log (edit: updated, fixed linebreaks)
Version