binutils-gdb/ld/testsuite/ld-i386/pr27491-3.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

22 lines
455 B
D

#as: --32
#ld: --gc-sections -melf_i386 -z start-stop-gc -shared
#objdump: --syms -dw
.*: +file format elf32-i386
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]+: 8d 83 ([0-9a-f]{2} ){4}[ \t]+lea +-0x[a-f0-9]+\(%ebx\),%eax
+[a-f0-9]+: 8d 83 ([0-9a-f]{2} ){4}[ \t]+lea +-0x[a-f0-9]+\(%ebx\),%eax
#pass