Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

Commit

Permalink
Remove the .data section from RISC-V's default linker script addon
Browse files Browse the repository at this point in the history
I'm actually not sure why this is here: .data isn't read-only and
shouldn't be in the INITIAL_READONLY_SECTIONS variable.  This causes a
handful of sections that should be read-only to actually be read-write
when loaded, which breaks things like "-z relro".

Removing this causes the default .data mapping to be used, which comes
from upstream.  As far os I can tell, there was no reason we were ever
supposed to have our own .data in the first place, and no other
architectures have ever done it this way.

I tested this still builds and boots Busybox on Linux.

Thanks to Alan Morda for finding the problem.

ld/ChangeLog

2016-12-29  Palmer Dabbelt <[email protected]>

        * emulparams/elf32lriscv-defs.sh (INITIAL_READONLY_SECTIONS):
        Remove the RISC-V specific .data section mapping.
  • Loading branch information
palmer-dabbelt committed Dec 30, 2016
1 parent 8c5f683 commit bd404ff
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion ld/emulparams/elf32lriscv-defs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ SDATA_START_SYMBOLS="_gp = . + 0x800;
# Place the data section before text section. This enables more compact
# global variable access for RVC code via linker relaxation.
INITIAL_READONLY_SECTIONS="
.data : { *(.data) *(.data.*) *(.gnu.linkonce.d.*) }
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r.*) }
.srodata : { ${SDATA_START_SYMBOLS} }
.sdata : { *(.sdata .sdata.* .gnu.linkonce.s.*) }
Expand Down

0 comments on commit bd404ff

Please sign in to comment.