[binutils-gdb] Fixes to "PR 31728 testcases"

Alan Modra amodra@sourceware.org
Mon Jul 29 10:33:01 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6c41f7a812d843d6ba76b65ec7e66074fbfed041

commit 6c41f7a812d843d6ba76b65ec7e66074fbfed041
Author: Alan Modra <amodra@gmail.com>
Date:   Sat Jul 27 09:13:27 2024 +0930

    Fixes to "PR 31728 testcases"
    
    This brings us down to just these fails for the set of targets I
    usually test when making testsuite changes.
    aarch64-pe  +FAIL: ld-pe/symbols-ordinals-hints-imports-ld
    arm-pe  +FAIL: ld-pe/symbols-ordinals-hints-exports-dlltool
    arm-pe  +FAIL: ld-pe/symbols-ordinals-hints-imports-dlltool
    
    The aarch64 one is likely due to the target missing support somewhere.
    It is fairly new, I haven't investigated.  The arm-pe fails are due to
    arm-pe being a target that adds underscores to symbol names (see
    config.bfd) whereas dlltool thinks it does not (see
    dlltool.c:asm_prefix).  arm-wince-pe on the other hand doesn't add
    underscores.  I would guess the right fix for dlltool is to get this
    symbol info from bfd using bfd_get_target_info.
    
    Note I'm not very happy about the creative use of ld_after_inputfile
    in symbols-ordinals-hints-imports-ld.d, which is likely to break with
    some future run_dump_test change.

Diff:
---
 ld/testsuite/ld-pe/pe.exp                          | 18 ++++++++++++----
 .../ld-pe/symbols-ordinals-hints-call-imports.s    | 23 ++++++++++++++------
 .../ld-pe/symbols-ordinals-hints-exports-dlltool.d |  4 ++--
 .../ld-pe/symbols-ordinals-hints-exports.s         | 25 ++++++++++++++++------
 .../ld-pe/symbols-ordinals-hints-imports-dlltool.d |  4 ++--
 .../ld-pe/symbols-ordinals-hints-imports-ld.d      |  4 ++--
 6 files changed, 55 insertions(+), 23 deletions(-)

diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp
index 457b667c364..6a1afef578b 100644
--- a/ld/testsuite/ld-pe/pe.exp
+++ b/ld/testsuite/ld-pe/pe.exp
@@ -145,7 +145,17 @@ run_dump_test "exclude-symbols-embedded-x86_64"
 run_dump_test "exclude-symbols-def-i386"
 run_dump_test "exclude-symbols-def-x86_64"
 
-run_dump_test "symbols-ordinals-hints-exports-ld"
-run_dump_test "symbols-ordinals-hints-exports-dlltool"
-run_dump_test "symbols-ordinals-hints-imports-ld"
-run_dump_test "symbols-ordinals-hints-imports-dlltool"
+if [check_shared_lib_support] {
+    set old_ASFLAGS $ASFLAGS
+    if [is_underscore_target] {
+	append ASFLAGS " --defsym UNDERSCORE=1"
+    }
+    run_dump_test "symbols-ordinals-hints-exports-ld"
+    # no dlltool for these two
+    setup_xfail aarch64-*-* sh-*-*
+    run_dump_test "symbols-ordinals-hints-exports-dlltool"
+    run_dump_test "symbols-ordinals-hints-imports-ld"
+    setup_xfail aarch64-*-* sh-*-*
+    run_dump_test "symbols-ordinals-hints-imports-dlltool"
+    set ASFLAGS $old_ASFLAGS
+}
diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s b/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s
index 475f72ee85e..57fd3ed4ba8 100644
--- a/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s
+++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-call-imports.s
@@ -1,8 +1,17 @@
-.global _func
+.ifdef UNDERSCORE
+ .global _func
 _func:
-  call __imp__sym1
-  call __imp__sym2
-  call __imp__sym3
-  call __imp__sym4
-  call __imp__sym5
-  ret
+  .dc.a __imp__sym1
+  .dc.a __imp__sym2
+  .dc.a __imp__sym3
+  .dc.a __imp__sym4
+  .dc.a __imp__sym5
+.else
+ .global func
+func:
+  .dc.a __imp_sym1
+  .dc.a __imp_sym2
+  .dc.a __imp_sym3
+  .dc.a __imp_sym4
+  .dc.a __imp_sym5
+.endif
diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d
index 8de09760cec..fad59eab604 100644
--- a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d
+++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports-dlltool.d
@@ -1,6 +1,6 @@
 #source: symbols-ordinals-hints-exports.s
-#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -e exports-dlltool.o
-#ld: -shared exports-dlltool.o
+#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -e tmpdir/exports-dlltool.o
+#ld: -shared tmpdir/exports-dlltool.o
 #objdump: -p
 
 # Rules for Ordinal/Name Pointer Table:
diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s
index d775d7093c5..26ee52b016d 100644
--- a/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s
+++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-exports.s
@@ -1,12 +1,25 @@
 # define symbols in no specific order
-.global _sym2
-.global _sym5
-.global _sym3
-.global _sym1
-.global _sym4
+.ifdef UNDERSCORE
+ .global _sym2
+ .global _sym5
+ .global _sym3
+ .global _sym1
+ .global _sym4
 _sym2:
 _sym5:
 _sym3:
 _sym1:
 _sym4:
-  ret
+.else
+ .global sym2
+ .global sym5
+ .global sym3
+ .global sym1
+ .global sym4
+sym2:
+sym5:
+sym3:
+sym1:
+sym4:
+.endif
+ .nop
diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d
index 6cfa5c4a02f..5f3702e3b08 100644
--- a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d
+++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-dlltool.d
@@ -1,7 +1,7 @@
 #source: symbols-ordinals-hints-call-imports.s
-#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -l libimports-dlltool.a
+#dlltool: -d ${srcdir}/${subdir}/symbols-ordinals-hints.def -l tmpdir/libimports-dlltool.a
 #ld: -shared
-#ld_after_inputfiles: libimports-dlltool.a
+#ld_after_inputfiles: tmpdir/libimports-dlltool.a
 #objdump: -p
 
 # Rules for Import Tables:
diff --git a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d
index 1b173510a84..7b7cdaadb2d 100644
--- a/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d
+++ b/ld/testsuite/ld-pe/symbols-ordinals-hints-imports-ld.d
@@ -1,6 +1,6 @@
 #source: symbols-ordinals-hints-exports.s
-#ld: -shared ${srcdir}/${subdir}/symbols-ordinals-hints.def --out-implib libimports-ld.a
-#ld_after_inputfiles: && $AS ${srcdir}/${subdir}/symbols-ordinals-hints-call-imports.s -o call-imports-ld.o && $LD -shared call-imports-ld.o libimports-ld.a -o tmpdir/dump
+#ld: -shared ${srcdir}/${subdir}/symbols-ordinals-hints.def --out-implib tmpdir/libimports-ld.a
+#ld_after_inputfiles: && $AS $ASFLAGS ${srcdir}/${subdir}/symbols-ordinals-hints-call-imports.s -o tmpdir/call-imports-ld.o && $LD -shared tmpdir/call-imports-ld.o tmpdir/libimports-ld.a -o tmpdir/dump
 #objdump: -p
 
 # Rules for Import Tables:


More information about the Binutils-cvs mailing list