[edk2] [PATCH] BaseTools AARCH64: add -mstrict-align to all AARCH64 GCC flavors

2015-12-23 Thread Ard Biesheuvel
GCC for AARCH64 recognizes byte swapping sequences and replaces them
with rev instructions. In some cases (i.e., with GCC version 5 and later)
this may result in unaligned accesses, which are not allowed before we
turn the MMU on.

So move the -mstrict-align compiler switch to the shared define for
all AARCH64 GCC versions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 864c9ddd382e..6bd0dcf7431c 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4323,7 +4323,7 @@ DEFINE GCC_IA32_CC_FLAGS   = 
DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
 DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe
 DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
-minline-int-divide-min-latency
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -save-temps -fverbose-asm -fsigned-char  -ffunction-sections 
-fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address 
-fno-asynchronous-unwind-tables
+DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -save-temps -fverbose-asm -fsigned-char  -ffunction-sections 
-fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address 
-fno-asynchronous-unwind-tables -mstrict-align
 DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_IA32_X64_DLINK_COMMON   = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
@@ -5191,7 +5191,7 @@ DEFINE CLANG35_IA32_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) 
DEF(CLANG35_WARNING_OVE
 DEFINE CLANG35_IA32_CC_FLAGS = DEF(CLANG35_IA32_X64_CC_FLAGS) 
DEF(CLANG35_IA32_TARGET)
 DEFINE CLANG35_X64_CC_FLAGS  = DEF(CLANG35_IA32_X64_CC_FLAGS) 
DEF(CLANG35_X64_TARGET)
 DEFINE CLANG35_ARM_CC_FLAGS  = DEF(GCC_ARM_CC_FLAGS) 
DEF(CLANG35_ARM_TARGET) -mstrict-align -mllvm -arm-use-movt=0 
DEF(CLANG35_WARNING_OVERRIDES)
-DEFINE CLANG35_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) 
DEF(CLANG35_AARCH64_TARGET) -mcmodel=small -mstrict-align 
DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) 
DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
 
 ##
 # CLANG35 IA32 definitions
-- 
2.5.0

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


Re: [edk2] [PATCH] BaseTools AARCH64: add -mstrict-align to all AARCH64 GCC flavors

2015-12-23 Thread Gao, Liming
Reviewed-by: Liming Gao 

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Wednesday, December 23, 2015 10:22 PM
To: edk2-devel@lists.01.org; Gao, Liming; leif.lindh...@linaro.org
Cc: Ard Biesheuvel
Subject: [PATCH] BaseTools AARCH64: add -mstrict-align to all AARCH64 GCC 
flavors

GCC for AARCH64 recognizes byte swapping sequences and replaces them
with rev instructions. In some cases (i.e., with GCC version 5 and later)
this may result in unaligned accesses, which are not allowed before we
turn the MMU on.

So move the -mstrict-align compiler switch to the shared define for
all AARCH64 GCC versions.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 BaseTools/Conf/tools_def.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 864c9ddd382e..6bd0dcf7431c 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4323,7 +4323,7 @@ DEFINE GCC_IA32_CC_FLAGS   = 
DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
 DEFINE GCC_X64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mno-red-zone 
-Wno-address -mno-stack-arg-probe
 DEFINE GCC_IPF_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) 
-minline-int-divide-min-latency
 DEFINE GCC_ARM_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-mabi=aapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections 
-fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft
-DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -save-temps -fverbose-asm -fsigned-char  -ffunction-sections 
-fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address 
-fno-asynchronous-unwind-tables
+DEFINE GCC_AARCH64_CC_FLAGS= DEF(GCC_ALL_CC_FLAGS) -mlittle-endian 
-fno-short-enums -save-temps -fverbose-asm -fsigned-char  -ffunction-sections 
-fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address 
-fno-asynchronous-unwind-tables -mstrict-align
 DEFINE GCC_DLINK_FLAGS_COMMON  = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON = 
--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
 DEFINE GCC_IA32_X64_DLINK_COMMON   = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
@@ -5191,7 +5191,7 @@ DEFINE CLANG35_IA32_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) 
DEF(CLANG35_WARNING_OVE
 DEFINE CLANG35_IA32_CC_FLAGS = DEF(CLANG35_IA32_X64_CC_FLAGS) 
DEF(CLANG35_IA32_TARGET)
 DEFINE CLANG35_X64_CC_FLAGS  = DEF(CLANG35_IA32_X64_CC_FLAGS) 
DEF(CLANG35_X64_TARGET)
 DEFINE CLANG35_ARM_CC_FLAGS  = DEF(GCC_ARM_CC_FLAGS) 
DEF(CLANG35_ARM_TARGET) -mstrict-align -mllvm -arm-use-movt=0 
DEF(CLANG35_WARNING_OVERRIDES)
-DEFINE CLANG35_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) 
DEF(CLANG35_AARCH64_TARGET) -mcmodel=small -mstrict-align 
DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_AARCH64_CC_FLAGS  = DEF(GCC_AARCH64_CC_FLAGS) 
DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
 
 ##
 # CLANG35 IA32 definitions
-- 
2.5.0

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