Revision: 18131
          http://sourceforge.net/p/edk2/code/18131
Author:   abiesheuvel
Date:     2015-08-03 08:21:39 +0000 (Mon, 03 Aug 2015)
Log Message:
-----------
BaseTools IA32/X64: move .rodata to PE/COFF .text section

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 <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Tested-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Scripts/gcc-4K-align-ld-script
    trunk/edk2/BaseTools/Scripts/gcc4.4-ld-script
    trunk/edk2/BaseTools/Scripts/gcc4.9-ld-script

Modified: trunk/edk2/BaseTools/Scripts/gcc-4K-align-ld-script
===================================================================
--- trunk/edk2/BaseTools/Scripts/gcc-4K-align-ld-script 2015-08-03 08:21:28 UTC 
(rev 18130)
+++ trunk/edk2/BaseTools/Scripts/gcc-4K-align-ld-script 2015-08-03 08:21:39 UTC 
(rev 18131)
@@ -6,12 +6,12 @@
   .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*

Modified: trunk/edk2/BaseTools/Scripts/gcc4.4-ld-script
===================================================================
--- trunk/edk2/BaseTools/Scripts/gcc4.4-ld-script       2015-08-03 08:21:28 UTC 
(rev 18130)
+++ trunk/edk2/BaseTools/Scripts/gcc4.4-ld-script       2015-08-03 08:21:39 UTC 
(rev 18131)
@@ -6,12 +6,12 @@
   .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*

Modified: trunk/edk2/BaseTools/Scripts/gcc4.9-ld-script
===================================================================
--- trunk/edk2/BaseTools/Scripts/gcc4.9-ld-script       2015-08-03 08:21:28 UTC 
(rev 18130)
+++ trunk/edk2/BaseTools/Scripts/gcc4.9-ld-script       2015-08-03 08:21:39 UTC 
(rev 18131)
@@ -6,12 +6,12 @@
   .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*


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to