On 1/8/21 3:23 PM, David Edelsohn wrote: > On Thu, Jan 7, 2021 at 5:18 PM Bernd Edlinger <bernd.edlin...@hotmail.de> > wrote: >> >> Hi, >> >> On 1/7/21 5:12 PM, Rainer Orth wrote: >>> The unsetenv needs to be wrapped in >>> >>> if [info exists env(MAKEFLAGS)] { >>> >> >> Done. >> >>> @@ -163,6 +167,9 @@ proc outest { test sources opts dirs out >>> if { $ogl != {} } { >>> pass "$test: $d$o" >>> file delete $ogl >>> + } elseif { [string match "*.ld1_args" $o] } { >>> + # This file may be missing if !HAVE_GNU_LD >>> + pass "$test: $d$o" >>> >>> Always PASSing the test even if it isn't run is wrong. Either wrap >>> the whole group of tests with response files in >>> >>> if [check_effective_target_gld] { >>> >>> or make the test for the *.ld1_args file conditional on that >>> (e.g. along the lines of $ltop used elsewhere). I'd welcome input >>> from Alexandre which is preferred. >>> >> >> Ah, yes that is a good idea. Thanks. >> >> >> I think the .cdtor.* handling, is probably a bad example that I followed >> here. >> I don't know why that is there in the first place, as there >> are no C++ test cases, these files should not be created at all. >> If they are ever created we would have a couple of other files created >> as well IMHO. >> If there are still missing files in some cases, >> I'd prefer to track these per test case, instead of globally. >> >> Therefore I propose to remove that exception for now. >> >> Is it OK for trunk? > > As Alex said, please don't just remove features and functionality if > you don't know why they were added. The history is online in the > mailing list and the repo history. > > AIX uses constructors to register EH frames and libgcc has an EH > frame. ctors and dtors can be found in non-C++ code. >
Okydoky. I think I understand now better what the issue is here. Although the name cdtor suggests that it has something to do with C++ it is also needed to collect EH frame info, in certain targets. Those are mainly AIX but also hppa*-*-hpux*. I believe those exceptions are only necessary for targets that define EH_FRAME_THROUGH_COLLECT2. I have tested this new version of my patch but only on not-affected x86_64-pc-linux-gnu. @David, @Rainer: I would very much appreciate if you could give this patch a test on your systems. Thanks Berns.
From 861f6631c34bdcbc0d6f61247cc231c1f1b36708 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger <bernd.edlin...@hotmail.de> Date: Thu, 7 Jan 2021 09:37:32 +0100 Subject: [PATCH] testsuite: Fix test failures from outputs.exp [PR98225] The .ld1_args file is not created when HAVE_GNU_LD is false. The ltrans0.ltrans_arg file is not created when the make jobserver is available, so remove the MAKEFLAGS variable. Add an exception for *.gcc_args files similar to the exception for *.cdtor.* files. Limit both exceptions to targets that define EH_FRAME_THROUGH_COLLECT2. That means although the test case does not use C++ constructors or destructors it is still using dwarf2 frame info. 2021-01-07 Bernd Edlinger <bernd.edlin...@hotmail.de> PR testsuite/98225 * gcc.misc-tests/outputs.exp: Unset MAKEFLAGS. Expect .ld1_args only when GNU LD is used. Add an exception for *.gcc_args files. --- gcc/testsuite/gcc.misc-tests/outputs.exp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index 80d4b61..d5a9709 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -50,6 +50,9 @@ if !$skip_lto { set ltop [check_linker_plugin_available] } +# Check for GNU LD. Some files like .ld1_args depend on this. +set gld [check_effective_target_gld] + # Prepare additional options to be used for linking. # We do not compile to an executable, because that requires naming an output. set link_options "" @@ -67,6 +70,12 @@ if {[board_info $dest exists output_format]} { append link_options " additional_flags=-Wl,-oformat,[board_info $dest output_format]" } +# Avoid possible influence from the make jobserver, +# otherwise ltrans0.ltrans_args files may be missing. +if [info exists env(MAKEFLAGS)] { + unsetenv MAKEFLAGS +} + # For the test named TEST, run the compiler with SOURCES and OPTS, and # look in DIRS for OUTPUTS. SOURCES is a list of suffixes for source # files starting with $b in $srcdir/$subdir, OPTS is a string with @@ -130,6 +139,7 @@ proc outest { test sources opts dirs outputs } { foreach og $olist { if { [string index $og 0] == "!" } { global gspd ltop + global gld set cond [expr $og] continue } @@ -181,7 +191,10 @@ proc outest { test sources opts dirs outputs } { file delete $f # collect2 may create <execname>.cdtor* files in -save-temps link tests, # ??? without regard to aux output naming conventions. - if ![string match "*.cdtor.*" $f] then { + # Limit this exception to targets that define EH_FRAME_THROUGH_COLLECT2. + if { !(([istarget powerpc*-*-aix*] || [is_target hppa*-*-hpux*]) + && ([string match "*.cdtor.*" $f] + || [string match "*.gcc_args" $f])) } { lappend outb $f } } @@ -285,10 +298,10 @@ outest "$b exe savetmp namedb" $sing "-o $b.exe -save-temps" {} {{--0.i --0.s -- outest "$b exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}} # Additional files are created when an @file is used -outest "$b exe savetmp namedb" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 .ld1_args .exe}} -outest "$b exe savetmp named2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 .ld1_args .exe}} -outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .ld1_args .exe}} -outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 .ld1_args .exe}} +outest "$b exe savetmp namedb" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b exe savetmp named2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} +outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} +outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} # Setting the main output to a dir selects it as the default aux&dump # location. -- 1.9.1