[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/24769] [RISCV] partial RELRO doesn't work: .got is not in PT_GNU

From: nelsonc1225 at sourceware dot org
Subject: [Bug ld/24769] [RISCV] partial RELRO doesn't work: .got is not in PT_GNU_RELRO
Date: Wed, 21 Jul 2021 05:20:21 +0000


Nelson Chu <nelsonc1225 at sourceware dot org> changed:

           What    |Removed                     |Added
                 CC|                            |nelsonc1225 at sourceware dot 

--- Comment #1 from Nelson Chu <nelsonc1225 at sourceware dot org> ---
This should be the linker script issue.  I spend some times to see what
happened, the behavior should be right, it depends on whether the targets need
sdata, or wants the separate got and gotplt.

The following change is used for experiment, without testing:
diff --git a/ld/emulparams/elf64lriscv-defs.sh
index 84a700a..cba3f2a 100644
--- a/ld/emulparams/elf64lriscv-defs.sh
+++ b/ld/emulparams/elf64lriscv-defs.sh
@@ -1,2 +1,5 @@
 source_sh ${srcdir}/emulparams/elf32lriscv-defs.sh
+SEPARATE_GOTPLT="16"  #Two entries are preserved for gotplt.

And also update the __global_pointer$ in ld/emulparams/elf32lriscv-defs.sh,
since we now disable the sdata, so __SDATA_BEGIN__ won't be generated.

Then I can get your expected linker script, which places the got in the relro
region, and is before gotplt.

  .dynamic        : { *(.dynamic) }
  .got            : { *(.got) *(.igot) }
  .got.plt        : { *(.got.plt) *(.igot.plt) }
  .data           :
    __DATA_BEGIN__ = .;
    *(.data .data.* .gnu.linkonce.d.*)

Therefore, I think the first issue could be changed to - Should we need to
place the got in the relro region? And why sdata will affect the got placement?

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]