[edk2,RFC,4/4] ArmVirtPkg: ArmVirtQemu: use GCC 'small' C model on AArch64

Message ID 1435073455-3268-5-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel June 23, 2015, 3:30 p.m.
Use GCC's 'small' C model when building ArmVirtQemu for AArch64.
This model uses PC relative references for globals instead of
absolute references, which is assumed to be beneficial since it
means fewer runtime relocations to fix up, and less indirect
addressing via literals that are accessed via the D-cache.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmVirtPkg/ArmVirtQemu.dsc |  2 +-
 ArmVirtPkg/ArmVirtQemu.fdf | 24 +++++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 374cf7a9ee02..b6a6a44c7216 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -76,7 +76,7 @@  [LibraryClasses.ARM.SEC]
 [BuildOptions]
   RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmVirtPkg/Include
   GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a15 -I$(WORKSPACE)/ArmVirtPkg/Include
-  *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include
+  *_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmVirtPkg/Include -mcmodel=small
 
 
 ################################################################################
diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf
index 73d088a3bbdb..617b786798ca 100644
--- a/ArmVirtPkg/ArmVirtQemu.fdf
+++ b/ArmVirtPkg/ArmVirtQemu.fdf
@@ -306,24 +306,42 @@  [FV.FVMAIN_COMPACT]
 #
 ############################################################################
 
-[Rule.Common.SEC]
+[Rule.ARM.SEC]
   FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
     TE  TE Align = 128                  $(INF_OUTPUT)/$(MODULE_NAME).efi
   }
 
-[Rule.Common.PEI_CORE]
+[Rule.AARCH64.SEC]
+  FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED {
+    TE  TE Align = 4K                   $(INF_OUTPUT)/$(MODULE_NAME).efi
+  }
+
+[Rule.ARM.PEI_CORE]
   FILE PEI_CORE = $(NAMED_GUID) {
     TE     TE Align = 8                 $(INF_OUTPUT)/$(MODULE_NAME).efi
     UI     STRING ="$(MODULE_NAME)" Optional
   }
 
-[Rule.Common.PEIM]
+[Rule.AARCH64.PEI_CORE]
+  FILE PEI_CORE = $(NAMED_GUID) {
+    TE     TE Align = 4K                $(INF_OUTPUT)/$(MODULE_NAME).efi
+    UI     STRING ="$(MODULE_NAME)" Optional
+  }
+
+[Rule.ARM.PEIM]
   FILE PEIM = $(NAMED_GUID) {
      PEI_DEPEX PEI_DEPEX Optional       $(INF_OUTPUT)/$(MODULE_NAME).depex
      TE       TE Align = 8              $(INF_OUTPUT)/$(MODULE_NAME).efi
      UI       STRING="$(MODULE_NAME)" Optional
   }
 
+[Rule.AARCH64.PEIM]
+  FILE PEIM = $(NAMED_GUID) {
+     PEI_DEPEX PEI_DEPEX Optional       $(INF_OUTPUT)/$(MODULE_NAME).depex
+     TE       TE Align = 4K             $(INF_OUTPUT)/$(MODULE_NAME).efi
+     UI       STRING="$(MODULE_NAME)" Optional
+  }
+
 [Rule.Common.PEIM.TIANOCOMPRESSED]
   FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
     PEI_DEPEX PEI_DEPEX Optional        $(INF_OUTPUT)/$(MODULE_NAME).depex