aboutsummaryrefslogtreecommitdiff
path: root/ld/emulparams
diff options
context:
space:
mode:
authormengqinggang <mengqinggang@loongson.cn>2024-04-03 10:20:27 +0800
committerliuzhensong <liuzhensong@loongson.cn>2024-04-09 14:31:04 +0800
commit2bf280a827577eaf26d657af9f5e29dbf77e6ee2 (patch)
tree4aed8bc14fe1f925b7bdb02ed1ef4262f5fbe928 /ld/emulparams
parentedb30f5782826af431e26aac4362cca687e77913 (diff)
downloadgdb-2bf280a827577eaf26d657af9f5e29dbf77e6ee2.zip
gdb-2bf280a827577eaf26d657af9f5e29dbf77e6ee2.tar.gz
gdb-2bf280a827577eaf26d657af9f5e29dbf77e6ee2.tar.bz2
LoongArch: ld: Move .got .got.plt before .data and protect .got with relro
Move .got .got.plt before .data so .got can be protected with -zrelro. And the first two entries of .got.plt (_dl_runtime_resolve and link map) are placed within the relro region.
Diffstat (limited to 'ld/emulparams')
-rw-r--r--ld/emulparams/elf64loongarch-defs.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/ld/emulparams/elf64loongarch-defs.sh b/ld/emulparams/elf64loongarch-defs.sh
index c793f5d..a8147bf 100644
--- a/ld/emulparams/elf64loongarch-defs.sh
+++ b/ld/emulparams/elf64loongarch-defs.sh
@@ -34,6 +34,9 @@ TEXT_START_ADDR=0x120000000
MAXPAGESIZE="CONSTANT (MAXPAGESIZE)"
COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-SEPARATE_GOTPLT=0
+# Put .got before .data
+DATA_GOT=" "
+# First two entries for PLT resolver _dl_runtime_resolve and link map.
+SEPARATE_GOTPLT="SIZEOF (.got.plt) >= 16 ? 16 : 0"
INITIAL_READONLY_SECTIONS=".interp : { *(.interp) } ${CREATE_PIE-${INITIAL_READONLY_SECTIONS}}"
INITIAL_READONLY_SECTIONS="${RELOCATING+${CREATE_SHLIB-${INITIAL_READONLY_SECTIONS}}}"