From 0ade20c5688d328ea91d4822384af46d7f899cb1 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 20 Aug 2022 17:21:08 +0930 Subject: [PATCH] Re: Missing linking test case for pe dll using a def file Fixes this when cross-compiling from x86_64-linux x86_64-w64-mingw32 +FAIL: compiling shared lib fastcall/stdcall * testsuite/ld-pe/pe-run2-def.exp (test_direct2_link_dll_def): Use CC_FOR_TARGET and CFLAGS_FOR_TARGET rather than CC and CFLAGS. --- ld/testsuite/ld-pe/pe-run2-def.exp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ld/testsuite/ld-pe/pe-run2-def.exp b/ld/testsuite/ld-pe/pe-run2-def.exp index ecac9b01a2b..0f8296e2e41 100644 --- a/ld/testsuite/ld-pe/pe-run2-def.exp +++ b/ld/testsuite/ld-pe/pe-run2-def.exp @@ -64,27 +64,27 @@ if { ![check_compiler_available] } { set tmpdir tmpdir proc test_direct2_link_dll_def {} { - 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 $srcdir/$subdir/direct2_dll.def" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] { 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 $srcdir/$subdir/direct2_dll.def" ] { + } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] { 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 to import library. 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 -L$tmpdir -ldirect2_dll" ] { pass $msg } else { @@ -93,7 +93,7 @@ proc test_direct2_link_dll_def {} { # 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 { @@ -102,7 +102,7 @@ proc test_direct2_link_dll_def {} { # 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 { @@ -113,7 +113,7 @@ proc test_direct2_link_dll_def {} { # 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 { @@ -124,7 +124,7 @@ proc test_direct2_link_dll_def {} { # 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 { -- 2.30.2