]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools GCC: move AutoGen.obj contents to .text section
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 3 Aug 2015 08:22:50 +0000 (08:22 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Mon, 3 Aug 2015 08:22:50 +0000 (08:22 +0000)
All AutoGen.obj files consist of global GUID definitions, fixed
and patchable PCDs and other data that is essentially read-only at
runtime but has not been declared as such for various reasons.

By moving these contents to .text we achieve two things:
- global GUIDs and other data items which must be constant for correct
  program operation can no longer be modified, for instance, when
  running a DXE_RUNTIME_MODULE binary under the OS with the Properties
  Table feature for memory protection enabled;
- the .data section becomes smaller, and may be dropped completely for
  many XIP modules, which reduces wasted FV space if the PE/COFF section
  alignment is large.

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>
Tested-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18137 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Scripts/GccBase.lds

index 3d99f01db21faadf77a9cd7074cbe402e878a303..4ee6d998532c1346a52235fb011184ce4a0994db 100644 (file)
@@ -29,6 +29,13 @@ SECTIONS {
     *(.text .text.* .stub .gnu.linkonce.t.*)\r
     *(.rodata .rodata.* .gnu.linkonce.r.*)\r
     *(.got .got.*)\r
+\r
+    /*\r
+     * The contents of AutoGen.c files are constant from the POV of the program,\r
+     * but most of its contents end up in .data or .bss by default since few of\r
+     * the variable definitions that get emitted are declared as CONST.\r
+     */\r
+    *:AutoGen.obj(.data .data.* .bss .bss.*)\r
   }\r
 \r
   /*\r