Files
binutils-gdb/binutils/doc
H.J. Lu 717a38e9a0 strip: Add GCC LTO IR support
Add GCC LTO IR support to strip by copying GCC LTO IR input as unknown
object file.  Don't enable LTO plugin in strip unless all LTO sections
should be removed, assuming all LTO sections will be removed with
-R .gnu.lto_.*.  Add linker LTO tests for strip with --strip-unneeded
and GCC LTO IR inputs.

binutils/

	PR binutils/21479
	* objcopy.c: Include "plugin-api.h" and "plugin.h".
	(lto_sections_removed): New.
	(command_line_switch): Add OPTION_PLUGIN.
	(strip_options): Likewise.
	(strip_usage): Display "--plugin NAME".
	(copy_unknown_file): New function.
	(copy_unknown_object): Call copy_unknown_file.
	(copy_archive): Copy input LTO IR member as unknown object.
	(copy_file): Set input target to "plugin" for strip if it is
	unset unless all LTO sections should be removed.  Copy input
	LTO IR file as unknown file.
	(strip_main): Call bfd_plugin_set_program_name. Handle
	OPTION_PLUGIN.  Set lto_sections_removed to true if all GCC
	LTO sections should be removed.
	* doc/binutils.texi: Document --plugin for strip.

ld/

	PR binutils/21479
	* testsuite/ld-plugin/lto-binutils.exp: New file.
	* testsuite/ld-plugin/strip-1a-fat.c: Likewise.
	* testsuite/ld-plugin/strip-1a-fat.rd: Likewise.
	* testsuite/ld-plugin/strip-1b-fat.c: Likewise.
	* testsuite/ld-plugin/strip-1b-fat.rd: Likewise.
	* testsuite/ld-plugin/strip-1a.c: Likewise.
	* testsuite/ld-plugin/strip-1b.c: Likewise.
	* testsuite/lib/ld-lib.exp (run_cc_link_tests): Add optional
	trailing ld options.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-05-14 15:09:40 +08:00
..
2025-05-14 15:09:40 +08:00