ld: Clear map_head_is_link_order for .gnu_object_only

Clear map_head_is_link_order when generating .gnu_object_only section so
that lang_add_section can add new sections and .sframe sections will be
properly merged by _bfd_elf_merge_section_sframe.

	PR ld/33146
	* ldlang.c (cmdline_emit_object_only_section): Clear
	map_head_is_link_order.
	* testsuite/ld-plugin/lto.exp (as_gsframe): New.
	(lto_link_tests): Add $as_gsframe to compile lto-4b.o and
	lto-4c.o.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
H.J. Lu
2025-07-14 05:21:32 +08:00
parent a57a3a169e
commit 939eb467b2
2 changed files with 10 additions and 2 deletions

View File

@@ -10887,6 +10887,9 @@ cmdline_emit_object_only_section (void)
lang_init (true);
ldexp_init (true);
/* Allow lang_add_section to add new sections. */
map_head_is_link_order = false;
/* Set up the object-only output. */
lang_final ();