]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools IA32/X64: move .rodata to PE/COFF .text section
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 3 Aug 2015 08:21:39 +0000 (08:21 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Mon, 3 Aug 2015 08:21:39 +0000 (08:21 +0000)
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.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18131 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Scripts/gcc-4K-align-ld-script
BaseTools/Scripts/gcc4.4-ld-script
BaseTools/Scripts/gcc4.9-ld-script

index 16cf623a33626ac16ce0a9369de467122a77a93d..1f0f1afb27f455e63802172a4bc2020aa964582f 100644 (file)
@@ -6,12 +6,12 @@ SECTIONS
   .text : ALIGN(0x1000)\r
   {\r
     *(.text .stub .text.* .gnu.linkonce.t.*)\r
+    *(.rodata .rodata.* .gnu.linkonce.r.*)\r
     . = ALIGN(0x20);\r
   }\r
   .data : ALIGN(0x1000)\r
   {\r
     *(\r
-      .rodata .rodata.* .gnu.linkonce.r.*\r
       .data .data.* .gnu.linkonce.d.*\r
       .bss .bss.*\r
       *COM*\r
index c0aa62180440c2d331e815c8433f50715a520d60..22b3220816c98ff86c67a582ecadb1d348fd0d12 100644 (file)
@@ -6,12 +6,12 @@ SECTIONS
   .text ALIGN(0x20) :\r
   {\r
     *(.text .stub .text.* .gnu.linkonce.t.*)\r
+    *(.rodata .rodata.* .gnu.linkonce.r.*)\r
     . = ALIGN(0x20);\r
   }\r
   .data ALIGN(0x20) :\r
   {\r
     *(\r
-      .rodata .rodata.* .gnu.linkonce.r.*\r
       .data .data.* .gnu.linkonce.d.*\r
       .bss .bss.*\r
       *COM*\r
index 37a93cd85e94000caa1ad2531ac46d7ce18c2eb0..2ac86e38fac78a4ff3d515b65334da8aa7220daa 100644 (file)
@@ -6,12 +6,12 @@ SECTIONS
   .text ALIGN(0x20) :\r
   {\r
     *(.text .stub .text.* .gnu.linkonce.t.*)\r
+    *(.rodata .rodata.* .gnu.linkonce.r.*)\r
     . = ALIGN(0x20);\r
   }\r
   .data ALIGN(0x40) :\r
   {\r
     *(\r
-      .rodata .rodata.* .gnu.linkonce.r.*\r
       .data .data.* .gnu.linkonce.d.*\r
       .bss .bss.*\r
       *COM*\r