RISC-V: Protect .got with relro 79/305279/2 accepted/tizen/base/x/20240214.091432
authorAndreas Schwab <schwab@suse.de>
Thu, 21 Sep 2023 14:49:41 +0000 (16:49 +0200)
committerDongkyun Son <dongkyun.s@samsung.com>
Tue, 30 Jan 2024 23:22:45 +0000 (08:22 +0900)
commite55bb2882fd5d12a891f76a6627678f253e4cec2
tree657d483608287f53f164457175a27a51f4c0622c
parent482b3b438b7841899301b4ce649dfbd1c0ba4063
RISC-V: Protect .got with relro

Move .got before .data so that it can be protected with -zrelro.  Also
separate .got.plt from .got if -znow is not in effect; the first two words
of .got.plt are placed within the relro region.

ld:
PR ld/30877
* emulparams/elf32lriscv-defs.sh (DATA_GOT, SEPARATE_GOTPLT):
Define.
* emulparams/elf64lriscv-defs.sh (SEPARATE_GOTPLT): Define.
* testsuite/ld-elf/binutils.exp (binutils_test): Remove riscv*-*-*
from relro_got expression.

(cherry picked from commit 7345d05aafde53a48d5a587a6d9c1778db78e0f3)

Change-Id: I6c6c9e54752d1c6076d5f1d32a9d25b8cf85dc09
ld/emulparams/elf32lriscv-defs.sh
ld/emulparams/elf64lriscv-defs.sh
ld/testsuite/ld-elf/binutils.exp