binutils-gdb/ld/testsuite/ld-loongarch-elf/pie_discard.t
Jinyang He fb266c9083 Avoid unused space in .rela.dyn if sec was discarded
The relsec size is still increased although sec is discarded, which
cause a lot of unused space allocated. Avoid size increased if sec
was discarded.

bfd/ChangeLog:

	* bfd/elfnn-loongarch.c: (allocate_dynrelocs): Do not increase
	sreloc size when discarded_section.

ld/ChangeLog:

	* ld/testsuite/ld-loongarch-elf/ld-loongarch-elf.exp: Add test.
	* ld/testsuite/ld-loongarch-elf/pie_discard.d: New test.
	* ld/testsuite/ld-loongarch-elf/pie_discard.s: New test.
	* ld/testsuite/ld-loongarch-elf/pie_discard.t: New test.
2024-02-27 11:58:33 +08:00

9 lines
253 B
Raku

SECTIONS
{
. = SEGMENT_START("text-segment", 0) + SIZEOF_HEADERS;
.rela.dyn : { *(.rela.*) }
.text : { *(.text) }
. = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
.data : { *(.data) }
/DISCARD/ : { *(.discard) }
}