Move the .got contents to the PE/COFF .text section. This should be
a no-op, since we typically don't generate position independent code
(i.e., using -fPIC). But since the GOT contains variable addresses that
are updated at relocation time only, its contents are best kept in .text
to prevent them from being overwritten inadvertently.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
---
 BaseTools/Scripts/gcc-4K-align-ld-script | 5 +----
 BaseTools/Scripts/gcc4.4-ld-script       | 5 +----
 BaseTools/Scripts/gcc4.9-ld-script       | 5 +----
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/BaseTools/Scripts/gcc-4K-align-ld-script 
b/BaseTools/Scripts/gcc-4K-align-ld-script
index 3ed1c12fb8aa..34957a53147c 100644
--- a/BaseTools/Scripts/gcc-4K-align-ld-script
+++ b/BaseTools/Scripts/gcc-4K-align-ld-script
@@ -7,6 +7,7 @@ SECTIONS
   {
     *(.text .stub .text.* .gnu.linkonce.t.*)
     *(.rodata .rodata.* .gnu.linkonce.r.*)
+    *(.got .got.*)
   }
   .data : ALIGN(0x1000)
   {
@@ -20,10 +21,6 @@ SECTIONS
   {
     KEEP (*(.eh_frame))
   }
-  .got : ALIGN(0x1000)
-  {
-    *(.got .got.*)
-  }
   .rela : ALIGN(0x1000)
   {
     *(.rela .rela.*)
diff --git a/BaseTools/Scripts/gcc4.4-ld-script 
b/BaseTools/Scripts/gcc4.4-ld-script
index 0d86908d0b30..48320c6611e4 100644
--- a/BaseTools/Scripts/gcc4.4-ld-script
+++ b/BaseTools/Scripts/gcc4.4-ld-script
@@ -7,6 +7,7 @@ SECTIONS
   {
     *(.text .stub .text.* .gnu.linkonce.t.*)
     *(.rodata .rodata.* .gnu.linkonce.r.*)
+    *(.got .got.*)
   }
   .data ALIGN(0x20) :
   {
@@ -20,10 +21,6 @@ SECTIONS
   {
     KEEP (*(.eh_frame))
   }
-  .got ALIGN(0x20) :
-  {
-    *(.got .got.*)
-  }
   .rela ALIGN(0x20) :
   {
     *(.rela .rela.*)
diff --git a/BaseTools/Scripts/gcc4.9-ld-script 
b/BaseTools/Scripts/gcc4.9-ld-script
index 207b9e1dc7f0..3dff0b2907e6 100644
--- a/BaseTools/Scripts/gcc4.9-ld-script
+++ b/BaseTools/Scripts/gcc4.9-ld-script
@@ -7,6 +7,7 @@ SECTIONS
   {
     *(.text .stub .text.* .gnu.linkonce.t.*)
     *(.rodata .rodata.* .gnu.linkonce.r.*)
+    *(.got .got.*)
   }
   .data ALIGN(0x40) :
   {
@@ -20,10 +21,6 @@ SECTIONS
   {
     KEEP (*(.eh_frame))
   }
-  .got ALIGN(0x20) :
-  {
-    *(.got .got.*)
-  }
   .rela ALIGN(0x20) :
   {
     *(.rela .rela.*)
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to