The .rodata ELF section contains constant non-executable data that should never be modified by the program itself. Since the risk of inadvertent modification is typically higher than the risk of inadvertent execution, it makes sense to put this data in the R-X .text section rather than in the RW- .data section. So move it there.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- BaseTools/Scripts/gcc-4K-align-ld-script | 2 +- BaseTools/Scripts/gcc4.4-ld-script | 2 +- BaseTools/Scripts/gcc4.9-ld-script | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/gcc-4K-align-ld-script b/BaseTools/Scripts/gcc-4K-align-ld-script index 16cf623a3362..1f0f1afb27f4 100644 --- a/BaseTools/Scripts/gcc-4K-align-ld-script +++ b/BaseTools/Scripts/gcc-4K-align-ld-script @@ -6,12 +6,12 @@ SECTIONS .text : ALIGN(0x1000) { *(.text .stub .text.* .gnu.linkonce.t.*) + *(.rodata .rodata.* .gnu.linkonce.r.*) . = ALIGN(0x20); } .data : ALIGN(0x1000) { *( - .rodata .rodata.* .gnu.linkonce.r.* .data .data.* .gnu.linkonce.d.* .bss .bss.* *COM* diff --git a/BaseTools/Scripts/gcc4.4-ld-script b/BaseTools/Scripts/gcc4.4-ld-script index c0aa62180440..22b3220816c9 100644 --- a/BaseTools/Scripts/gcc4.4-ld-script +++ b/BaseTools/Scripts/gcc4.4-ld-script @@ -6,12 +6,12 @@ SECTIONS .text ALIGN(0x20) : { *(.text .stub .text.* .gnu.linkonce.t.*) + *(.rodata .rodata.* .gnu.linkonce.r.*) . = ALIGN(0x20); } .data ALIGN(0x20) : { *( - .rodata .rodata.* .gnu.linkonce.r.* .data .data.* .gnu.linkonce.d.* .bss .bss.* *COM* diff --git a/BaseTools/Scripts/gcc4.9-ld-script b/BaseTools/Scripts/gcc4.9-ld-script index 37a93cd85e94..2ac86e38fac7 100644 --- a/BaseTools/Scripts/gcc4.9-ld-script +++ b/BaseTools/Scripts/gcc4.9-ld-script @@ -6,12 +6,12 @@ SECTIONS .text ALIGN(0x20) : { *(.text .stub .text.* .gnu.linkonce.t.*) + *(.rodata .rodata.* .gnu.linkonce.r.*) . = ALIGN(0x20); } .data ALIGN(0x40) : { *( - .rodata .rodata.* .gnu.linkonce.r.* .data .data.* .gnu.linkonce.d.* .bss .bss.* *COM* -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel