forked from Imagelibrary/binutils-gdb
LoongArch: Do not relax against __[start|stop]_SECNAME symbol
This commit is contained in:
@@ -5637,10 +5637,13 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Do not relax __[start|stop]_SECNAME, since the symbol value
|
||||
is not set yet. */
|
||||
if (h != NULL
|
||||
&& ((h->type == STT_GNU_IFUNC
|
||||
&& r_type != R_LARCH_CALL36)
|
||||
|| bfd_is_abs_section (h->root.u.def.section)))
|
||||
|| bfd_is_abs_section (h->root.u.def.section)
|
||||
|| h->start_stop))
|
||||
continue;
|
||||
|
||||
/* The GOT entry of tls symbols must in current execute file or
|
||||
|
||||
@@ -412,6 +412,8 @@ if [istarget loongarch64-*-*] {
|
||||
"relax-segment-max" \
|
||||
] \
|
||||
]
|
||||
|
||||
run_dump_test "start_stop"
|
||||
}
|
||||
|
||||
run_ld_link_tests \
|
||||
|
||||
13
ld/testsuite/ld-loongarch-elf/start_stop.d
Normal file
13
ld/testsuite/ld-loongarch-elf/start_stop.d
Normal file
@@ -0,0 +1,13 @@
|
||||
#ld: -z norelro -pie -e0
|
||||
#objdump: -d
|
||||
|
||||
.*: file format .*
|
||||
|
||||
|
||||
Disassembly of section sec1:
|
||||
|
||||
[0-9a-f]+ <_start>:
|
||||
[0-9a-f]+: [0-9a-f]+ pcalau12i \$a0, .*
|
||||
[0-9a-f]+: [0-9a-f]+ ld.d \$a0, \$a0, .*
|
||||
[0-9a-f]+: [0-9a-f]+ pcalau12i \$a0, .*
|
||||
[0-9a-f]+: [0-9a-f]+ ld.d \$a0, \$a0, .*
|
||||
10
ld/testsuite/ld-loongarch-elf/start_stop.s
Normal file
10
ld/testsuite/ld-loongarch-elf/start_stop.s
Normal file
@@ -0,0 +1,10 @@
|
||||
.section sec1,"ax",@progbits
|
||||
.globl _start
|
||||
.type _start, @function
|
||||
_start:
|
||||
la.got $a0,__start_sec1
|
||||
la.got $a0,__stop_sec1
|
||||
.size _start, .-_start
|
||||
|
||||
.hidden __start_sec1
|
||||
.hidden __stop_sec1
|
||||
Reference in New Issue
Block a user