aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2023-05-11 14:31:09 +0000
committerJoseph Myers <joseph@codesourcery.com>2023-05-11 14:31:09 +0000
commitb21318bd2c29fcca8f99c1de7facdaa5cb2e66e2 (patch)
treee1c2baacc959a91de68e4625ec356c85ea929c5a /ld/testsuite
parent38b95a529385e32adc39428231c6fc8b0e8d6f21 (diff)
downloadbinutils-b21318bd2c29fcca8f99c1de7facdaa5cb2e66e2.zip
binutils-b21318bd2c29fcca8f99c1de7facdaa5cb2e66e2.tar.gz
binutils-b21318bd2c29fcca8f99c1de7facdaa5cb2e66e2.tar.bz2
Add LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook [GCC PR109128]
This is one part of the fix for GCC PR109128, along with a corresponding GCC change. Without this patch, what happens in the linker, when an unused object in a .a file has offload data, is that elf_link_is_defined_archive_symbol calls bfd_link_plugin_object_p, which ends up calling the plugin's claim_file_handler, which then records the object as one with offload data. That is, the linker never decides to use the object in the first place, but use of this _p interface (called as part of trying to decide whether to use the object) results in the plugin deciding to use its offload data (and a consequent mismatch in the offload data present at runtime). The new hook allows the linker plugin to distinguish calls to claim_file_handler that know the object is being used by the linker (from ldmain.c:add_archive_element), from calls that don't know it's being used by the linker (from elf_link_is_defined_archive_symbol); in the latter case, the plugin should avoid recording the object as one with offload data. bfd/ * plugin.c (struct plugin_list_entry): Add claim_file_v2. (register_claim_file_v2): New. (try_load_plugin): Use LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (ld_plugin_object_p): Take second argument. (bfd_link_plugin_object_p): Update call to ld_plugin_object_p. (register_ld_plugin_object_p): Update argument prototype. (bfd_plugin_object_p): Update call to ld_plugin_object_p. * plugin.h (register_ld_plugin_object_p): Update argument prototype. include/ * plugin.api.h (ld_plugin_claim_file_handler_v2) (ld_plugin_register_claim_file_v2) (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (struct ld_plugin_tv): Add tv_register_claim_file_v2. ld/ * plugin.c (struct plugin): Add claim_file_handler_v2. (LDPT_REGISTER_CLAIM_FILE_HOOK_V2): New. (plugin_object_p): Add second argument. Update call to plugin_call_claim_file. (register_claim_file_v2): New. (set_tv_header): Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. (plugin_call_claim_file): Add argument known_used. (plugin_maybe_claim): Update call to plugin_object_p. * testplug.c, testplug2.c, testplug3.c, testplug4.c: Handle LDPT_REGISTER_CLAIM_FILE_HOOK_V2. * testsuite/ld-plugin/plugin-1.d, testsuite/ld-plugin/plugin-10.d, testsuite/ld-plugin/plugin-11.d, testsuite/ld-plugin/plugin-13.d, testsuite/ld-plugin/plugin-14.d, testsuite/ld-plugin/plugin-15.d, testsuite/ld-plugin/plugin-16.d, testsuite/ld-plugin/plugin-17.d, testsuite/ld-plugin/plugin-18.d, testsuite/ld-plugin/plugin-19.d, testsuite/ld-plugin/plugin-2.d, testsuite/ld-plugin/plugin-26.d, testsuite/ld-plugin/plugin-3.d, testsuite/ld-plugin/plugin-30.d, testsuite/ld-plugin/plugin-4.d, testsuite/ld-plugin/plugin-5.d, testsuite/ld-plugin/plugin-6.d, testsuite/ld-plugin/plugin-7.d, testsuite/ld-plugin/plugin-8.d, testsuite/ld-plugin/plugin-9.d: Update test expectations.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-plugin/plugin-1.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-10.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-11.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-13.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-14.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-15.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-16.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-17.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-18.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-19.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-2.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-26.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-3.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-30.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-4.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-5.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-6.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-7.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-8.d1
-rw-r--r--ld/testsuite/ld-plugin/plugin-9.d1
20 files changed, 20 insertions, 0 deletions
diff --git a/ld/testsuite/ld-plugin/plugin-1.d b/ld/testsuite/ld-plugin/plugin-1.d
index 6aae4cd..381974f 100644
--- a/ld/testsuite/ld-plugin/plugin-1.d
+++ b/ld/testsuite/ld-plugin/plugin-1.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-10.d b/ld/testsuite/ld-plugin/plugin-10.d
index f92ee65..f6bb0eb 100644
--- a/ld/testsuite/ld-plugin/plugin-10.d
+++ b/ld/testsuite/ld-plugin/plugin-10.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-11.d b/ld/testsuite/ld-plugin/plugin-11.d
index 6a5abcf..63b8160 100644
--- a/ld/testsuite/ld-plugin/plugin-11.d
+++ b/ld/testsuite/ld-plugin/plugin-11.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-13.d b/ld/testsuite/ld-plugin/plugin-13.d
index 55dea65..4521b34 100644
--- a/ld/testsuite/ld-plugin/plugin-13.d
+++ b/ld/testsuite/ld-plugin/plugin-13.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-14.d b/ld/testsuite/ld-plugin/plugin-14.d
index 81365af..bd8ef65 100644
--- a/ld/testsuite/ld-plugin/plugin-14.d
+++ b/ld/testsuite/ld-plugin/plugin-14.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-15.d b/ld/testsuite/ld-plugin/plugin-15.d
index 02c5e60..1647500 100644
--- a/ld/testsuite/ld-plugin/plugin-15.d
+++ b/ld/testsuite/ld-plugin/plugin-15.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-16.d b/ld/testsuite/ld-plugin/plugin-16.d
index 504fbdb..f1ee03a 100644
--- a/ld/testsuite/ld-plugin/plugin-16.d
+++ b/ld/testsuite/ld-plugin/plugin-16.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-17.d b/ld/testsuite/ld-plugin/plugin-17.d
index 159d4e4..5a520b6 100644
--- a/ld/testsuite/ld-plugin/plugin-17.d
+++ b/ld/testsuite/ld-plugin/plugin-17.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-18.d b/ld/testsuite/ld-plugin/plugin-18.d
index 284fd05..63d8147 100644
--- a/ld/testsuite/ld-plugin/plugin-18.d
+++ b/ld/testsuite/ld-plugin/plugin-18.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-19.d b/ld/testsuite/ld-plugin/plugin-19.d
index 621ee76..aa30763 100644
--- a/ld/testsuite/ld-plugin/plugin-19.d
+++ b/ld/testsuite/ld-plugin/plugin-19.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-2.d b/ld/testsuite/ld-plugin/plugin-2.d
index 91822c1..f272f53 100644
--- a/ld/testsuite/ld-plugin/plugin-2.d
+++ b/ld/testsuite/ld-plugin/plugin-2.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-26.d b/ld/testsuite/ld-plugin/plugin-26.d
index c631e38..fef25d5 100644
--- a/ld/testsuite/ld-plugin/plugin-26.d
+++ b/ld/testsuite/ld-plugin/plugin-26.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-3.d b/ld/testsuite/ld-plugin/plugin-3.d
index f030da4..0c23218 100644
--- a/ld/testsuite/ld-plugin/plugin-3.d
+++ b/ld/testsuite/ld-plugin/plugin-3.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-30.d b/ld/testsuite/ld-plugin/plugin-30.d
index eb9d424..690ae83 100644
--- a/ld/testsuite/ld-plugin/plugin-30.d
+++ b/ld/testsuite/ld-plugin/plugin-30.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-4.d b/ld/testsuite/ld-plugin/plugin-4.d
index b240eb2..ac4769b 100644
--- a/ld/testsuite/ld-plugin/plugin-4.d
+++ b/ld/testsuite/ld-plugin/plugin-4.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-5.d b/ld/testsuite/ld-plugin/plugin-5.d
index 52abaf2..5c8e8b8 100644
--- a/ld/testsuite/ld-plugin/plugin-5.d
+++ b/ld/testsuite/ld-plugin/plugin-5.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-6.d b/ld/testsuite/ld-plugin/plugin-6.d
index b1854ac..41f44fb 100644
--- a/ld/testsuite/ld-plugin/plugin-6.d
+++ b/ld/testsuite/ld-plugin/plugin-6.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-7.d b/ld/testsuite/ld-plugin/plugin-7.d
index c77b66f..b202edc 100644
--- a/ld/testsuite/ld-plugin/plugin-7.d
+++ b/ld/testsuite/ld-plugin/plugin-7.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-8.d b/ld/testsuite/ld-plugin/plugin-8.d
index ca24227..0a38ddb 100644
--- a/ld/testsuite/ld-plugin/plugin-8.d
+++ b/ld/testsuite/ld-plugin/plugin-8.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*
diff --git a/ld/testsuite/ld-plugin/plugin-9.d b/ld/testsuite/ld-plugin/plugin-9.d
index 1155f4f..35fde40 100644
--- a/ld/testsuite/ld-plugin/plugin-9.d
+++ b/ld/testsuite/ld-plugin/plugin-9.d
@@ -5,6 +5,7 @@ Hello from testplugin.
.*: LDPT_LINKER_OUTPUT value 0x1 \(1\)
.*: LDPT_OUTPUT_NAME 'tmpdir/main.x'
.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.*
+.*: LDPT_REGISTER_CLAIM_FILE_HOOK_V2 func@0x.*
.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.*
.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.*
.*: LDPT_ADD_SYMBOLS func@0x.*