b9b2ae8bbf
* script-sections.cc (Sections_element::output_section_name): Add keep return parameter. (Output_section_element::match_name): Add keep return parameter. Return the value of the keep_ member. * script-sections.h (class Output_section): Update output_section_name prototype. * layout.cc (Layout::keep_input_section): New public member function. (Layout::choose_output_section): Pass keep parameter to output_section_name. * layout.h (class Layout): Add keep_input_section. * object.cc (Sized_relobj_file::do_layout): Check for kept input sections. * testsuite/Makefile.am: Add a test. * testsuite/Makefile.in: Regenerate. * testsuite/pr14265.c: Source file for the test. * testsuite/pr14265.t: Linker script for the test. * testsuite/pr14265.sh: Shell script for the test. * ld-gc/gc.exp: Add a new test. * ld-gc/pr14265.c: Source file for the new test. * ld-gc/pr14265.t: Linker script for the new test. * ld-gc/pr14265.d: Expected symbol dump.
23 lines
444 B
Raku
23 lines
444 B
Raku
SECTIONS
|
|
{
|
|
.text : { *(.text) }
|
|
|
|
__foo0_start = .;
|
|
.foo0 : { *(.foo0.*) }
|
|
__foo0_end = .;
|
|
|
|
__foo1_start = .;
|
|
.foo1 : { KEEP(*(.foo1.*)) }
|
|
__foo1_end = .;
|
|
|
|
.foo2 : {
|
|
__foo2_start = .;
|
|
KEEP(*(.foo2.*))
|
|
__foo2_end = .;
|
|
}
|
|
/DISCARD/ : { *(*) }
|
|
}
|
|
|
|
ASSERT (__foo1_start < __foo1_end, "foo1 not KEPT");
|
|
ASSERT ((__foo1_end - __foo1_start) == (__foo2_end - __foo2_start),"foo2 not KEPT");
|