Bug 1141323 - packages embed CFLAGS with -flto
Summary: packages embed CFLAGS with -flto
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development (show other bugs)
Version: Current
Hardware: Other openSUSE Factory
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Martin Liška
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 1081754
  Show dependency treegraph
 
Reported: 2019-07-12 13:22 UTC by Bernhard Wiedemann
Modified: 2021-08-17 16:35 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Wiedemann 2019-07-12 13:22:57 UTC
While working on reproducible builds for openSUSE, I found that
since the introduction of -flto=%jobs
several packages started to vary between builds
because they embed the CFLAGS somewhere in the rpm:
fldigi gmp haproxy ImageMagick lyx neovim tboot tcl

Not all packages have been tested yet.

Steps to Reproduce:
osc co openSUSE:Factory/fldigi && cd $_
for i in 1 2 ; do
  osc build --vm-type=kvm -j$i --disable-debuginfo --keep-pkg=.rpm$i
done
/usr/lib/build/pkg-diff.sh .rpm{1,2}/fldigi-*-0.x86_64.rpm
Comment 1 Martin Liška 2019-07-12 16:00:16 UTC
Thank you Bernhard for the report.

So fldigi is caused by:

fldigi-main.cxx:

```
void generate_version_text(void)
{
 version_text.assign("fldigi 4.1.05" "\nCopyright (C) 2007-2010 " "Dave Freese, Stelios Bounanos, and others" ".\n");
 version_text.append(gettext ("License GPLv3+: GNU GPL version 3 or later " "<http://www.gnu.org/licenses/gpl-3.0.html>\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n")


                                                                );

 ostringstream s;
 s << "Build information:\n";
 s << "  built          : " << "Thu Jan  1 00:00:00 UTC 1970" << " by " << "openSUSE"
   << '@' << "openSUSE" << " on " << "x86_64-suse-linux-gnu"
   << " for " << "x86_64-suse-linux-gnu" << "\n\n"
   << "  configure flags: " << "'--host=x86_64-suse-linux-gnu' '--build=x86_64-suse-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/lib' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' 'build_alias=x86_64-suse-linux-gnu' 'host_alias=x86_64-suse-linux-gnu' 'CXXFLAGS=-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -flto=99 -fno-lto' 'CFLAGS=-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -flto=99 -fno-lto' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'" << "\n\n"
   << "  compiler       : " << "gcc version 9.1.1 20190611 [gcc-9-branch revision 272147] (SUSE Linux) " << "\n\n"
   << "  compiler flags : " << "-I$(srcdir) -I$(srcdir)/include -I$(srcdir)/irrxml -I$(srcdir)/libtiniconv -I$(srcdir)/fileselector -I$(srcdir)/mbedtls -pthread -D_REENTRANT -pthread -I/usr/include/libusb-1.0 -I/usr/include/libpng16 -pipe -Wall -fexceptions -O2 --param=max-vartrack-size=0 --param=max-vartrack-size=0 -DNDEBUG" << "\n\n"
   << "  linker flags   : " << "-lportaudio -lasound -lm -lpthread -lasound -lfltk_images -lfltk -lX11 -lsndfile -lsamplerate -lpulse-simple -lpulse -lhamlib -lpng16 -lz -ldl -lpthread -lflxmlrpc" << "\n\n"
```
Comment 2 Martin Liška 2019-07-12 16:21:07 UTC
tboot actually does not use LTO, but the disablement is done not ideally:

The -flto=N is again leaking into debug info producer:

DWARF section [18] '.debug_info' at offset 0x1dd8:
 [Offset]
 Compilation unit at offset 0:
 Version: 4, Abbreviation section offset: 0, Address size: 4, Offset size: 4
 [     b]  compile_unit         abbrev: 1
           producer             (strp) "GNU C99 9.1.1 20190611 [gcc-9-branch revision 272147] -m32 -march=i686 -msoft-float -g -O2 -O2 -std=gnu99 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -flto=16 -flto=12345 -fno-lto -fno-builtin -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-stack-protector -fstack-check=no -fPIE"
Comment 3 Martin Liška 2019-07-12 16:26:21 UTC
(In reply to Martin Liška from comment #2)
> tboot actually does not use LTO, but the disablement is done not ideally:
> 
> The -flto=N is again leaking into debug info producer:
> 
> DWARF section [18] '.debug_info' at offset 0x1dd8:
>  [Offset]
>  Compilation unit at offset 0:
>  Version: 4, Abbreviation section offset: 0, Address size: 4, Offset size: 4
>  [     b]  compile_unit         abbrev: 1
>            producer             (strp) "GNU C99 9.1.1 20190611 [gcc-9-branch
> revision 272147] -m32 -march=i686 -msoft-float -g -O2 -O2 -std=gnu99
> -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
> -fstack-clash-protection -flto=16 -flto=12345 -fno-lto -fno-builtin
> -fno-common -fno-strict-aliasing -fomit-frame-pointer -fno-stack-protector
> -fstack-check=no -fPIE"

It's addressed in:
https://build.opensuse.org/request/show/714899
Comment 4 Martin Liška 2019-07-12 16:45:48 UTC
nvim also contains the options in .rodata:

/usr/bin/nvim differs in ELF section .rodata
--- /tmp/tmp.vF6YlTCDiO/tmp.I7FDFUYZtX	2019-07-12 18:45:24.029322303 +0200
+++ /tmp/tmp.vF6YlTCDiO/tmp.DpZMWe8vAG	2019-07-12 18:45:24.061321945 +0200
@@ -603,7 +603,7 @@
  249560 2d666173 796e6368 726f6e6f 75732d75  -fasynchronous-u
  249570 6e77696e 642d7461 626c6573 202d6673  nwind-tables -fs
  249580 7461636b 2d636c61 73682d70 726f7465  tack-clash-prote
- 249590 6374696f 6e202d66 6c746f3d 3136202d  ction -flto=16 -
+ 249590 6374696f 6e202d66 6c746f3d 3137202d  ction -flto=17 -
  2495a0 444e4445 42554720 2d57636f 6e766572  DNDEBUG -Wconver
  2495b0 73696f6e 202d555f 464f5254 4946595f  sion -U_FORTIFY_
  2495c0 534f5552 4345202d 445f464f 52544946  SOURCE -D_FORTIF
Comment 5 Swamp Workflow Management 2019-07-15 10:17:52 UTC
This is an autogenerated message for OBS integration:
This bug (1141323) was mentioned in
https://build.opensuse.org/request/show/715443 Factory / tboot
Comment 6 Bernhard Wiedemann 2020-05-27 09:41:05 UTC
This was solved last year by introducing the -flto=auto option as default