]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Enable dlltool --leading-underscore for targets other than x86
authorAlan Modra <amodra@gmail.com>
Wed, 2 Oct 2024 05:09:02 +0000 (14:39 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 3 Oct 2024 03:01:46 +0000 (12:31 +0930)
This also makes the dlltool tests run more PE targets, finding that
sh-pe dlltool reports "Machine 'sh' not supported".  I guess no one
cares about that.

PR19459
* dlltool.c (asm_prefix): Remove "mach" parameter.  Return
leading_underscore independent of machine.
(ASM_PREFIX): Adjust.
* testsuite/binutils-all/dlltool.exp: Run on any target
satisfying is_pecoff_format for which dlltool is built.
Revert commit 0398b8d6c86a.  Remove target_xfail.

binutils/dlltool.c
binutils/testsuite/binutils-all/dlltool.exp

index c7f4b15424240ebd8f88e9da321cab6da7220f73..9acd080b7b6de6e615d90ed57fd88d09db306b95 100644 (file)
@@ -903,11 +903,8 @@ rvabefore (int mach)
 }
 
 static const char *
-asm_prefix (int mach, const char *name)
+asm_prefix (const char *name)
 {
-  /* ??? --leading_underscore is only supported on x86.  */
-  if (!(mach == M386 || mach == MX86))
-    return "";
   /* Symbol names starting with ? do not have a leading underscore.  */
   if (name && *name == '?')
     return "";
@@ -925,7 +922,7 @@ asm_prefix (int mach, const char *name)
 #define ASM_ALIGN_SHORT                mtable[machine].how_align_short
 #define ASM_RVA_BEFORE         rvabefore (machine)
 #define ASM_RVA_AFTER          rvaafter (machine)
-#define ASM_PREFIX(NAME)       asm_prefix (machine, (NAME))
+#define ASM_PREFIX(NAME)       asm_prefix (NAME)
 #define ASM_ALIGN_LONG         mtable[machine].how_align_long
 #define HOW_BFD_READ_TARGET    0  /* Always default.  */
 #define HOW_BFD_WRITE_TARGET   mtable[machine].how_bfd_target
index ac1306bdf77ef6b2e7af806ce7691425ba46170c..7bae86b61bc198ed315afd2a7f4104140fc56e2e 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
 
-if {![istarget "i*86-*-*"]
-    && ![istarget "x86_64-*-mingw*"]
-    && ![istarget "arm-*-pe*"]} {
+if { ![is_pecoff_format] } {
     return
 }
 
-if {![istarget "i*86-*-*pe*"] \
-    && ![istarget "i*86-*-cygwin*"] \
-    && ![istarget "i*86-*-mingw32*"] \
-    && ![istarget "arm-*-pe*"] \
-    && ![istarget "x86_64-*-mingw*"] } {
-    set target_xfail "yes"
-} else {
-    set target_xfail "no"
-}
-
-# PR 19459: The ARM does not support inserting a leading underscore.
-if { [istarget "arm-*-pe*"] } {
-    set target_no_leading_underscore "yes"
-} else {
-    set target_no_leading_underscore "no"
-}
-
 if {![info exists DLLTOOL]} then {
     return
 }
@@ -56,10 +37,6 @@ if ![string match "" $err] then {
     pass "dlltool (fastcall export)"
 }
 
-if { "$target_xfail" == "yes" } {
-    setup_xfail *-*
-}
-
 verbose "$DLLTOOL -l libversion.a --def $srcdir/$subdir/version.def $dlltool_gas_flag" 1
 catch "exec $DLLTOOL -l libersion.a --def $srcdir/$subdir/version.def $dlltool_gas_flag" err
 
@@ -71,10 +48,6 @@ if ![string match "" $err] then {
     pass "dlltool (version.dll)"
 }
 
-if { "$target_xfail" == "yes" } {
-    setup_xfail *-*
-}
-
 verbose "$DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" 1
 catch "exec $DLLTOOL -p prefix --leading-underscore -l tmpdir/libalias.a -d $srcdir/$subdir/alias.def $dlltool_gas_flag" err
 
@@ -88,11 +61,7 @@ if ![string match "" $err] then {
 pass "dlltool -p (execution)"
 
 set got [binutils_run $NM "tmpdir/libalias.a"]
-if { "$target_no_leading_underscore" == "yes" } {
-    set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
-} else {
-    set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
-}
+set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
 
 if [regexp $want $got] then {
     pass "dlltool -p (symbol names)"
@@ -122,11 +91,7 @@ if ![string match "" $err] then {
 pass "dlltool -p (execution) alias-2.def"
 
 set got [binutils_run $NM "tmpdir/libalias2.a"]
-if { "$target_no_leading_underscore" == "yes" } {
-    set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
-} else {
-    set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
-}
+set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
 
 if [regexp $want $got] then {
     pass "dlltool -p (symbol names) alias-2.def"
@@ -241,15 +206,7 @@ if ![string match "" $err] then {
 pass "dlltool -p (execution leading-underscore)"
 
 set got [binutils_run $NM "tmpdir/libalias_u.a"]
-if { "$target_no_leading_underscore" == "yes" } {
-    set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
-} else {
-    set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
-}
-
-if { "$target_xfail" == "yes" } {
-    setup_xfail *-*
-}
+set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
 
 if [regexp $want $got] then {
     pass "dlltool -p (symbol names leading underscore)"
@@ -279,11 +236,7 @@ if ![string match "" $err] then {
 pass "dlltool -p (execution leading underscore) alias-2.def"
 
 set got [binutils_run $NM "tmpdir/libalias_u2.a"]
-if { "$target_no_leading_underscore" == "yes" } {
-    set want "00000000 I __imp_prefixsymbol.*00000000 T prefixsymbol.*00000000 I __imp_symbol.*00000000 T symbol"
-} else {
-    set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
-}
+set want "00000000 I __imp__prefix_symbol.*00000000 T _prefix_symbol.*00000000 I __imp__symbol.*00000000 T _symbol"
 
 if [regexp $want $got] then {
     pass "dlltool -p (symbol names leading underscore) alias-2.def"