[PATCH] hppa64-hpux: Create dummy milli.a archives for binutils and ld testsuites [v2]

John David Anglin dave.anglin@bell.net
Mon Apr 6 19:00:29 GMT 2026


In v2, I reworked the change to default.exp in the binutils testsuite to
avoid usings procs from the ld testsuite.

Tested on hppa64-hp-hpux11.11 and x86_64-pc-linux-gnu.  Fixes all fails
due to missing milli.a archive.

Okay?

Dave
---

hppa64-hpux: Create dummy milli.a archives for binutils and ld testsuites [v2]

The hppa64-*-hpux* target has to always link against the milli.a
archive to resolve various millicode routines.  However, this breaks
the binutils and ld testsuites on hosts without the milli.a archive.

This change adds dummy milli.a archives on the hppa64-*-hpux* target
in the binutils and ld testsuites if ld cannot find the file.  The
method used is similar to that for alpha*-*-*vms*.

Suggested-by: Maciej W. Rozycki <macro@orcam.me.uk>

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

binutils/ChangeLog:

	* testsuite/config/default.exp: Create dummy missing
	libraries for hppa*64-*-hpux* target.  Append
	" -Ltmpdir" to LDFLAGS.

ld/ChangeLog:

	* testsuite/config/default.exp: Create dummy missing
	libraries for hppa*64-*-hpux* target.  Append
	" -Ltmpdir" to LDFLAGS.
	* testsuite/lib/ld-lib.exp (default_ld_link): Append
	LDFLAGS to flags variable.

diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp
index 25bd1e64222..4a8ee3ddce9 100644
--- a/binutils/testsuite/config/default.exp
+++ b/binutils/testsuite/config/default.exp
@@ -120,6 +120,29 @@ proc link_or_copy { src dst } {
     catch "exec cp -fpu ../$src tmpdir/gas/$dst" status
 }
 
+if { [istarget hppa*64-*-hpux*] } {
+    set src tmpdir/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/empty.o $src"
+    set cmd "$LD -o tmpdir/empty tmpdir/empty.o"
+    set exec_output [remote_exec host $cmd]
+    if { [regsub -all {[^\n]*: cannot find ([^\n :]*)[^\n]*} $exec_output {tmpdir/\1 } missing_libs] } {
+	regsub -all {\$} $missing_libs {\\\$} missing_libs
+	for { set i 0 } { $i < [llength $missing_libs] } { incr i } {
+	    set f [lindex $missing_libs $i]
+	    verbose -log "creating dummy $f"
+	    remote_exec host "$AR rc $f tmpdir/empty.o"
+	}
+	append LDFLAGS " -Ltmpdir"
+	unset i missing_libs
+    }
+    unset exec_output 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..cc0576b3975 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -552,6 +552,26 @@ if { [istarget alpha*-*-*vms*] } {
     unset f src
 }
 
+# Provide dummy milli.a that hppa64-hpux-ld always loads
+if { [istarget hppa*64-*-hpux*] } {
+    set src tmpdir/empty.s
+    set f [open $src "w"]
+    close $f
+    if { [ld_assemble $as $src tmpdir/empty.o]
+	 && ![ld_link $LD tmpdir/empty tmpdir/empty.o]
+	 && [regsub -all {[^\n]*: cannot find ([^\n :]*)[^\n]*} $exec_output {tmpdir/\1 } missing_libs] } {
+	regsub -all {\$} $missing_libs {\\\$} missing_libs
+	for { set i 0 } { $i < [llength $missing_libs] } { incr i } {
+	    set f [lindex $missing_libs $i]
+	    verbose -log "creating dummy $f"
+	    ar_simple_create $ar {} $f tmpdir/empty.o
+	}
+	append LDFLAGS " -Ltmpdir"
+	unset i missing_libs
+    }
+    unset f src
+}
+
 set plug_opt ""
 if { [check_compiler_available] } {
     set plugin_names {
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index d37d33cd96c..d1b6f2e058f 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -231,11 +231,13 @@ proc get_board_flags {} {
 proc default_ld_link { ld target objects } {
     global host_triplet
     global exec_output
+    global LDFLAGS
 
     set flags ""
     if [is_endian_output_format $objects] then {
 	set flags [big_or_little_endian]
     }
+    set flags "$flags $LDFLAGS"
 
     # When using GCC as the linker driver, we need to specify board cflags when
     # linking because cflags may contain linker options.  For example when
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260406/2e3a8bb6/attachment.sig>


More information about the Binutils mailing list