Re: [PATCH][libbacktrace] Add btest_lto
On Tue, Feb 26, 2019 at 6:27 AM Tom de Vries wrote: > > On 26-02-19 13:00, Thomas Schwinge wrote: > > Hi Tom! > > > > On Tue, 26 Feb 2019 12:28:34 +0100, Tom de Vries wrote: > >> On 26-02-19 10:40, Thomas Schwinge wrote: > >>> On Mon, 25 Feb 2019 18:11:23 +0100, Tom de Vries wrote: > On 25-02-19 11:48, Thomas Schwinge wrote: > > On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries > > wrote: > >> Add libbacktrace test-case using -flto. > > > > I'm seeing this one fail is some configurations, but only in the > > 'build-gcc/libbacktrace/btest_lto.log' variant: > >>> > Meaning, compiling libbacktrace using the host compiler, so it would be > useful to known which compiler that is. > > [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a > couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't > manage. ] > >>> > >>> Years old: > >>> > >>> $ gcc --version > >>> gcc (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) > >>> [...] > >>> $ ld --version > >>> GNU ld (Sourcery CodeBench 2014.05-45) 2.24.51.20140217 > >>> [...] > >>> > >>> (It'll be fine for me if you just declare that unsupported.) > >> > >> I see. The 4.8 I tried is a 4.8.5. > >> > > test5: unexpected syminfo name got global.2537 expected global > > PASS: backtrace_full noinline > > PASS: backtrace_full inline > > PASS: backtrace_simple noinline > > PASS: backtrace_simple inline > > FAIL: backtrace_syminfo variable > > FAIL btest_lto (exit status: 1) > > > > I haven't looked yet which details about these GCC build configurations > > might be different/important; maybe you've got an idea already? > >>> > >>> I can reproduce this with '-O0' ("unexpected syminfo name got global.2528 > >>> expected global", in that case). With '-O0 -fdump-tree-all > >>> -fdump-ipa-all -save-temps', the 'global.2528' name appears only in > >>> 'btest_lto.ltrans0.000i.cgraph', and 'btest_lto.ltrans0.s': > >>> > >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > >>> (addr)state.2526/56 (read)callback_three.2389/64 > >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > >>> (write)failures.2527/57 (read) > >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > >>> (addr)state.2526/56 (read)callback_three.2389/64 > >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > >>> (write)failures.2527/57 (read) > >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > >>> (addr)state.2526/56 (read)callback_three.2389/64 > >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > >>> (write)failures.2527/57 (read) > >>> ./btest_lto.ltrans0.s: .type global.2528, @object > >>> ./btest_lto.ltrans0.s: .size global.2528, 4 > >>> ./btest_lto.ltrans0.s:global.2528: > >>> ./btest_lto.ltrans0.s: movq$global.2528, -8(%rbp) #, addr > >>> ./btest_lto.ltrans0.s: movl$global.2528, %eax #, global.22 > >>> ./btest_lto.ltrans0.s: movl$global.2528, %ecx #, global.23 > >>> ./btest_lto.ltrans0.s: .quad global.2528 > > > > With '-fdump-rtl-all' added, I see it appear in > > 'btest_lto.ltrans0.166r.expand': > > > > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > > [flags 0x2] )) [...]/libbacktrace/btest.c:399 > > -1 > > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > > [flags 0x2] )) [...]/libbacktrace/btest.c:433 > > -1 > > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > > [flags 0x2] )) [...]/libbacktrace/btest.c:435 > > -1 > > > >> How about: > >> ... > >> - int global; > >> + static int global; > >> ... > >> > >> Does that fix the failure? > > > > No, that gets us "unexpected syminfo name got global.2479.2528 expected > > global". ;-\ > > > > Ian, > > Is this approach OK? I would drop the #ifdef and just always accept it. if (strncmp (symdata.name, "global") == 0 && (symdata.name[6] == '\0' || symdata.name[6] == '.')) Ian
Re: [PATCH][libbacktrace] Add btest_lto
On 26-02-19 13:00, Thomas Schwinge wrote: > Hi Tom! > > On Tue, 26 Feb 2019 12:28:34 +0100, Tom de Vries wrote: >> On 26-02-19 10:40, Thomas Schwinge wrote: >>> On Mon, 25 Feb 2019 18:11:23 +0100, Tom de Vries wrote: On 25-02-19 11:48, Thomas Schwinge wrote: > On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: >> Add libbacktrace test-case using -flto. > > I'm seeing this one fail is some configurations, but only in the > 'build-gcc/libbacktrace/btest_lto.log' variant: >>> Meaning, compiling libbacktrace using the host compiler, so it would be useful to known which compiler that is. [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't manage. ] >>> >>> Years old: >>> >>> $ gcc --version >>> gcc (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) >>> [...] >>> $ ld --version >>> GNU ld (Sourcery CodeBench 2014.05-45) 2.24.51.20140217 >>> [...] >>> >>> (It'll be fine for me if you just declare that unsupported.) >> >> I see. The 4.8 I tried is a 4.8.5. >> > test5: unexpected syminfo name got global.2537 expected global > PASS: backtrace_full noinline > PASS: backtrace_full inline > PASS: backtrace_simple noinline > PASS: backtrace_simple inline > FAIL: backtrace_syminfo variable > FAIL btest_lto (exit status: 1) > > I haven't looked yet which details about these GCC build configurations > might be different/important; maybe you've got an idea already? >>> >>> I can reproduce this with '-O0' ("unexpected syminfo name got global.2528 >>> expected global", in that case). With '-O0 -fdump-tree-all >>> -fdump-ipa-all -save-temps', the 'global.2528' name appears only in >>> 'btest_lto.ltrans0.000i.cgraph', and 'btest_lto.ltrans0.s': >>> >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 >>> (addr)state.2526/56 (read)callback_three.2389/64 >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 >>> (write)failures.2527/57 (read) >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 >>> (addr)state.2526/56 (read)callback_three.2389/64 >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 >>> (write)failures.2527/57 (read) >>> ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 >>> ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 >>> (addr)state.2526/56 (read)callback_three.2389/64 >>> (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 >>> (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 >>> (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 >>> (write)failures.2527/57 (read) >>> ./btest_lto.ltrans0.s: .type global.2528, @object >>> ./btest_lto.ltrans0.s: .size global.2528, 4 >>> ./btest_lto.ltrans0.s:global.2528: >>> ./btest_lto.ltrans0.s: movq$global.2528, -8(%rbp) #, addr >>> ./btest_lto.ltrans0.s: movl$global.2528, %eax #, global.22 >>> ./btest_lto.ltrans0.s: movl$global.2528, %ecx #, global.23 >>> ./btest_lto.ltrans0.s: .quad global.2528 > > With '-fdump-rtl-all' added, I see it appear in > 'btest_lto.ltrans0.166r.expand': > > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > [flags 0x2] )) [...]/libbacktrace/btest.c:399 -1 > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > [flags 0x2] )) [...]/libbacktrace/btest.c:433 -1 > ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") > [flags 0x2] )) [...]/libbacktrace/btest.c:435 -1 > >> How about: >> ... >> - int global; >> + static int global; >> ... >> >> Does that fix the failure? > > No, that gets us "unexpected syminfo name got global.2479.2528 expected > global". ;-\ > Ian, Is this approach OK? Thanks, - Tom [libbacktrace] Fix btest-lto for older gcc With gcc 4.8.5, btest_lto ends up with a privatized name for the variable with name 'global': ... $ nm btest_lto | grep ' d ' | grep global 00617150 d global.2530 ... which makes test5 fail: ... test5: unexpected syminfo name got global.2530 expected global ... Fix this failure by accepting this type of name as a valid name in btest_lto. 2019-02-26 Tom de Vries * Makefile.am (btest_lto_CFLAGS): Add -DHAVE_LTO. * Makefile.in: Regenerate. * btest.c (test5) [HAVE_LTO]: Allow global.* as minimal symbol name
Re: [PATCH][libbacktrace] Add btest_lto
Hi Tom! On Tue, 26 Feb 2019 12:28:34 +0100, Tom de Vries wrote: > On 26-02-19 10:40, Thomas Schwinge wrote: > > On Mon, 25 Feb 2019 18:11:23 +0100, Tom de Vries wrote: > >> On 25-02-19 11:48, Thomas Schwinge wrote: > >>> On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: > Add libbacktrace test-case using -flto. > >>> > >>> I'm seeing this one fail is some configurations, but only in the > >>> 'build-gcc/libbacktrace/btest_lto.log' variant: > > > >> Meaning, compiling libbacktrace using the host compiler, so it would be > >> useful to known which compiler that is. > >> > >> [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a > >> couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't manage. > >> ] > > > > Years old: > > > > $ gcc --version > > gcc (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) > > [...] > > $ ld --version > > GNU ld (Sourcery CodeBench 2014.05-45) 2.24.51.20140217 > > [...] > > > > (It'll be fine for me if you just declare that unsupported.) > > I see. The 4.8 I tried is a 4.8.5. > > >>> test5: unexpected syminfo name got global.2537 expected global > >>> PASS: backtrace_full noinline > >>> PASS: backtrace_full inline > >>> PASS: backtrace_simple noinline > >>> PASS: backtrace_simple inline > >>> FAIL: backtrace_syminfo variable > >>> FAIL btest_lto (exit status: 1) > >>> > >>> I haven't looked yet which details about these GCC build configurations > >>> might be different/important; maybe you've got an idea already? > > > > I can reproduce this with '-O0' ("unexpected syminfo name got global.2528 > > expected global", in that case). With '-O0 -fdump-tree-all > > -fdump-ipa-all -save-temps', the 'global.2528' name appears only in > > 'btest_lto.ltrans0.000i.cgraph', and 'btest_lto.ltrans0.s': > > > > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > > (addr)state.2526/56 (read)callback_three.2389/64 > > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > > (write)failures.2527/57 (read) > > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > > (addr)state.2526/56 (read)callback_three.2389/64 > > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > > (write)failures.2527/57 (read) > > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > > (addr)state.2526/56 (read)callback_three.2389/64 > > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > > (write)failures.2527/57 (read) > > ./btest_lto.ltrans0.s: .type global.2528, @object > > ./btest_lto.ltrans0.s: .size global.2528, 4 > > ./btest_lto.ltrans0.s:global.2528: > > ./btest_lto.ltrans0.s: movq$global.2528, -8(%rbp) #, addr > > ./btest_lto.ltrans0.s: movl$global.2528, %eax #, global.22 > > ./btest_lto.ltrans0.s: movl$global.2528, %ecx #, global.23 > > ./btest_lto.ltrans0.s: .quad global.2528 With '-fdump-rtl-all' added, I see it appear in 'btest_lto.ltrans0.166r.expand': ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") [flags 0x2] )) [...]/libbacktrace/btest.c:399 -1 ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") [flags 0x2] )) [...]/libbacktrace/btest.c:433 -1 ./btest_lto.ltrans0.166r.expand:(symbol_ref:DI ("global.2528") [flags 0x2] )) [...]/libbacktrace/btest.c:435 -1 > How about: > ... > - int global; > + static int global; > ... > > Does that fix the failure? No, that gets us "unexpected syminfo name got global.2479.2528 expected global". ;-\ Grüße Thomas
Re: [PATCH][libbacktrace] Add btest_lto
On 26-02-19 10:40, Thomas Schwinge wrote: > Hi Tom! > > On Mon, 25 Feb 2019 18:11:23 +0100, Tom de Vries wrote: >> On 25-02-19 11:48, Thomas Schwinge wrote: >>> On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: Add libbacktrace test-case using -flto. >>> >>> I'm seeing this one fail is some configurations, but only in the >>> 'build-gcc/libbacktrace/btest_lto.log' variant: > >> Meaning, compiling libbacktrace using the host compiler, so it would be >> useful to known which compiler that is. >> >> [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a >> couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't manage. ] > > Years old: > > $ gcc --version > gcc (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) > [...] > $ ld --version > GNU ld (Sourcery CodeBench 2014.05-45) 2.24.51.20140217 > [...] > > (It'll be fine for me if you just declare that unsupported.) > I see. The 4.8 I tried is a 4.8.5. >>> test5: unexpected syminfo name got global.2537 expected global >>> PASS: backtrace_full noinline >>> PASS: backtrace_full inline >>> PASS: backtrace_simple noinline >>> PASS: backtrace_simple inline >>> FAIL: backtrace_syminfo variable >>> FAIL btest_lto (exit status: 1) >>> >>> I haven't looked yet which details about these GCC build configurations >>> might be different/important; maybe you've got an idea already? > > I can reproduce this with '-O0' ("unexpected syminfo name got global.2528 > expected global", in that case). With '-O0 -fdump-tree-all > -fdump-ipa-all -save-temps', the 'global.2528' name appears only in > 'btest_lto.ltrans0.000i.cgraph', and 'btest_lto.ltrans0.s': > > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > (addr)state.2526/56 (read)callback_three.2389/64 > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > (write)failures.2527/57 (read) > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > (addr)state.2526/56 (read)callback_three.2389/64 > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > (write)failures.2527/57 (read) > ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 > ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 > (addr)state.2526/56 (read)callback_three.2389/64 > (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 > (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 > (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 > (write)failures.2527/57 (read) > ./btest_lto.ltrans0.s: .type global.2528, @object > ./btest_lto.ltrans0.s: .size global.2528, 4 > ./btest_lto.ltrans0.s:global.2528: > ./btest_lto.ltrans0.s: movq$global.2528, -8(%rbp) #, addr > ./btest_lto.ltrans0.s: movl$global.2528, %eax #, global.22 > ./btest_lto.ltrans0.s: movl$global.2528, %ecx #, global.23 > ./btest_lto.ltrans0.s: .quad global.2528 > How about: ... - int global; + static int global; ... Does that fix the failure? Thanks, - Tom
Re: [PATCH][libbacktrace] Add btest_lto
Hi Tom! On Mon, 25 Feb 2019 18:11:23 +0100, Tom de Vries wrote: > On 25-02-19 11:48, Thomas Schwinge wrote: > > On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: > >> Add libbacktrace test-case using -flto. > > > > I'm seeing this one fail is some configurations, but only in the > > 'build-gcc/libbacktrace/btest_lto.log' variant: > Meaning, compiling libbacktrace using the host compiler, so it would be > useful to known which compiler that is. > > [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a > couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't manage. ] Years old: $ gcc --version gcc (Sourcery CodeBench 2014.05-45) 4.8.3 20140320 (prerelease) [...] $ ld --version GNU ld (Sourcery CodeBench 2014.05-45) 2.24.51.20140217 [...] (It'll be fine for me if you just declare that unsupported.) > > test5: unexpected syminfo name got global.2537 expected global > > PASS: backtrace_full noinline > > PASS: backtrace_full inline > > PASS: backtrace_simple noinline > > PASS: backtrace_simple inline > > FAIL: backtrace_syminfo variable > > FAIL btest_lto (exit status: 1) > > > > I haven't looked yet which details about these GCC build configurations > > might be different/important; maybe you've got an idea already? I can reproduce this with '-O0' ("unexpected syminfo name got global.2528 expected global", in that case). With '-O0 -fdump-tree-all -fdump-ipa-all -save-temps', the 'global.2528' name appears only in 'btest_lto.ltrans0.000i.cgraph', and 'btest_lto.ltrans0.s': ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 (addr)state.2526/56 (read)callback_three.2389/64 (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 (write)failures.2527/57 (read) ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 (addr)state.2526/56 (read)callback_three.2389/64 (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 (write)failures.2527/57 (read) ./btest_lto.ltrans0.000i.cgraph:global.2528/12 (global) @0xf7454118 ./btest_lto.ltrans0.000i.cgraph: References: global.2528/12 (addr)state.2526/56 (read)callback_three.2389/64 (addr)error_callback_three.2384/65 (addr)stderr/20 (read)stderr/20 (read)stderr/20 (read)global.2528/12 (addr)global.2528/12 (addr)stderr/20 (read)stderr/20 (read)failures.2527/57 (read)failures.2527/57 (write)failures.2527/57 (read) ./btest_lto.ltrans0.s: .type global.2528, @object ./btest_lto.ltrans0.s: .size global.2528, 4 ./btest_lto.ltrans0.s:global.2528: ./btest_lto.ltrans0.s: movq$global.2528, -8(%rbp) #, addr ./btest_lto.ltrans0.s: movl$global.2528, %eax #, global.22 ./btest_lto.ltrans0.s: movl$global.2528, %ecx #, global.23 ./btest_lto.ltrans0.s: .quad global.2528 > Well, the backtrace_syminfo function looks at the minimal symbol info > (so, not the dwarf info) and it seems lto has done an optimization that > has changed the name of the variable in the minimal symbol info. > > There's probably a standard way to annotate the 'global' variable to > prevent the optimization from happening, which would fix the failure > (but, we need to know which optimization renamed it). > > OTOH, we could just limit this test to target libbacktrace only, given > the fact that host compilers may not even support flto. Grüße Thomas
Re: [PATCH][libbacktrace] Add btest_lto
On 25-02-19 11:48, Thomas Schwinge wrote: > Hi Tom! > > On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: >> Add libbacktrace test-case using -flto. > > I'm seeing this one fail is some configurations, but only in the > 'build-gcc/libbacktrace/btest_lto.log' variant: > Hi Thomas, Meaning, compiling libbacktrace using the host compiler, so it would be useful to known which compiler that is. [ I've tried a gcc-4.8 and gcc-6 and gcc-7 as host compiler, and a couple of CFLAGS settings (-O2, -O3) to reproduce this, but didn't manage. ] > test5: unexpected syminfo name got global.2537 expected global > PASS: backtrace_full noinline > PASS: backtrace_full inline > PASS: backtrace_simple noinline > PASS: backtrace_simple inline > FAIL: backtrace_syminfo variable > FAIL btest_lto (exit status: 1) > > I haven't looked yet which details about these GCC build configurations > might be different/important; maybe you've got an idea already? > Well, the backtrace_syminfo function looks at the minimal symbol info (so, not the dwarf info) and it seems lto has done an optimization that has changed the name of the variable in the minimal symbol info. There's probably a standard way to annotate the 'global' variable to prevent the optimization from happening, which would fix the failure (but, we need to know which optimization renamed it). OTOH, we could just limit this test to target libbacktrace only, given the fact that host compilers may not even support flto. Thanks, - Tom
Re: [PATCH][libbacktrace] Add btest_lto
Hi Tom! On Fri, 8 Feb 2019 10:42:24 +0100, Tom de Vries wrote: > Add libbacktrace test-case using -flto. I'm seeing this one fail is some configurations, but only in the 'build-gcc/libbacktrace/btest_lto.log' variant: test5: unexpected syminfo name got global.2537 expected global PASS: backtrace_full noinline PASS: backtrace_full inline PASS: backtrace_simple noinline PASS: backtrace_simple inline FAIL: backtrace_syminfo variable FAIL btest_lto (exit status: 1) I haven't looked yet which details about these GCC build configurations might be different/important; maybe you've got an idea already? Grüße Thomas > [libbacktrace] Add btest_lto > > 2019-02-08 Tom de Vries > > * Makefile.am (BUILDTESTS): Add btest_lto. > * Makefile.in: Regenerate. > * btest.c (test1, f2, f3, test3, f22, f23): Declare with > __attribute__((noclone)). > > --- > libbacktrace/Makefile.am | 6 ++ > libbacktrace/Makefile.in | 47 --- > libbacktrace/btest.c | 12 ++-- > 3 files changed, 52 insertions(+), 13 deletions(-) > > diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am > index 71a2ed478cc..46d7de48fd1 100644 > --- a/libbacktrace/Makefile.am > +++ b/libbacktrace/Makefile.am > @@ -222,6 +222,12 @@ btest_LDADD = libbacktrace.la > > BUILDTESTS += btest > > +btest_lto_SOURCES = btest.c testlib.c > +btest_lto_CFLAGS = $(AM_CFLAGS) -g -O -flto > +btest_lto_LDADD = libbacktrace.la > + > +BUILDTESTS += btest_lto > + > btest_alloc_SOURCES = $(btest_SOURCES) > btest_alloc_CFLAGS = $(btest_CFLAGS) > btest_alloc_LDADD = libbacktrace_alloc.la > diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in > index a2b595e9bb0..c65c40d95d8 100644 > --- a/libbacktrace/Makefile.in > +++ b/libbacktrace/Makefile.in > @@ -126,8 +126,8 @@ TESTS = $(am__append_4) $(am__append_6) $(am__append_7) \ > @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_1 = > libbacktrace_elf_for_test.la > @NATIVE_TRUE@am__append_2 = test_elf test_xcoff_32 test_xcoff_64 \ > @NATIVE_TRUE@test_pecoff test_unknown unittest unittest_alloc \ > -@NATIVE_TRUE@btest btest_alloc stest stest_alloc ztest \ > -@NATIVE_TRUE@ztest_alloc edtest edtest_alloc > +@NATIVE_TRUE@btest btest_lto btest_alloc stest stest_alloc \ > +@NATIVE_TRUE@ztest ztest_alloc edtest edtest_alloc > @NATIVE_TRUE@am__append_3 = allocfail > @NATIVE_TRUE@am__append_4 = allocfail.sh > @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_5 = > b2test \ > @@ -205,10 +205,10 @@ libbacktrace_noformat_la_OBJECTS = \ > @NATIVE_TRUE@test_xcoff_64$(EXEEXT) test_pecoff$(EXEEXT) \ > @NATIVE_TRUE@test_unknown$(EXEEXT) unittest$(EXEEXT) \ > @NATIVE_TRUE@unittest_alloc$(EXEEXT) btest$(EXEEXT) \ > -@NATIVE_TRUE@btest_alloc$(EXEEXT) stest$(EXEEXT) \ > -@NATIVE_TRUE@stest_alloc$(EXEEXT) ztest$(EXEEXT) \ > -@NATIVE_TRUE@ztest_alloc$(EXEEXT) edtest$(EXEEXT) \ > -@NATIVE_TRUE@edtest_alloc$(EXEEXT) > +@NATIVE_TRUE@btest_lto$(EXEEXT) btest_alloc$(EXEEXT) \ > +@NATIVE_TRUE@stest$(EXEEXT) stest_alloc$(EXEEXT) \ > +@NATIVE_TRUE@ztest$(EXEEXT) ztest_alloc$(EXEEXT) \ > +@NATIVE_TRUE@edtest$(EXEEXT) edtest_alloc$(EXEEXT) > @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_4 = ttest$(EXEEXT) \ > @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc$(EXEEXT) > @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__EXEEXT_5 = \ > @@ -253,6 +253,13 @@ btest_alloc_OBJECTS = $(am_btest_alloc_OBJECTS) > btest_alloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ > $(LIBTOOLFLAGS) --mode=link $(CCLD) $(btest_alloc_CFLAGS) \ > $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ > +@NATIVE_TRUE@am_btest_lto_OBJECTS = btest_lto-btest.$(OBJEXT) \ > +@NATIVE_TRUE@btest_lto-testlib.$(OBJEXT) > +btest_lto_OBJECTS = $(am_btest_lto_OBJECTS) > +@NATIVE_TRUE@btest_lto_DEPENDENCIES = libbacktrace.la > +btest_lto_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ > + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(btest_lto_CFLAGS) \ > + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ > @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am_ctesta_OBJECTS = > ctesta-btest.$(OBJEXT) \ > @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ctesta-testlib.$(OBJEXT) > ctesta_OBJECTS = $(am_ctesta_OBJECTS) > @@ -410,7 +417,7 @@ SOURCES = $(libbacktrace_la_SOURCES) > $(EXTRA_libbacktrace_la_SOURCES) \ > $(libbacktrace_instrumented_alloc_la_SOURCES) \ > $(libbacktrace_noformat_la_SOURCES) $(allocfail_SOURCES) \ > $(b2test_SOURCES) $(b3test_SOURCES) $(btest_SOURCES) \ > - $(btest_alloc_SOURCES) $(ctesta_SOURCES) \ > + $(btest_alloc_SOURCES) $(btest_lto_SOURCES) $(ctesta_SOURCES) \ > $(ctesta_alloc_SOURCES) $(ctestg_SOURCES) \ > $(ctestg_alloc_SOURCES) $(edtest_SOURCES) \ > $(edtest_alloc_SOURCES) $(stest_SOURCES) \ > @@ -
Re: [PATCH][libbacktrace] Add btest_lto
On Sat, Feb 9, 2019 at 2:59 PM Tom de Vries wrote: > > On 09-02-19 22:49, Ian Lance Taylor wrote: > > On Fri, Feb 8, 2019 at 1:42 AM Tom de Vries wrote: > >> > >> Add libbacktrace test-case using -flto. > >> > >> OK for trunk? > >> > >> Thanks, > >> - Tom > >> > >> [libbacktrace] Add btest_lto > >> > >> 2019-02-08 Tom de Vries > >> > >> * Makefile.am (BUILDTESTS): Add btest_lto. > >> * Makefile.in: Regenerate. > >> * btest.c (test1, f2, f3, test3, f22, f23): Declare with > >> __attribute__((noclone)). > > > > This seems more or less fine, but are there any platforms where -flto > > doesn't work? The docs say "Link-time optimization does not work well > > with generation of debugging information on systems other than those > > using a combination of ELF and DWARF." > > So, we could require HAVE_ELF for this testcase. Works for me. OK with that change. Thanks. Ian
Re: [PATCH][libbacktrace] Add btest_lto
On 09-02-19 22:49, Ian Lance Taylor wrote: > On Fri, Feb 8, 2019 at 1:42 AM Tom de Vries wrote: >> >> Add libbacktrace test-case using -flto. >> >> OK for trunk? >> >> Thanks, >> - Tom >> >> [libbacktrace] Add btest_lto >> >> 2019-02-08 Tom de Vries >> >> * Makefile.am (BUILDTESTS): Add btest_lto. >> * Makefile.in: Regenerate. >> * btest.c (test1, f2, f3, test3, f22, f23): Declare with >> __attribute__((noclone)). > > This seems more or less fine, but are there any platforms where -flto > doesn't work? The docs say "Link-time optimization does not work well > with generation of debugging information on systems other than those > using a combination of ELF and DWARF." So, we could require HAVE_ELF for this testcase. > For example, does this test > pass on Windows? I don't know, I don't have a windows setup. Thanks, - Tom
Re: [PATCH][libbacktrace] Add btest_lto
On Fri, Feb 8, 2019 at 1:42 AM Tom de Vries wrote: > > Add libbacktrace test-case using -flto. > > OK for trunk? > > Thanks, > - Tom > > [libbacktrace] Add btest_lto > > 2019-02-08 Tom de Vries > > * Makefile.am (BUILDTESTS): Add btest_lto. > * Makefile.in: Regenerate. > * btest.c (test1, f2, f3, test3, f22, f23): Declare with > __attribute__((noclone)). This seems more or less fine, but are there any platforms where -flto doesn't work? The docs say "Link-time optimization does not work well with generation of debugging information on systems other than those using a combination of ELF and DWARF." For example, does this test pass on Windows? Ian
[PATCH][libbacktrace] Add btest_lto
Hi, Add libbacktrace test-case using -flto. OK for trunk? Thanks, - Tom [libbacktrace] Add btest_lto 2019-02-08 Tom de Vries * Makefile.am (BUILDTESTS): Add btest_lto. * Makefile.in: Regenerate. * btest.c (test1, f2, f3, test3, f22, f23): Declare with __attribute__((noclone)). --- libbacktrace/Makefile.am | 6 ++ libbacktrace/Makefile.in | 47 --- libbacktrace/btest.c | 12 ++-- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index 71a2ed478cc..46d7de48fd1 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -222,6 +222,12 @@ btest_LDADD = libbacktrace.la BUILDTESTS += btest +btest_lto_SOURCES = btest.c testlib.c +btest_lto_CFLAGS = $(AM_CFLAGS) -g -O -flto +btest_lto_LDADD = libbacktrace.la + +BUILDTESTS += btest_lto + btest_alloc_SOURCES = $(btest_SOURCES) btest_alloc_CFLAGS = $(btest_CFLAGS) btest_alloc_LDADD = libbacktrace_alloc.la diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in index a2b595e9bb0..c65c40d95d8 100644 --- a/libbacktrace/Makefile.in +++ b/libbacktrace/Makefile.in @@ -126,8 +126,8 @@ TESTS = $(am__append_4) $(am__append_6) $(am__append_7) \ @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_1 = libbacktrace_elf_for_test.la @NATIVE_TRUE@am__append_2 = test_elf test_xcoff_32 test_xcoff_64 \ @NATIVE_TRUE@ test_pecoff test_unknown unittest unittest_alloc \ -@NATIVE_TRUE@ btest btest_alloc stest stest_alloc ztest \ -@NATIVE_TRUE@ ztest_alloc edtest edtest_alloc +@NATIVE_TRUE@ btest btest_lto btest_alloc stest stest_alloc \ +@NATIVE_TRUE@ ztest ztest_alloc edtest edtest_alloc @NATIVE_TRUE@am__append_3 = allocfail @NATIVE_TRUE@am__append_4 = allocfail.sh @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@am__append_5 = b2test \ @@ -205,10 +205,10 @@ libbacktrace_noformat_la_OBJECTS = \ @NATIVE_TRUE@ test_xcoff_64$(EXEEXT) test_pecoff$(EXEEXT) \ @NATIVE_TRUE@ test_unknown$(EXEEXT) unittest$(EXEEXT) \ @NATIVE_TRUE@ unittest_alloc$(EXEEXT) btest$(EXEEXT) \ -@NATIVE_TRUE@ btest_alloc$(EXEEXT) stest$(EXEEXT) \ -@NATIVE_TRUE@ stest_alloc$(EXEEXT) ztest$(EXEEXT) \ -@NATIVE_TRUE@ ztest_alloc$(EXEEXT) edtest$(EXEEXT) \ -@NATIVE_TRUE@ edtest_alloc$(EXEEXT) +@NATIVE_TRUE@ btest_lto$(EXEEXT) btest_alloc$(EXEEXT) \ +@NATIVE_TRUE@ stest$(EXEEXT) stest_alloc$(EXEEXT) \ +@NATIVE_TRUE@ ztest$(EXEEXT) ztest_alloc$(EXEEXT) \ +@NATIVE_TRUE@ edtest$(EXEEXT) edtest_alloc$(EXEEXT) @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@am__EXEEXT_4 = ttest$(EXEEXT) \ @HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ ttest_alloc$(EXEEXT) @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am__EXEEXT_5 = \ @@ -253,6 +253,13 @@ btest_alloc_OBJECTS = $(am_btest_alloc_OBJECTS) btest_alloc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(btest_alloc_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +@NATIVE_TRUE@am_btest_lto_OBJECTS = btest_lto-btest.$(OBJEXT) \ +@NATIVE_TRUE@ btest_lto-testlib.$(OBJEXT) +btest_lto_OBJECTS = $(am_btest_lto_OBJECTS) +@NATIVE_TRUE@btest_lto_DEPENDENCIES = libbacktrace.la +btest_lto_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(btest_lto_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@am_ctesta_OBJECTS = ctesta-btest.$(OBJEXT) \ @HAVE_COMPRESSED_DEBUG_TRUE@@NATIVE_TRUE@ ctesta-testlib.$(OBJEXT) ctesta_OBJECTS = $(am_ctesta_OBJECTS) @@ -410,7 +417,7 @@ SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \ $(libbacktrace_instrumented_alloc_la_SOURCES) \ $(libbacktrace_noformat_la_SOURCES) $(allocfail_SOURCES) \ $(b2test_SOURCES) $(b3test_SOURCES) $(btest_SOURCES) \ - $(btest_alloc_SOURCES) $(ctesta_SOURCES) \ + $(btest_alloc_SOURCES) $(btest_lto_SOURCES) $(ctesta_SOURCES) \ $(ctesta_alloc_SOURCES) $(ctestg_SOURCES) \ $(ctestg_alloc_SOURCES) $(edtest_SOURCES) \ $(edtest_alloc_SOURCES) $(stest_SOURCES) \ @@ -880,6 +887,9 @@ BUILDTESTS = $(am__append_2) $(am__append_11) $(am__append_13) @NATIVE_TRUE@btest_SOURCES = btest.c testlib.c @NATIVE_TRUE@btest_CFLAGS = $(AM_CFLAGS) -g -O @NATIVE_TRUE@btest_LDADD = libbacktrace.la +@NATIVE_TRUE@btest_lto_SOURCES = btest.c testlib.c +@NATIVE_TRUE@btest_lto_CFLAGS = $(AM_CFLAGS) -g -O -flto +@NATIVE_TRUE@btest_lto_LDADD = libbacktrace.la @NATIVE_TRUE@btest_alloc_SOURCES = $(btest_SOURCES) @NATIVE_TRUE@btest_alloc_CFLAGS = $(btest_CFLAGS) @NATIVE_TRUE@btest_alloc_LDADD = libbacktrace_alloc.la @@ -1065,6 +1075,10 @@ btest_alloc$(EXEEXT): $(btest_alloc_OBJECTS) $(btest_alloc_DEPENDENCIES) $(EXTRA @rm -f btest_alloc$(EXEEXT) $(AM_V_CCLD)$(btest_alloc_LINK) $(btest_alloc_OBJECTS) $(btest_alloc_LDADD) $(LIBS) +btest_lto$(EXEEXT): $(btest_lto_OBJECTS) $(btest