[COMMITTED] hppa*64*-*-hpux*: Create dummy milli.a archive for binutils and ld tests

Message ID ahNbZYyU-pwmC6oe@mx3210.local
State New
Headers
Series [COMMITTED] hppa*64*-*-hpux*: Create dummy milli.a archive for binutils and ld tests |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

John David Anglin May 24, 2026, 8:11 p.m. UTC
  Tested on x86_64-pc-linux-gnu and hppa64-hp-hpux11.11.  Committed
to trunk.

Dave
---

hppa*64*-*-hpux*: Create dummy milli.a archive for binutils and ld tests

On cross builds, this fixes numerous test fails due to the milli.a
archive not being found.  On hppa*64*-*-hpux*, this fixes four fails
due to undefined symbols in the HP milli.a archive.

The change to objcopy.exp causes the "objcopy executable (pr25662)"
test to fail.  Previously, it didn't run because milli.a wasn't
found.

2026-05-24  John David Anglin  <danglin@gcc.gnu.org>

binutils/ChangeLog:

	* testsuite/binutils-all/objcopy.exp: Append LDFLAGS to
	ldflags for milli.a archive.
	* testsuite/config/default.exp: Create dummy milli.a archive
	in tmpdir/hppa.  Append " -Ltmpdir/hppa" to LDFLAGS.

ld/ChangeLog:

	* testsuite/config/default.exp: Likewise.
  

Patch

diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 8d5b1564a3c..c11b911df67 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1570,6 +1570,11 @@  if { [istarget *-*-cygwin] || [istarget *-*-mingw*] } {
    append ldflags " --disable-reloc-section"
 }
 
+# Append LDFLAGS for milli.a archive
+if { [istarget hppa*64*-*-hpux*] } {
+   append ldflags " $LDFLAGS"
+}
+
 #xcoff doesn't support arbitrary sections
 if { ![is_xcoff_format] } {
     objcopy_test "pr25662" $src executable "" $ldflags
diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp
index 25bd1e64222..3c065e52f56 100644
--- a/binutils/testsuite/config/default.exp
+++ b/binutils/testsuite/config/default.exp
@@ -120,6 +120,21 @@  proc link_or_copy { src dst } {
     catch "exec cp -fpu ../$src tmpdir/gas/$dst" status
 }
 
+if { [istarget hppa*64-*-hpux*] } {
+    verbose -log "creating dummy milli.a archive"
+    remote_exec host "mkdir -p tmpdir/hppa"
+    set src tmpdir/hppa/empty.s
+    set f [open $src "w"]
+    close $f
+    if [is_remote host] {
+	set src [remote_download host $src]
+    }
+    remote_exec host "$AS -o tmpdir/hppa/empty.o $src"
+    remote_exec host "$AR rc tmpdir/hppa/milli.a tmpdir/hppa/empty.o"
+    append LDFLAGS " -Ltmpdir/hppa"
+    unset f src
+}
+
 if {[file isfile gas/as-new[exe_ext]]} then {
     link_or_copy gas/as-new[exe_ext] as[exe_ext]
 } else {
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index 2796f719f22..3c16e7b7158 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -552,6 +552,22 @@  if { [istarget alpha*-*-*vms*] } {
     unset f src
 }
 
+# Provide dummy milli.a that hppa64-hpux-ld always loads
+if { [istarget hppa*64-*-hpux*] } {
+    verbose -log "creating dummy milli.a archive"
+    remote_exec host "mkdir -p tmpdir/hppa"
+    set src tmpdir/hppa/empty.s
+    set f [open $src "w"]
+    close $f
+    if [is_remote host] {
+	set src [remote_download host $src]
+    }
+    ld_assemble $as $src tmpdir/hppa/empty.o
+    ar_simple_create $ar {} tmpdir/hppa/milli.a tmpdir/hppa/empty.o
+    append LDFLAGS " -Ltmpdir/hppa"
+    unset f src
+}
+
 set plug_opt ""
 if { [check_compiler_available] } {
     set plugin_names {