diff options
author | Alan Modra <amodra@gmail.com> | 2021-09-03 16:26:09 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-09-03 16:26:09 +0930 |
commit | ad77db1c02a92c912f9719f32e2452890aa738ad (patch) | |
tree | 9ef22e47b0711ae8e490471b38c548fab649e9ff /ld/testsuite/ld-pe | |
parent | 2ea9d33a127c09d9c4df0337981e48fb4b7a236f (diff) | |
download | gdb-ad77db1c02a92c912f9719f32e2452890aa738ad.zip gdb-ad77db1c02a92c912f9719f32e2452890aa738ad.tar.gz gdb-ad77db1c02a92c912f9719f32e2452890aa738ad.tar.bz2 |
CC_FOR_TARGET et al
The top level Makefile, the ld Makefile and others, define
CC_FOR_TARGET to be a compiler for the binutils target machine. This
is the compiler that should be used for almost all tests with C
source. There are _FOR_TARGET versions of CFLAGS, CXX, and CXXFLAGS
too. This was all supposed to work with the testsuite .exp files
using CC for the target compiler, and CC_FOR_HOST for the host
compiler, with the makefiles passing CC=$CC_FOR_TARGET and
CC_FOR_HOST=$CC to the runtest invocation.
One exception to the rule of using CC_FOR_TARGET is the native-only ld
bootstrap test, which uses the newly built ld to link a copy of
itself. Since the files being linked were created with the host
compiler, the boostrap test should use CC and CFLAGS, in case some
host compiler option provides needed libraries automatically.
However, bootstrap.exp used CC where it should have used CC_FOR_HOST.
I set about fixing that problem, then decided that playing games in
the makefiles with CC was a bad idea. Not only is it confusing, but
other dejagnu code knows about CC_FOR_TARGET. See dejagnu/target.exp.
So this patch gets rid of the makefile variable renaming and changes
all the .exp files to use the correct _FOR_TARGET variables.
CC_FOR_HOST and CFLAGS_FOR_HOST disappear. A followup patch will
correct bootstrap.exp to use CFLAGS, and a number of other things I
noticed.
binutils/
* testsuite/lib/binutils-common.exp (run_dump_test): Use
CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS.
ld/
* Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET
and similar. Pass variables with unchanged names. Don't set
CC_FOR_HOST or CFLAGS_FOR_HOST.
* Makefile.in: Regenerate.
* testsuite/config/default.exp: Update default CC and similar.
(compiler_supports, plug_opt): Use CC_FOR_TARGET.
* testsuite/ld-cdtest/cdtest.exp: Replace all uses of CC with
CC_FOR_TARGET, and similarly for CFLAGS, CXX and CXXFLAGS.
* testsuite/ld-auto-import/auto-import.exp: Likewise.
* testsuite/ld-cygwin/exe-export.exp: Likewise.
* testsuite/ld-elf/dwarf.exp: Likewise.
* testsuite/ld-elf/indirect.exp: Likewise.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-elfcomm/elfcomm.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-mn10300/mn10300.exp: Likewise.
* testsuite/ld-pe/pe-compile.exp: Likewise.
* testsuite/ld-pe/pe-run.exp: Likewise.
* testsuite/ld-pe/pe-run2.exp: Likewise.
* testsuite/ld-pie/pie.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-plugin/plugin.exp: Likewise.
* testsuite/ld-scripts/crossref.exp: Likewise.
* testsuite/ld-selective/selective.exp: Likewise.
* testsuite/ld-sh/sh.exp: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-undefined/undefined.exp: Likewise.
* testsuite/ld-unique/unique.exp: Likewise.
* testsuite/ld-x86-64/tls.exp: Likewise.
* testsuite/lib/ld-lib.exp: Likewise.
libctf/
* Makefile.am (check-DEJAGNU): Don't set CC to CC_FOR_TARGET.
Pass CC and CC_FOR_TARGET. Don't set CC_FOR_HOST.
* Makefile.in: Regenerate.
* testsuite/config/default.exp: Update default CC and similar.
* testsuite/lib/ctf-lib.exp (run_native_host_cmd): Use CC rather
than CC_FOR_HOST.
(run_lookup_test): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET.
Diffstat (limited to 'ld/testsuite/ld-pe')
-rw-r--r-- | ld/testsuite/ld-pe/pe-compile.exp | 16 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pe-run.exp | 20 | ||||
-rw-r--r-- | ld/testsuite/ld-pe/pe-run2.exp | 20 |
3 files changed, 28 insertions, 28 deletions
diff --git a/ld/testsuite/ld-pe/pe-compile.exp b/ld/testsuite/ld-pe/pe-compile.exp index dad2bfd..5282cfd 100644 --- a/ld/testsuite/ld-pe/pe-compile.exp +++ b/ld/testsuite/ld-pe/pe-compile.exp @@ -34,13 +34,13 @@ if { ![check_compiler_available] } { } proc build_basefile1_o {} { - global CC - global CFLAGS + global CC_FOR_TARGET + global CFLAGS_FOR_TARGET global srcdir global subdir # Compile the object file. - if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/basefile1.s tmpdir/basefile1.o] { fail "compiling basefile1 object" } } @@ -75,24 +75,24 @@ proc run_basefile_test { testname } { } proc build_vers_script_dll_o {} { - global CC - global CFLAGS + global CC_FOR_TARGET + global CFLAGS_FOR_TARGET global srcdir global subdir # Compile the object file. - if ![ld_compile "$CC $CFLAGS -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -shared" $srcdir/$subdir/vers-script-dll.c tmpdir/vers-script-dll.o] { fail "compiling shared lib object" } } proc run_ver_script_test { testname } { - global CC + global CC_FOR_TARGET global srcdir global subdir global verbose - if ![ld_link "$CC -shared \ + if ![ld_link "$CC_FOR_TARGET -shared \ -Wl,--version-script,$srcdir/$subdir/$testname.ver \ -Wl,--output-def,tmpdir/$testname.def" tmpdir/$testname.dll \ "tmpdir/vers-script-dll.o"] { diff --git a/ld/testsuite/ld-pe/pe-run.exp b/ld/testsuite/ld-pe/pe-run.exp index 1efbf89..a26644c 100644 --- a/ld/testsuite/ld-pe/pe-run.exp +++ b/ld/testsuite/ld-pe/pe-run.exp @@ -62,27 +62,27 @@ if { ![check_compiler_available] } { set tmpdir tmpdir proc test_direct_link_dll {} { - global CC - global CFLAGS + global CC_FOR_TARGET + global CFLAGS_FOR_TARGET global srcdir global subdir global tmpdir # Compile the dll. - if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct_dll.c $tmpdir/direct_dll.o ] { fail "compiling shared lib" - } elseif ![ld_link "$CC -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared" $tmpdir/direct_dll.dll "$tmpdir/direct_dll.o" ] { fail "linking shared lib (.dll)" - } elseif ![ld_link "$CC -shared" $tmpdir/direct_dll.sl "$tmpdir/direct_dll.o" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared" $tmpdir/direct_dll.sl "$tmpdir/direct_dll.o" ] { fail "linking shared lib (.sl)" } else { # Compile and link the client program. - if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct_client.c $tmpdir/direct_client.o ] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct_client.c $tmpdir/direct_client.o ] { fail "compiling client" } else { # Check linking directly to direct_dll.dll. set msg "linking client (.dll)" - if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_dll.exe \ + if [ld_link "$CC_FOR_TARGET -Wl,--enable-auto-import" $tmpdir/direct_client_dll.exe \ "$tmpdir/direct_client.o $tmpdir/direct_dll.dll" ] { pass $msg } else { @@ -91,7 +91,7 @@ proc test_direct_link_dll {} { # Check linking directly to direct_dll.sl. set msg "linking client (.sl)" - if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_sl.exe \ + if [ld_link "$CC_FOR_TARGET -Wl,--enable-auto-import" $tmpdir/direct_client_sl.exe \ "$tmpdir/direct_client.o $tmpdir/direct_dll.sl" ] { pass $msg } else { @@ -102,7 +102,7 @@ proc test_direct_link_dll {} { # Create symbolic link. catch "exec ln -fs direct_dll.dll $tmpdir/libdirect_dll.dll.a" ln_catch set msg "linking client (symlink -> .dll)" - if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_dll.exe \ + if [ld_link "$CC_FOR_TARGET -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_dll.exe \ "$tmpdir/direct_client.o $tmpdir/libdirect_dll.dll.a" ] { pass $msg } else { @@ -113,7 +113,7 @@ proc test_direct_link_dll {} { # Create symbolic link. catch "exec ln -fs direct_dll.sl $tmpdir/libdirect_sl.dll.a" ln_catch set msg "linking client (symlink -> .sl)" - if [ld_link "$CC -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_sl.exe \ + if [ld_link "$CC_FOR_TARGET -Wl,--enable-auto-import" $tmpdir/direct_client_symlink_sl.exe \ "$tmpdir/direct_client.o $tmpdir/libdirect_sl.dll.a" ] { pass $msg } else { diff --git a/ld/testsuite/ld-pe/pe-run2.exp b/ld/testsuite/ld-pe/pe-run2.exp index 1bf2e73..b4b4e78 100644 --- a/ld/testsuite/ld-pe/pe-run2.exp +++ b/ld/testsuite/ld-pe/pe-run2.exp @@ -64,27 +64,27 @@ if { ![check_compiler_available] } { set tmpdir tmpdir proc test_direct2_link_dll {} { - global CC - global CFLAGS + global CC_FOR_TARGET + global CFLAGS_FOR_TARGET global srcdir global subdir global tmpdir # Compile the dll. - if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] { fail "compiling shared lib fastcall/stdcall" - } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o" ] { fail "linking shared lib (.dll) fastcall/stdcall" - } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o" ] { fail "linking shared lib (.sl) fastcall/stdcall" } else { # Compile and link the client program. - if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] { + if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] { fail "compiling client fastcall/stdcall" } else { # Check linking directly to direct2_dll.dll. set msg "linking client (.dll) fastcall/stdcall" - if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \ + if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \ "$tmpdir/direct2_client.o $tmpdir/direct2_dll.dll" ] { pass $msg } else { @@ -93,7 +93,7 @@ proc test_direct2_link_dll {} { # Check linking directly to direct2_dll.sl. set msg "linking client (.sl) fastcall/stdcall" - if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \ + if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \ "$tmpdir/direct2_client.o $tmpdir/direct2_dll.sl" ] { pass $msg } else { @@ -104,7 +104,7 @@ proc test_direct2_link_dll {} { # Create symbolic link. catch "exec ln -fs direct2_dll.dll $tmpdir/libdirect2_dll.dll.a" ln_catch set msg "linking client (symlink -> .dll) fastcall/stdcall" - if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \ + if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \ "$tmpdir/direct2_client.o $tmpdir/libdirect2_dll.dll.a" ] { pass $msg } else { @@ -115,7 +115,7 @@ proc test_direct2_link_dll {} { # Create symbolic link. catch "exec ln -fs direct2_dll.sl $tmpdir/libdirect2_sl.dll.a" ln_catch set msg "linking client (symlink -> .sl) fastcall/stdcall" - if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \ + if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \ "$tmpdir/direct2_client.o $tmpdir/libdirect2_sl.dll.a" ] { pass $msg } else { |