Bug 1208386 - gcc12 LTO embeds temporary filename
gcc12 LTO embeds temporary filename
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development
Other All
: P5 - None : Normal (vote)
: ---
Assigned To: Martin Liška
E-mail List
Depends on:
  Show dependency treegraph
Reported: 2023-02-16 14:22 UTC by Bernhard Wiedemann
Modified: 2023-02-17 11:25 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Wiedemann 2023-02-16 14:22:10 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
Comment 1 Bernhard Wiedemann 2023-02-16 14:27:54 UTC
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
Comment 2 Martin Liška 2023-02-16 15:28:43 UTC
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
	.string	"./jhead.ltrans0.o"
	.section	.data.rel,"aw"
	.align 32
	.type	.LASAN0.2, @object
	.size	.LASAN0.2, 64
	.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.
Comment 3 Martin Liška 2023-02-16 15:32:48 UTC
It's something that was removed in the upstream project:
Comment 4 Martin Liška 2023-02-16 15:36:28 UTC
SR: https://build.opensuse.org/request/show/1066207
Comment 5 Richard Biener 2023-02-17 07:32:22 UTC
I think that asan shouldn't get the ltrans name into anything, tracing down where this is created from would be interesting.
Comment 6 Petr Gajdos 2023-02-17 09:05:10 UTC
(In reply to Martin Liška from comment #4)
> SR: https://build.opensuse.org/request/show/1066207

Accepted, thanks!
Comment 7 OBSbugzilla Bot 2023-02-17 09:15:03 UTC
This is an autogenerated message for OBS integration:
This bug (1208386) was mentioned in
https://build.opensuse.org/request/show/1066328 Factory / jhead
Comment 8 Martin Liška 2023-02-17 11:24:57 UTC
(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:

and I have a patch candidate.
Comment 9 Martin Liška 2023-02-17 11:25:24 UTC
Anyway, this distro issue is resolved.