Bugzilla – Bug 1208386
gcc12 LTO embeds temporary filename
Last modified: 2023-02-17 11:25:24 UTC
While working on reproducible builds for openSUSE, I found that our jhead package varied when compiling with -flto=auto /usr/bin/jhead differs in ELF section .rodata --- old /usr/bin/jhead (objdump) +++ new /usr/bin/jhead (objdump) @@ -11684,7 +11684,7 @@ 2e9d0 73696e66 6f2e6300 6d616b65 726e6f74 sinfo.c.makernot 2e9e0 652e6300 7374645f 6368726f 6d696e61 e.c.std_chromina 2e9f0 6e63655f 7175616e 745f7462 6c002f74 nce_quant_tbl./t - 2ea00 6d702f63 6350416b 4471752e 6c747261 mp/ccPAkDqu.ltra + 2ea00 6d702f63 63456e78 6d316b2e 6c747261 mp/ccEnxm1k.ltra 2ea10 6e73302e 6f007374 645f6c75 6d696e61 ns0.o.std_lumina 2ea20 6e63655f 7175616e 745f7462 6c004b6e nce_quant_tbl.Kn 2ea30 6f776e54 61677300 436f6d6d 616e6453 ownTags.CommandS
After .o files were compiled with -flto, the linking step produces the randomness: for i in $(seq 4) ; do gcc-12 -Wall -fsanitize=address -o jhead obj/jhead.o obj/jpgfile.o obj/jpgqguess.o obj/paths.o obj/exif.o obj/iptc.o obj/gpsinfo.o obj/makernote.o -lm 2>/dev/null && md5sum jhead ; done 9385fe8d7e32129d29d69a0ecba95cae jhead 0bf0c32be7bbe0b5f7a832c0e1650999 jhead 27bcceed3563ad8e21f8c423acc91561 jhead 89b3c1e7b8a527163d9d57db9c13e9e7 jhead
It comes from AddressSanitizer that generates an artificial global symbol that has location equal to the ltrans unit: $ cat jhead.i int foo; $ gcc -O2 -fsanitize=address -flto=auto jhead.i -shared -fPIC -fdump-tree-all -o jhead --save-temps --verbose ... .LC2: .string "./jhead.ltrans0.o" .section .data.rel,"aw" .align 32 .type .LASAN0.2, @object .size .LASAN0.2, 64 .LASAN0.2: .quad .LASAN1.0 .quad 4 .quad 64 .quad .LC1 .quad .LC2 Anyway. ASAN is not something we should enable for openSUSE packages. It's for development purposes. Lemme fix that.
It's something that was removed in the upstream project: https://github.com/Matthias-Wandel/jhead/commit/34f61c3f1408e6b00f6f65dd3d7832f4f8e9318b
SR: https://build.opensuse.org/request/show/1066207
I think that asan shouldn't get the ltrans name into anything, tracing down where this is created from would be interesting.
(In reply to Martin Liška from comment #4) > SR: https://build.opensuse.org/request/show/1066207 Accepted, thanks!
This is an autogenerated message for OBS integration: This bug (1208386) was mentioned in https://build.opensuse.org/request/show/1066328 Factory / jhead
(In reply to Richard Biener from comment #5) > I think that asan shouldn't get the ltrans name into anything, tracing down > where this is created from would be interesting. It's actually a module name, I filled this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108834 and I have a patch candidate.
Anyway, this distro issue is resolved.