https://sourceware.org/bugzilla/show_bug.cgi?id=33801
Bug ID: 33801
Summary: strip doesn't remove .gnu.lto_.opts as needed by GCC's
contrib/compare-lto
Product: binutils
Version: 2.45
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: sam at gentoo dot org
Target Milestone: ---
With `bootstrap-lto`, GCC sets a special command in config/bootstrap-lto.mk:
```
do-compare = $(SHELL) $(srcdir)/contrib/compare-lto $$f1 $$f2
```
With a small patch to respect $OBJCOPY and $STRIP and add `set -x`:
```
$ cp /tmp/toon/stage2-libiberty/pic/argv.o /tmp/argv.o.stage2 ; cp
/tmp/toon/stage3-libiberty/pic/argv.o /tmp/argv.o.stage3 ;
STRIP=/usr/x86_64-pc-linux-gnu/binutils-bin/2.44/strip
OBJCOPY=/usr/x86_64-pc-linux-gnu/binutils-bin/2.44/objcopy
~/git/gcc/contrib/compare-lto argv.o.stage2 argv.o.stage3
+ rm='rm -f'
+ case $1 in
+ test 2 '!=' 2
+ test '!' -f argv.o.stage2
+ test '!' -f argv.o.stage3
+ suf1=stripped
+ test -f argv.o.stage2.stripped
+ suf2=stripped
+ test -f argv.o.stage3.stripped
+ trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
+ : /usr/x86_64-pc-linux-gnu/binutils-bin/2.44/strip
+ : /usr/x86_64-pc-linux-gnu/binutils-bin/2.44/objcopy
+ cmp argv.o.stage2 argv.o.stage3
argv.o.stage2 argv.o.stage3 differ: byte 41, line 1
+ status=1
+ cmd=
+ for t in objdump readelf eu-readelf
+ grep ' --\[*section-\]*headers'
+ cmd=objdump
+ break
+ test xobjdump = x
+ objdump --section-headers argv.o.stage2
+ grep .gnu.lto_.opts
+ echo stripping off LTO option section, then retrying
stripping off LTO option section, then retrying
+ seclist=.gnu.lto_.opts
++ for sec in $seclist
++ echo ' -R .gnu.lto_.opts'
+ rsopts=' -R .gnu.lto_.opts'
+ grep ' -R'
+ /usr/x86_64-pc-linux-gnu/binutils-bin/2.44/objcopy -R .gnu.lto_.opts
argv.o.stage2 argv.o.stage2.stripped
+ /usr/x86_64-pc-linux-gnu/binutils-bin/2.44/objcopy -R .gnu.lto_.opts
argv.o.stage3 argv.o.stage3.stripped
+ trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
+ cmp argv.o.stage2.stripped argv.o.stage3.stripped
+ status=0
+ rm -f argv.o.stage2.stripped argv.o.stage3.stripped
+ trap 'exit 0; exit' 0 1 2 15
+ exit 0
+ exit 0
```
vs 2.45:
```
$ cp /tmp/toon/stage2-libiberty/pic/argv.o /tmp/argv.o.stage2 ; cp
/tmp/toon/stage3-libiberty/pic/argv.o /tmp/argv.o.stage3 ;
STRIP=/usr/x86_64-pc-linux-gnu/binutils-bin/2.45/strip
OBJCOPY=/usr/x86_64-pc-linux-gnu/binutils-bin/2.45/objcopy
~/git/gcc/contrib/compare-lto argv.o.stage2 argv.o.stage3
+ rm='rm -f'
+ case $1 in
+ test 2 '!=' 2
+ test '!' -f argv.o.stage2
+ test '!' -f argv.o.stage3
+ suf1=stripped
+ test -f argv.o.stage2.stripped
+ suf2=stripped
+ test -f argv.o.stage3.stripped
+ trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
+ : /usr/x86_64-pc-linux-gnu/binutils-bin/2.45/strip
+ : /usr/x86_64-pc-linux-gnu/binutils-bin/2.45/objcopy
+ cmp argv.o.stage2 argv.o.stage3
argv.o.stage2 argv.o.stage3 differ: byte 41, line 1
+ status=1
+ cmd=
+ for t in objdump readelf eu-readelf
+ grep ' --\[*section-\]*headers'
+ cmd=objdump
+ break
+ test xobjdump = x
+ objdump --section-headers argv.o.stage2
+ grep .gnu.lto_.opts
+ echo stripping off LTO option section, then retrying
stripping off LTO option section, then retrying
+ seclist=.gnu.lto_.opts
++ for sec in $seclist
++ echo ' -R .gnu.lto_.opts'
+ rsopts=' -R .gnu.lto_.opts'
+ grep ' -R'
+ grep ' -R'
+ echo failed to /usr/x86_64-pc-linux-gnu/binutils-bin/2.45/strip off LTO
option section
failed to /usr/x86_64-pc-linux-gnu/binutils-bin/2.45/strip off LTO option
section
+ trap 'rm -f "$1.$suf1" "$2.$suf2"' 0 1 2 15
+ cmp argv.o.stage2.stripped argv.o.stage3.stripped
cmp: argv.o.stage2.stripped: No such file or directory
+ status=1
+ rm -f argv.o.stage2.stripped argv.o.stage3.stripped
+ trap 'exit 1; exit' 0 1 2 15
+ exit 1
+ exit 1
```
Do we need to change GCC's compare-lto?
Right now, it tries to strip (only) .gnu.lto_.opts because we know options will
differ (-fno-checking vs -fchecking=1) but the rest should be identical, so we
do not strip all LTO sections.
--
You are receiving this mail because:
You are on the CC list for the bug.