PR 33801 strip doesn't remove .gnu.lto_.opts

OK, so people want to be able to partly destroy gcc slim LTO object
files.  I don't see why not, despite HJ's policy-setting slim lto
strip -R tests.  I also don't see why it matters that objcopy/strip
won't similarly break LLVM objects (pr33271).

So out goes the slim lto strip -R tests, and the strip-debug test
expecting slim lto files won't be modified in any way.  strip-debug
now removes a FILE symbol, which isn't unreasonable.

	PR 33801
	PR 33271
	PR 33246
binutils/
	* objcopy.c (copy_archive, copy_file): Do not special case
	gcc LTO IR files.
ld/
	* testsuite/ld-plugin/lto-binutils.exp: Remove slim lto strip -R
	tests.
	(run_pr33246_test): Don't compare slim object files after
	strip-debug.
	* testsuite/ld-plugin/strip-1a-s-all.nd: Delete.
This commit is contained in:
Alan Modra
2026-01-17 18:43:06 +10:30
parent 9dbb9f9379
commit 666edc6b61
3 changed files with 2 additions and 31 deletions

View File

@@ -3771,9 +3771,6 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
goto cleanup_and_exit;
}
/* Copy slim LTO IR file as unknown object. */
if (this_element->lto_type == lto_slim_ir_object)
ok_object = false;
if (ok_object)
{
ok = copy_object (this_element, output_element, input_arch);
@@ -4067,9 +4064,6 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
return;
}
/* Copy slim LTO IR file as unknown file. */
if (ibfd->lto_type == lto_slim_ir_object)
ok_object = false;
if (ok_object
? !copy_object (ibfd, obfd, input_arch)
: !copy_unknown_file (ibfd, obfd,

View File

@@ -254,23 +254,6 @@ run_lto_binutils_test [list \
] \
]
run_lto_binutils_test [list \
[list \
"strip" \
"-R .gnu.*lto_* -N __gnu_lto_v1" \
"strip-1a.o" \
"strip-1a-s-all.o" \
{{nm -n strip-1a-s-all.nd}} \
] \
[list \
"strip" \
"-R .gnu.*lto_* -N __gnu_lto_v1" \
"libstrip-1a.a" \
"libstrip-1a-s-all.a" \
{{nm -n strip-1a-s-all.nd}} \
] \
]
run_cc_link_tests [list \
[list \
"Build strip-1a (strip-1a.o)" \
@@ -449,7 +432,7 @@ proc run_pr33246_test { llvm fat } {
fail "$testname (strip $obj)"
return
}
} else {
} elseif { "$llvm" == "-llvm" } {
set cmd "cmp $obj ${obj}.strip"
send_log "$cmd\n"
verbose "$cmd" 1
@@ -508,7 +491,7 @@ proc run_pr33246_test { llvm fat } {
fail "$testname (strip $archive)"
return
}
} else {
} elseif { "$llvm" == "-llvm" } {
set cmd "cmp $archive ${archive}.strip"
send_log "$cmd\n"
verbose "$cmd" 1

View File

@@ -1,6 +0,0 @@
#...
+ U foo2
+ U foo3
0+ T foo1
0+ T main
#pass