Hi, Gentle ping this: https://gcc.gnu.org/pipermail/gcc-patches/2026-October/735546.html
BR, Kewen 在 2026/10/21 16:59, Kewen Lin 写道: > Hi Richi, > > 在 2026/10/15 13:42, Kewen Lin 写道: >> 在 2026/10/14 21:57, Richard Biener 写道: >>> On Wed, Oct 14, 2026 at 9:40 AM Kewen Lin <[email protected]> wrote: >>>> >>>> 在 2026/10/14 14:08, Richard Biener 写道: >>>>> On Wed, Oct 14, 2026 at 3:54 AM Kewen Lin <[email protected]> wrote: >>>>>> >>>>>> 在 2026/10/13 17:08, Richard Biener 写道: >>>>>>> On Tue, Oct 13, 2026 at 9:50 AM Kewen Lin <[email protected]> wrote: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> When adding vector math lib support, I found trigonometric pi-based >>>>>>>> functions introduced by r16-710-g591d3d02664c7b are missing from >>>>>>>> macro SEQ_OF_CASE_MATHFN in function mathfn_built_in_2, which caused >>>>>>>> ICE as hanlder assumes there is a non-null function declaration but >>>>>>>> actually mathfn_built_in cannot map their combined_fn codes to >>>>>>>> type-specific builtin declarations. >>>>>>>> >>>>>>>> I think this is an oversight, so this patch is to add those >>>>>>>> trigonometric pi-based builtins to SEQ_OF_CASE_MATHFN, and keep >>>>>>>> builtin_with_linkage_p in sync as well. >>>>>>>> >>>>>>>> Bootstrapped and the regression-tested well, is it ok for trunk? >>>>>>> >>>>>>> OK. >>>>>> >>>>>> Thanks Richi, pushed as r17-5176-g10e202e107d23a. >>>>>> >>>>>> Do we want it to be backported to gcc-16 branch? >>>>>> If yes, is it ok to backport after burn-in time? >>>>> >>>>> Can you add a testcase then? Then it's OK to backport. >>>> >>>> Sure, without the VML change, it seems no way to construct a test case >>>> for showing ICE, so I didn't include a testcase in the original patch. >>>> With AI's assistance, I have now constructed a testcase for the >>>> builtin_with_linkage_p path instead, so a follow-up patch for test >>>> case is listed below. Is it ok for trunk and backporting? >>> >>> OK. >> >> Thanks again, pushed as r17-5210-g3d0eda79500695. > > Linaro-TCWG-CI reported one regression [1] with the symptom like: >> | ERROR: gcc.dg/builtin-pi-linkage.c: error executing dg-final: >> /WORKSPACE/abe/builds/destdir/x86_64-pc-linux-gnu/arm-eabi/bin/nm: >> builtin-pi-linkage.o: plugin needed to handle lto object > > I made a patch forcing it to adopt gcc-nm (referring to the existing search > for gcc-ar) to scan, I think it can resolve the issue. The patch also > considers > the possible noise from fat-lto-objects and fixes a latent issue (target > selector handling logic unreachable) in proc lto-scan-common. > > [1] https://gcc.gnu.org/pipermail/gcc-regression/2026-October/084489.html > > The patch is listed below, tested as before, is it ok for trunk and > backporting? > > BR, > Kewen > ----- > [PATCH] testsuite: Use gcc-nm to scan LTO object symbols > > Plain nm can require an explicit plugin to read slim LTO objects, causing > the pi-based builtin linkage test to fail on some targets. Add > scan-lto-symbol to select gcc-nm using the same lookup and override rules > as gcc-ar in lto.exp, while keeping scan-symbol on its existing nm path. > > Fat LTO objects also carry a full ELF symbol table, so the scan could > pass even when the LTO sections lack the references; force slim objects > with -fno-fat-lto-objects. Require linker-plugin support before scanning > slim objects with gcc-nm. > > The old scan-symbol-common declared args last, making it Tcl's varargs > parameter. Its callers passed the scan arguments as one list, so Tcl > wrapped that list and the target selector was not recognized. The optional > nm_cmd makes args an ordinary parameter and preserves the list. Also let > scan-symbol and scan-symbol-not return when a selector skips the test. > > Assisted-by: LLM > > gcc/testsuite/ChangeLog: > > * gcc.dg/builtin-pi-linkage.c: Use scan-lto-symbol. Force slim > LTO objects with -fno-fat-lto-objects and require linker-plugin > support. > * lib/gcc-dg.exp (scan-symbol-common): Accept an optional nm command > and preserve the scan argument list so target selectors are recognized. > (scan-symbol, scan-symbol-not): Handle skipped target selectors. > (scan-lto-symbol): New procedure. > > Signed-off-by: Kewen Lin <[email protected]> > --- > gcc/testsuite/gcc.dg/builtin-pi-linkage.c | 17 +++--- > gcc/testsuite/lib/gcc-dg.exp | 74 ++++++++++++++++++----- > 2 files changed, 69 insertions(+), 22 deletions(-) > > diff --git a/gcc/testsuite/gcc.dg/builtin-pi-linkage.c > b/gcc/testsuite/gcc.dg/builtin-pi-linkage.c > index 93c25e4226f..4363e65fd1d 100644 > --- a/gcc/testsuite/gcc.dg/builtin-pi-linkage.c > +++ b/gcc/testsuite/gcc.dg/builtin-pi-linkage.c > @@ -1,6 +1,7 @@ > /* { dg-do assemble } */ > /* { dg-require-effective-target lto } */ > -/* { dg-options "-O2 -flto" } */ > +/* { dg-require-linker-plugin "" } */ > +/* { dg-options "-O2 -flto -fno-fat-lto-objects" } */ > > /* LTO should record library references for all pi-based builtins. */ > > @@ -54,10 +55,10 @@ f7 (double x) > return tanpi (x); > } > > -/* { dg-final { scan-symbol "acospi" } } */ > -/* { dg-final { scan-symbol "asinpi" } } */ > -/* { dg-final { scan-symbol "atan2pi" } } */ > -/* { dg-final { scan-symbol "atanpi" } } */ > -/* { dg-final { scan-symbol "cospi" } } */ > -/* { dg-final { scan-symbol "sinpi" } } */ > -/* { dg-final { scan-symbol "tanpi" } } */ > +/* { dg-final { scan-lto-symbol "acospi" } } */ > +/* { dg-final { scan-lto-symbol "asinpi" } } */ > +/* { dg-final { scan-lto-symbol "atan2pi" } } */ > +/* { dg-final { scan-lto-symbol "atanpi" } } */ > +/* { dg-final { scan-lto-symbol "cospi" } } */ > +/* { dg-final { scan-lto-symbol "sinpi" } } */ > +/* { dg-final { scan-lto-symbol "tanpi" } } */ > diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp > index 9f183259257..1aa198714cc 100644 > --- a/gcc/testsuite/lib/gcc-dg.exp > +++ b/gcc/testsuite/lib/gcc-dg.exp > @@ -1388,12 +1388,13 @@ proc gdb-exists { args } { > return 0; > } > > -# Helper function for scan-symbol and scan-symbol-not. It scans a symbol in > -# the final executable and return 1 if present, otherwise fail. > +# Helper function for scan-symbol, scan-symbol-not and scan-lto-symbol. It > +# scans the output file and returns 1 if the symbol is present, otherwise 0. > # > # Argument 0 is the regexp to match. > # Argument 1 handles expected failures and the like > -proc scan-symbol-common { scan_directive args } { > +# Argument 2 overrides the default nm command for LTO objects. > +proc scan-symbol-common { scan_directive args {nm_cmd ""} } { > global nm > global base_dir > > @@ -1409,14 +1410,17 @@ proc scan-symbol-common { scan_directive args } { > } > } > > - # Find nm like we find g++ in g++.exp. > - if ![info exists nm] { > - set nm [findfile $base_dir/../../../binutils/nm \ > - $base_dir/../../../binutils/nm \ > - [findfile $base_dir/../../nm $base_dir/../../nm \ > - [findfile $base_dir/nm $base_dir/nm \ > - [transform nm]]]] > - verbose -log "nm is $nm" > + if { $nm_cmd eq "" } { > + # Find nm like we find g++ in g++.exp. > + if ![info exists nm] { > + set nm [findfile $base_dir/../../../binutils/nm \ > + $base_dir/../../../binutils/nm \ > + [findfile $base_dir/../../nm $base_dir/../../nm \ > + [findfile $base_dir/nm $base_dir/nm \ > + [transform nm]]]] > + verbose -log "nm is $nm" > + } > + set nm_cmd $nm > } > > set output_file "[glob -nocomplain $output_file]" > @@ -1425,7 +1429,7 @@ proc scan-symbol-common { scan_directive args } { > return > } > > - set fd [open "| $nm $output_file" r] > + set fd [open "| $nm_cmd $output_file" r] > set text [read $fd] > close $fd > > @@ -1443,13 +1447,51 @@ proc scan-symbol-common { scan_directive args } { > # Argument 1 handles expected failures and the like > proc scan-symbol { args } { > set testcase [testname-for-summary] > - if { [scan-symbol-common "scan-symbol" $args]} { > + set found [scan-symbol-common "scan-symbol" $args] > + if { $found eq "" } { > + return > + } > + if { $found } { > pass "$testcase scan-symbol $args" > } else { > fail "$testcase scan-symbol $args" > } > } > > +# Scan a symbol in an LTO object using gcc-nm to load the LTO plugin. > +# Call pass if pattern is present, otherwise fail. > +# > +# Argument 0 is the regexp to match. > +# Argument 1 handles expected failures and the like > +proc scan-lto-symbol { args } { > + global GCC_UNDER_TEST > + global GCC_NM_UNDER_TEST > + > + if ![info exists GCC_NM_UNDER_TEST] { > + if { ![is_remote host] > + && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { > + set nm_dir [file dirname [lindex $GCC_UNDER_TEST 0]] > + set nm_cmd $nm_dir/[gcc-transform-out-of-tree gcc-nm] > + } else { > + set nm_cmd [gcc-transform-out-of-tree gcc-nm] > + } > + set nm_cmd "$nm_cmd [lrange $GCC_UNDER_TEST 1 end]" > + } else { > + set nm_cmd $GCC_NM_UNDER_TEST > + } > + > + set testcase [testname-for-summary] > + set found [scan-symbol-common "scan-lto-symbol" $args $nm_cmd] > + if { $found eq "" } { > + return > + } > + if { $found } { > + pass "$testcase scan-lto-symbol $args" > + } else { > + fail "$testcase scan-lto-symbol $args" > + } > +} > + > # Utility for scanning a symbol in the final executable, invoked via > dg-final. > # Call pass if pattern is absent, otherwise fail. > # > @@ -1457,7 +1499,11 @@ proc scan-symbol { args } { > # Argument 1 handles expected failures and the like > proc scan-symbol-not { args } { > set testcase [testname-for-summary] > - if { [scan-symbol-common "scan-symbol-not" $args]} { > + set found [scan-symbol-common "scan-symbol-not" $args] > + if { $found eq "" } { > + return > + } > + if { $found } { > fail "$testcase scan-symbol-not $args" > } else { > pass "$testcase scan-symbol-not $args"
