From 2bf280a827577eaf26d657af9f5e29dbf77e6ee2 Mon Sep 17 00:00:00 2001 From: mengqinggang Date: Wed, 3 Apr 2024 10:20:27 +0800 Subject: 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. --- bfd/elfnn-loongarch.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bfd') diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index eb70799..e863290 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -127,6 +127,8 @@ struct loongarch_elf_link_hash_table #define GOT_ENTRY_SIZE (LARCH_ELF_WORD_BYTES) +/* Reserve two entries of GOTPLT for ld.so, one is used for PLT + resolver _dl_runtime_resolve, the other is used for link map. */ #define GOTPLT_HEADER_SIZE (GOT_ENTRY_SIZE * 2) #define elf_backend_want_got_plt 1 -- cgit v1.1