binutils-gdb/ld/testsuite/ld-x86-64/pr27491-4.d
H.J. Lu 794f2bba0f x86: Skip __[start|stop]_SECNAME for --gc-sections -z start-stop-gc
Don't convert memory load to immediate load on __start_SECNAME and
__stop_SECNAME for --gc-sections -z start-stop-gc if all SECNAME
sections been garbage collected.

bfd/

	PR ld/27491
	* elf32-i386.c (elf_i386_convert_load_reloc): Skip __start_SECNAME
	and __stop_SECNAME for --gc-sections -z start-stop-gc if the input
	section been garbage collected.
	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
	* elfxx-x86.h (elf_x86_start_stop_gc_p): New function.

ld/
	PR ld/27491
	* testsuite/ld-i386/i386.exp: Run PR ld/27491 tests.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr27491-1.s: New file.
	* testsuite/ld-i386/pr27491-1a.d: Likewise.
	* testsuite/ld-i386/pr27491-1b.d: Likewise.
	* testsuite/ld-i386/pr27491-1c.d: Likewise.
	* testsuite/ld-i386/pr27491-2.d: Likewise.
	* testsuite/ld-i386/pr27491-2.s: Likewise.
	* testsuite/ld-i386/pr27491-3.d: Likewise.
	* testsuite/ld-i386/pr27491-3.s: Likewise.
	* testsuite/ld-i386/pr27491-4.d: Likewise.
	* testsuite/ld-i386/pr27491-4a.s: Likewise.
	* testsuite/ld-i386/pr27491-4b.s: Likewise.
	* testsuite/ld-x86-64/pr27491-1.s: Likewise.
	* testsuite/ld-x86-64/pr27491-1a.d: Likewise.
	* testsuite/ld-x86-64/pr27491-1b.d: Likewise.
	* testsuite/ld-x86-64/pr27491-1c.d: Likewise.
	* testsuite/ld-x86-64/pr27491-2.d: Likewise.
	* testsuite/ld-x86-64/pr27491-2.s: Likewise.
	* testsuite/ld-x86-64/pr27491-3.d: Likewise.
	* testsuite/ld-x86-64/pr27491-3.s: Likewise.
	* testsuite/ld-x86-64/pr27491-4.d: Likewise.
	* testsuite/ld-x86-64/pr27491-4a.s: Likewise.
	* testsuite/ld-x86-64/pr27491-4b.s: Likewise.
2021-12-02 03:55:10 -08:00

24 lines
566 B
D

#source: pr27491-4a.s
#source: pr27491-4b.s
#as: --64
#ld: --gc-sections -melf_x86_64 -z start-stop-gc -shared
#objdump: --syms -dw
.*: +file format elf64-x86-64
SYMBOL TABLE:
#...
[a-f0-9]+ g xx [a-f0-9]+ \.protected __stop_xx
#...
[a-f0-9]+ g xx [a-f0-9]+ \.protected __start_xx
#...
Disassembly of section .text:
[a-f0-9]+ <foo>:
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4}[ \t]+lea +0x[a-f0-9]+\(%rip\),%rax[ \t]+# [a-f0-9]+ <__start_xx>
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4}[ \t]+lea +0x[a-f0-9]+\(%rip\),%rax[ \t]+# [a-f0-9]+ <__stop_xx>
#pass