https://sourceware.org/bugzilla/show_bug.cgi?id=24769
Nelson Chu <nelsonc1225 at sourceware dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nelsonc1225 at sourceware dot org --- 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 b/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 ELFSIZE=64 + +SEPARATE_GOTPLT="16" #Two entries are preserved for gotplt. +NO_SMALL_DATA=yes 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) } . = DATA_SEGMENT_RELRO_END (16, .); .got.plt : { *(.got.plt) *(.igot.plt) } .data : { __DATA_BEGIN__ = .; *(.data .data.* .gnu.linkonce.d.*) SORT(CONSTRUCTORS) } ... 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.