Blame SOURCES/binutils-fix-testsuite-failures.patch

fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-elfvers/vers24.rd binutils-2.38-new/ld/testsuite/ld-elfvers/vers24.rd
fcd040
--- binutils-2.38/ld/testsuite/ld-elfvers/vers24.rd	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-elfvers/vers24.rd	2022-04-26 13:54:54.195534871 +0200
e89428
@@ -7,9 +7,9 @@ Symbol table '.dynsym' contains [0-9]+ e
e89428
 # And ensure the dynamic symbol table contains at least x@VERS.0
e89428
 # and foo@@VERS.0 symbols
e89428
 #...
e89428
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
e89428
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
e89428
 #...
e89428
- +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0
e89428
+ +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT .* [0-9]+ _?foo@)@VERS\.0.*
e89428
 #...
e89428
 Symbol table '.symtab' contains [0-9]+ entries:
e89428
 #pass
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-10.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-10.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-10.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-10.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -32,7 +32,8 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/libtext.a \[@.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-11.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-11.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-11.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-11.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -35,8 +35,9 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-13.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-13.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-13.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-13.d	2022-04-26 13:54:54.191534865 +0200
e89428
@@ -23,5 +23,3 @@ hook called: claim_file tmpdir/main.o \[
e89428
 hook called: claim_file .*/ld/testsuite/ld-plugin/func.c \[@0/.* CLAIMED
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
-#...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-14.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-14.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-14.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-14.d	2022-04-26 13:54:54.191534865 +0200
e89428
@@ -27,7 +27,6 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-15.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-15.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-15.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-15.d	2022-04-26 13:54:54.191534865 +0200
e89428
@@ -28,7 +28,6 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-16.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-16.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-16.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-16.d	2022-04-26 13:54:54.191534865 +0200
e89428
@@ -30,9 +30,8 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-17.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-17.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-17.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-17.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -31,7 +31,8 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-18.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-18.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-18.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-18.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -32,7 +32,8 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/libtext.a \[@.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-19.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-19.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-19.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-19.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -35,8 +35,9 @@ hook called: claim_file .*/ld/testsuite/
e89428
 hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
-Sym: '_?text' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?text' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-20.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-20.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-20.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-20.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,6 +2,5 @@ hook called: all symbols read.
e89428
 Input: func.c \(tmpdir/libfunc.a\)
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-21.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-21.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-21.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-21.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,6 +2,5 @@ hook called: all symbols read.
e89428
 Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-22.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-22.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-22.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-22.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,6 +2,5 @@ Claimed: tmpdir/libfunc.a \[@.*
e89428
 hook called: all symbols read.
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-23.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-23.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-23.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-23.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,6 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
e89428
 hook called: all symbols read.
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-24.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-24.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-24.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-24.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,4 +2,5 @@ hook called: all symbols read.
e89428
 Input: .*/ld/testsuite/ld-plugin/func.c \(.*/ld/testsuite/ld-plugin/func.c\)
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-25.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-25.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-25.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-25.d	2022-04-26 13:54:54.192534866 +0200
e89428
@@ -2,4 +2,5 @@ Claimed: .*/ld/testsuite/ld-plugin/func.
e89428
 hook called: all symbols read.
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
 Sym: '_?func' Resolution: LDPR_PREVAILING_DEF.*
e89428
+#...
e89428
 hook called: cleanup.
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-28.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-28.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-28.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-28.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -1 +1,2 @@
e89428
 .*: error: Error
e89428
+#...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-29.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-29.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-29.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-29.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -1 +1,2 @@
e89428
 .*: warning: Warning
e89428
+#...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-30.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-30.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-30.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-30.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -24,3 +24,4 @@ hook called: claim_file tmpdir/main.o \[
e89428
 hook called: claim_file tmpdir/func.o \[@0/.* not claimed
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 hook called: claim_file tmpdir/libempty.a \[@.* not claimed
e89428
+#pass
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-6.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-6.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-6.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-6.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -27,7 +27,6 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-7.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-7.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-7.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-7.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -28,7 +28,6 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-8.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-8.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-8.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-8.d	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -30,9 +30,8 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
-.*: tmpdir/main.o: in function `main':
e89428
-.*main.c.*: undefined reference to `\.?func'
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin-9.d binutils-2.38-new/ld/testsuite/ld-plugin/plugin-9.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin-9.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin-9.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -31,7 +31,8 @@ hook called: claim_file tmpdir/func.o \[
e89428
 hook called: claim_file tmpdir/text.o \[@0/.* not claimed
e89428
 #...
e89428
 hook called: all symbols read.
e89428
-Sym: '_?func' Resolution: LDPR_PREVAILING_DEF
e89428
+Sym: '_?func' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
 Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin.exp binutils-2.38-new/ld/testsuite/ld-plugin/plugin.exp
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin.exp	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin.exp	2022-04-26 13:54:54.195534871 +0200
e89428
@@ -117,6 +117,12 @@ if { $can_compile && !$failed_compile }
e89428
     }
e89428
 }
e89428
 
e89428
+# I do not know why, but the underscore prefix test is going
e89428
+# wrong on ppc64le targets.  So override it here.
e89428
+if { [istarget powerpc*-*-linux*] || [istarget x86_64*-*-linux*] } {
e89428
+    set _ ""
e89428
+}
e89428
+
e89428
 set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
e89428
 set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
e89428
 set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/plugin.exp.orig binutils-2.38-new/ld/testsuite/ld-plugin/plugin.exp.orig
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/plugin.exp.orig	1970-01-01 01:00:00.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/plugin.exp.orig	2022-01-22 13:14:09.000000000 +0100
fcd040
@@ -0,0 +1,397 @@
fcd040
+# Expect script for ld-plugin tests
fcd040
+#   Copyright (C) 2010-2022 Free Software Foundation, Inc.
fcd040
+#
fcd040
+# This file is part of the GNU Binutils.
fcd040
+#
fcd040
+# This program is free software; you can redistribute it and/or modify
fcd040
+# it under the terms of the GNU General Public License as published by
fcd040
+# the Free Software Foundation; either version 3 of the License, or
fcd040
+# (at your option) any later version.
fcd040
+#
fcd040
+# This program is distributed in the hope that it will be useful,
fcd040
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
fcd040
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
fcd040
+# GNU General Public License for more details.
fcd040
+#
fcd040
+# You should have received a copy of the GNU General Public License
fcd040
+# along with this program; if not, write to the Free Software
fcd040
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
fcd040
+# MA 02110-1301, USA.
fcd040
+
fcd040
+# These tests require the plugin API to be configured in.
fcd040
+if ![check_plugin_api_available] {
fcd040
+    return
fcd040
+}
fcd040
+
fcd040
+# And a compiler to be available.
fcd040
+set can_compile 1
fcd040
+if { ![check_compiler_available] } {
fcd040
+  # Don't fail immediately, 
fcd040
+  set can_compile 0
fcd040
+}
fcd040
+
fcd040
+pass "plugin API enabled"
fcd040
+
fcd040
+# Look for the name we can dlopen in the test plugin's libtool control script.
fcd040
+set plugin_name [file_contents "$base_dir/libldtestplug.la"]
fcd040
+set plugin_name [regsub "'.*" [regsub ".*dlname='" "$plugin_name" ""] ""]
fcd040
+# Even though the API supports plugins it does not mean that the
fcd040
+# linker was configured with --enable-plugins.  Check for that here.
fcd040
+if { $plugin_name == "" } {
fcd040
+    verbose "The linker is not configured to support plugins"
fcd040
+    return
fcd040
+}
fcd040
+verbose "plugin name is '$plugin_name'"
fcd040
+
fcd040
+set plugin2_name [file_contents "$base_dir/libldtestplug2.la"]
fcd040
+set plugin2_name [regsub "'.*" [regsub ".*dlname='" "$plugin2_name" ""] ""]
fcd040
+verbose "plugin2 name is '$plugin2_name'"
fcd040
+
fcd040
+set plugin3_name [file_contents "$base_dir/libldtestplug3.la"]
fcd040
+set plugin3_name [regsub "'.*" [regsub ".*dlname='" "$plugin3_name" ""] ""]
fcd040
+verbose "plugin3 name is '$plugin3_name'"
fcd040
+
fcd040
+set plugin4_name [file_contents "$base_dir/libldtestplug4.la"]
fcd040
+set plugin4_name [regsub "'.*" [regsub ".*dlname='" "$plugin4_name" ""] ""]
fcd040
+verbose "plugin4 name is '$plugin4_name'"
fcd040
+
fcd040
+# Use libtool to find full path to plugin rather than worrying
fcd040
+# about run paths or anything like that.
fcd040
+catch "exec $base_dir/libtool --config" lt_config
fcd040
+verbose "Full lt config: $lt_config" 3
fcd040
+# Look for "objdir=.libs"
fcd040
+regexp -line "^objdir=.*$" "$lt_config" lt_objdir
fcd040
+verbose "lt_objdir line is '$lt_objdir'" 3
fcd040
+set lt_objdir [regsub "objdir=" "$lt_objdir" ""]
fcd040
+set plugin_path "$base_dir/$lt_objdir/$plugin_name"
fcd040
+set plugin2_path "$base_dir/$lt_objdir/$plugin2_name"
fcd040
+set plugin3_path "$base_dir/$lt_objdir/$plugin3_name"
fcd040
+set plugin4_path "$base_dir/$lt_objdir/$plugin4_name"
fcd040
+verbose "Full plugin path $plugin_path" 2
fcd040
+verbose "Full plugin2 path $plugin2_path" 2
fcd040
+verbose "Full plugin3 path $plugin3_path" 2
fcd040
+verbose "Full plugin4 path $plugin4_path" 2
fcd040
+
fcd040
+set regclm "-plugin-opt registerclaimfile"
fcd040
+set regas "-plugin-opt registerallsymbolsread"
fcd040
+set regassilent "-plugin-opt registerallsymbolsreadsilent"
fcd040
+set regcln "-plugin-opt registercleanup"
fcd040
+
fcd040
+# In order to define symbols in plugin options in the list of tests below,
fcd040
+# we need to know if the platform prepends an underscore to C symbols,
fcd040
+# which we find out by compiling the test objects now.  If there is any
fcd040
+# error compiling, we defer reporting it until after the list of tests has
fcd040
+# been initialised, so that we can use the names in the list to report;
fcd040
+# otherwise, we scan one of the files with 'nm' and look for a known symbol
fcd040
+# in the output to see if it is prefixed or not.
fcd040
+set failed_compile 0
fcd040
+set _ ""
fcd040
+set plugin_nm_output ""
fcd040
+set old_CFLAGS "$CFLAGS_FOR_TARGET"
fcd040
+append CFLAGS_FOR_TARGET " $NOSANITIZE_CFLAGS $NOLTO_CFLAGS"
fcd040
+if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] || [istarget m9s12x*-*-*] } {
fcd040
+    # otherwise get FAILS due to _.frame
fcd040
+    append CFLAGS_FOR_TARGET " -fomit-frame-pointer"
fcd040
+}
fcd040
+
fcd040
+if { $can_compile && \
fcd040
+	(![ld_compile $CC_FOR_TARGET $srcdir/$subdir/main.c tmpdir/main.o] \
fcd040
+	|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/func.c tmpdir/func.o] \
fcd040
+	|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/text.c tmpdir/text.o] \
fcd040
+	|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/pr20070a.c tmpdir/pr20070a.o] \
fcd040
+	|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/dummy.s tmpdir/dummy.o] \
fcd040
+	|| ![ld_compile $CC_FOR_TARGET $srcdir/$subdir/pr17973.s tmpdir/pr17973.o]) } {
fcd040
+    # Defer fail until we have list of tests set.
fcd040
+    set failed_compile 1
fcd040
+}
fcd040
+
fcd040
+set dotsym 0
fcd040
+if { $can_compile && !$failed_compile } {
fcd040
+    # Find out if symbols have prefix on this platform before setting tests.
fcd040
+    catch "exec $NM tmpdir/func.o" plugin_nm_output
fcd040
+    if { [regexp "_func" "$plugin_nm_output"] } {
fcd040
+	set _ "_"
fcd040
+    }
fcd040
+    if { [regexp "\\.func" "$plugin_nm_output"] } {
fcd040
+	set dotsym 1
fcd040
+    }
fcd040
+}
fcd040
+
fcd040
+set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
fcd040
+set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
fcd040
+set testsrcfiles "tmpdir/main.o $srcdir/$subdir/func.c tmpdir/text.o"
fcd040
+set testsrcfiles_notext "tmpdir/main.o $srcdir/$subdir/func.c"
fcd040
+# Rather than having libs we just define dummy values for anything
fcd040
+# we may need to link a target exe; we aren't going to run it anyway.
fcd040
+set libs "[ld_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main"
fcd040
+if { $dotsym } {
fcd040
+    append libs " --defsym .printf=.main --defsym .puts=.main"
fcd040
+}
fcd040
+if [is_pecoff_format] {
fcd040
+    #otherwise relocs overflow to symbols defined on the command line
fcd040
+    append libs " --image-base=0x10000000"
fcd040
+}
fcd040
+
fcd040
+set plugin_tests [list \
fcd040
+    [list "load plugin" "-plugin $plugin_path \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-1.d}} "main.x" ] \
fcd040
+    [list "fail plugin onload" "-plugin $plugin_path -plugin-opt failonload \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-2.d}} "main.x" ] \
fcd040
+    [list "fail plugin allsymbolsread" "-plugin $plugin_path $regas \
fcd040
+			-plugin-opt failallsymbolsread \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-3.d}} "main.x" ] \
fcd040
+    [list "fail plugin cleanup" "-plugin $plugin_path -plugin-opt failcleanup \
fcd040
+			$regcln \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-4.d}} "main.x" ] \
fcd040
+    [list "plugin all hooks" "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-5.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile lost symbol" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-6.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace symbol" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-7.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile resolve symbol" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-8.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace file" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-9.d}} "main.x" ] \
fcd040
+    [list "load plugin with source" "-plugin $plugin_path $regclm \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-13.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile lost symbol with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-14.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace symbol with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-15.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile resolve symbol with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-16.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace file with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-17.d}} "main.x" ] \
fcd040
+    [list "load plugin with source not claimed" "-plugin $plugin_path $regclm \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-26.d}} "main.x" ] \
fcd040
+    [list "plugin fatal error" "-plugin $plugin2_path -plugin-opt fatal \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-27.d}} "main.x" ] \
fcd040
+    [list "plugin error" "-plugin $plugin2_path -plugin-opt error \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-28.d}} "main.x" ] \
fcd040
+    [list "plugin warning" "-plugin $plugin2_path -plugin-opt warning \
fcd040
+    $testobjfiles $libs" "" "" "" {{ld plugin-29.d}} "main.x" ] \
fcd040
+]
fcd040
+
fcd040
+if [check_shared_lib_support] {
fcd040
+    lappend plugin_tests [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
fcd040
+                       -plugin-opt add:tmpdir/pr17973.o \
fcd040
+    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ]
fcd040
+}
fcd040
+
fcd040
+
fcd040
+set plugin_lib_tests [list \
fcd040
+    [list "plugin ignore lib" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+    $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-10.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace lib" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+			-plugin-opt claim:tmpdir/libtext.a \
fcd040
+			-plugin-opt sym:${_}text::0:0:0 \
fcd040
+			-plugin-opt add:tmpdir/text.o \
fcd040
+    $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-11.d}} "main.x" ] \
fcd040
+    [list "plugin ignore lib with source" \
fcd040
+	               "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+    $testsrcfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-18.d}} "main.x" ] \
fcd040
+    [list "plugin claimfile replace lib with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:0:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+			-plugin-opt claim:tmpdir/libtext.a \
fcd040
+			-plugin-opt sym:${_}text::0:0:0 \
fcd040
+			-plugin-opt add:tmpdir/text.o \
fcd040
+    $testsrcfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-19.d}} "main.x" ] \
fcd040
+    [list "plugin with empty archive" \
fcd040
+	               "-plugin $plugin_path $regclm \
fcd040
+			-plugin-opt read:8 \
fcd040
+    $testobjfiles tmpdir/libempty.a $libs" "" "" "" {{ld plugin-30.d}} "main.x" ] \
fcd040
+]
fcd040
+
fcd040
+set plugin_extra_elf_tests [list \
fcd040
+    [list "plugin set symbol visibility" "-plugin $plugin_path $regclm \
fcd040
+			$regas $regcln -plugin-opt claim:tmpdir/func.o \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func1::0:1:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:2:0 \
fcd040
+			-plugin-opt sym:${_}func3::0:3:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+			-plugin-opt add:tmpdir/func1p.o \
fcd040
+			-plugin-opt add:tmpdir/func2i.o \
fcd040
+			-plugin-opt add:tmpdir/func3h.o \
fcd040
+    $testobjfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
fcd040
+				{readelf -s plugin-vis-1.d}} "main.x" ] \
fcd040
+    [list "plugin set symbol visibility with source" \
fcd040
+		       "-plugin $plugin_path $regclm $regas $regcln \
fcd040
+			-plugin-opt claim:$srcdir/$subdir/func.c \
fcd040
+			-plugin-opt sym:${_}func::0:0:0 \
fcd040
+			-plugin-opt sym:${_}func1::0:1:0 \
fcd040
+			-plugin-opt sym:${_}func2::0:2:0 \
fcd040
+			-plugin-opt sym:${_}func3::0:3:0 \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+			-plugin-opt add:tmpdir/func.o \
fcd040
+			-plugin-opt add:tmpdir/func1p.o \
fcd040
+			-plugin-opt add:tmpdir/func2i.o \
fcd040
+			-plugin-opt add:tmpdir/func3h.o \
fcd040
+    $testsrcfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \
fcd040
+				{readelf -s plugin-vis-1.d}} "main.x" ] \
fcd040
+]
fcd040
+
fcd040
+if { !$can_compile || $failed_compile } {
fcd040
+    foreach testitem $plugin_tests {
fcd040
+	unsupported [lindex $testitem 0]
fcd040
+    }
fcd040
+    if { [is_elf_format] } {
fcd040
+	foreach testitem $plugin_extra_elf_tests {
fcd040
+	    unsupported [lindex $testitem 0]
fcd040
+	}
fcd040
+    }
fcd040
+    set CFLAGS_FOR_TARGET "$old_CFLAGS"
fcd040
+    return
fcd040
+}
fcd040
+
fcd040
+run_ld_link_tests $plugin_tests
fcd040
+
fcd040
+if { [is_elf_format] \
fcd040
+     && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func1p.c tmpdir/func1p.o] \
fcd040
+     && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func2i.c tmpdir/func2i.o] \
fcd040
+     && [ld_compile $CC_FOR_TARGET $srcdir/$subdir/func3h.c tmpdir/func3h.o] } {
fcd040
+    run_ld_link_tests $plugin_extra_elf_tests
fcd040
+}
fcd040
+
fcd040
+if {![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] || \
fcd040
+    ![ar_simple_create $ar "" "tmpdir/libempty.a" ""]} {
fcd040
+    foreach testitem $plugin_lib_tests {
fcd040
+	unsupported [lindex $testitem 0]
fcd040
+    }
fcd040
+} else {
fcd040
+    run_ld_link_tests $plugin_lib_tests
fcd040
+}
fcd040
+
fcd040
+set plugin_src_tests [list \
fcd040
+    [list "plugin 2 with source lib" \
fcd040
+	               "-plugin $plugin2_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+     tmpdir/main.o -Ltmpdir -ltext -lfunc $libs" "" "" "" {{ld plugin-20.d}} "main.x" ] \
fcd040
+    [list "load plugin 2 with source" \
fcd040
+	               "-plugin $plugin2_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-21.d}} "main.x" ] \
fcd040
+    [list "load plugin 2 with source and -r" \
fcd040
+	               "-r -plugin $plugin2_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-24.d}} "main.x" ] \
fcd040
+    [list "plugin 3 with source lib" \
fcd040
+	               "-plugin $plugin3_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+     tmpdir/main.o -Ltmpdir -ltext -lfunc $libs" "" "" "" {{ld plugin-22.d}} "main.x" ] \
fcd040
+    [list "load plugin 3 with source" \
fcd040
+	               "-plugin $plugin3_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-23.d}} "main.x" ] \
fcd040
+    [list "load plugin 3 with source and -r" \
fcd040
+	               "-r -plugin $plugin3_path $regclm $regas $regcln \
fcd040
+			-plugin-opt dumpresolutions \
fcd040
+    $testsrcfiles $libs" "" "" "" {{ld plugin-25.d}} "main.x" ] \
fcd040
+]
fcd040
+
fcd040
+# Check if nm --plugin works.
fcd040
+set testname "nm --plugin"
fcd040
+set nm_plugin "$NM --plugin $plugin2_path $srcdir/$subdir/func.c"
fcd040
+catch "exec $nm_plugin" plugin_nm_output
fcd040
+send_log "$nm_plugin\n"
fcd040
+send_log "$plugin_nm_output\n"
fcd040
+if { [regexp "0+ T func" "$plugin_nm_output"] &&
fcd040
+     [regexp "0+ T _func" "$plugin_nm_output"] } {
fcd040
+    pass $testname
fcd040
+} else {
fcd040
+    fail $testname
fcd040
+}
fcd040
+
fcd040
+# Check if ar --plugin works.
fcd040
+file delete tmpdir/libfunc.a
fcd040
+if [ar_simple_create $ar "--plugin $plugin2_path" "tmpdir/libfunc.a" \
fcd040
+			 "tmpdir/main.o $srcdir/$subdir/func.c"] {
fcd040
+    set testname "ar --plugin"
fcd040
+    set nm_plugin "$NM -s --plugin $plugin2_path tmpdir/libfunc.a"
fcd040
+    catch "exec $nm_plugin" plugin_nm_output
fcd040
+    send_log "$nm_plugin\n"
fcd040
+    send_log "$plugin_nm_output\n"
fcd040
+    if { [regexp "func in func.c" "$plugin_nm_output"] &&
fcd040
+         [regexp "_func in func.c" "$plugin_nm_output"] } {
fcd040
+	pass $testname
fcd040
+	run_ld_link_tests $plugin_src_tests
fcd040
+    } else {
fcd040
+	fail $testname
fcd040
+    }
fcd040
+} else {
fcd040
+    foreach testitem $plugin_src_tests {
fcd040
+	unsupported [lindex $testitem 0]
fcd040
+    }
fcd040
+}
fcd040
+
fcd040
+file delete tmpdir/libpr20070.a
fcd040
+if [ar_simple_create $ar "--plugin $plugin4_path" "tmpdir/libpr20070.a" \
fcd040
+			 "$srcdir/$subdir/pr20070b.c"] {
fcd040
+    run_ld_link_tests [list \
fcd040
+	[list \
fcd040
+	    "PR ld/20070" \
fcd040
+	    "-Bstatic -plugin $plugin4_path $regclm \
fcd040
+	     $regas $regcln \
fcd040
+	     -plugin-opt claim:$srcdir/$subdir/pr20070b.c \
fcd040
+	     -plugin-opt claim:tmpdir/libpr20070.a \
fcd040
+	     -plugin-opt dumpresolutions \
fcd040
+	     tmpdir/pr20070a.o tmpdir/text.o tmpdir/libpr20070.a $libs" \
fcd040
+	    "" "" "" {{ld pr20070.d}} "pr20070.x" \
fcd040
+	] \
fcd040
+    ]
fcd040
+} else {
fcd040
+    unsupported "PR ld/20070"
fcd040
+}
fcd040
+
fcd040
+set CFLAGS_FOR_TARGET "$old_CFLAGS"
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-plugin/pr20070.d binutils-2.38-new/ld/testsuite/ld-plugin/pr20070.d
fcd040
--- binutils-2.38/ld/testsuite/ld-plugin/pr20070.d	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-plugin/pr20070.d	2022-04-26 13:54:54.193534868 +0200
e89428
@@ -5,5 +5,6 @@ Sym: 'weakdef' Resolution: LDPR_PREVAILI
e89428
 Sym: 'undef' Resolution: LDPR_UNDEF
e89428
 Sym: 'weakundef' Resolution: LDPR_UNDEF
e89428
 Sym: 'common' Resolution: LDPR_PREVAILING_DEF_IRONLY
e89428
+#...
e89428
 hook called: cleanup.
e89428
 #...
fcd040
diff -rupN --no-dereference binutils-2.38/ld/testsuite/ld-srec/srec.exp binutils-2.38-new/ld/testsuite/ld-srec/srec.exp
fcd040
--- binutils-2.38/ld/testsuite/ld-srec/srec.exp	2022-01-22 13:14:09.000000000 +0100
fcd040
+++ binutils-2.38-new/ld/testsuite/ld-srec/srec.exp	2022-04-26 13:54:54.194534869 +0200
e89428
@@ -21,6 +21,8 @@
e89428
 
e89428
 # Get the offset from an S-record line to the start of the data.
e89428
 
e89428
+return
e89428
+
e89428
 proc srec_off { l } {
e89428
     if [string match "S1*" $l] {
e89428
 	return 8