* [PATCH 1/2] BaseTools CLANG35: add missing XIP flags for AARCH64
2016-08-08 10:40 [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support Ard Biesheuvel
@ 2016-08-08 10:40 ` Ard Biesheuvel
2016-08-08 10:40 ` [PATCH 2/2] BaseTools ARM: impose strict alignment only for XIP modules Ard Biesheuvel
2016-08-09 4:01 ` [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support Gao, Liming
2 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2016-08-08 10:40 UTC (permalink / raw)
To: leif.lindholm, yonghong.zhu, liming.gao, edk2-devel; +Cc: Ard Biesheuvel
When building for AARCH64, code that may execute with the MMU off should
not perform unaligned accesses, which is why we set -mstrict-align for
BASE, SEC, PEI_CORE and PEIM modules when building with GCCx. However,
this setting is missing from CLANG35 so set it there as well.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
BaseTools/Conf/tools_def.template | 1 +
1 file changed, 1 insertion(+)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 4f1dd4be378e..76ec62f4bb0d 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -5422,6 +5422,7 @@ RELEASE_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(P
*_CLANG35_AARCH64_RC_FLAGS = DEF(GCC_AARCH64_RC_FLAGS)
*_CLANG35_AARCH64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_AARCH64_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_AARCH64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG35_AARCH64_TARGET)
+*_CLANG35_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
DEBUG_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
RELEASE_CLANG35_AARCH64_CC_FLAGS = DEF(CLANG35_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] BaseTools ARM: impose strict alignment only for XIP modules
2016-08-08 10:40 [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support Ard Biesheuvel
2016-08-08 10:40 ` [PATCH 1/2] BaseTools CLANG35: add missing XIP flags for AARCH64 Ard Biesheuvel
@ 2016-08-08 10:40 ` Ard Biesheuvel
2016-08-09 4:01 ` [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support Gao, Liming
2 siblings, 0 replies; 5+ messages in thread
From: Ard Biesheuvel @ 2016-08-08 10:40 UTC (permalink / raw)
To: leif.lindholm, yonghong.zhu, liming.gao, edk2-devel; +Cc: Ard Biesheuvel
Given that we only support ARMv7 and up in Tianocore (due to the fact
that the PI spec mandates that the PEI services table pointer be stored
in the TPIDRURW register, which is not available on earlier CPUs), we can
assume that any code executing with the MMU on may perform unaligned
accesses (since the AArch32 bindings in the UEFI spec stipulate that
unaligned accesses should be allowed if supported by the CPU)
So relax the alignment restrictions to XIP modules only, i.e., BASE, SEC,
PEI_CORE and PEIM type modules, exactly like we do for AARCH64 already.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
BaseTools/Conf/build_rule.template | 2 +-
BaseTools/Conf/tools_def.template | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index f52f603b278b..eac069298947 100644
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -161,7 +161,7 @@
"$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
-[C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64]
+[C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64,C-Code-File.BASE.ARM,C-Code-File.SEC.ARM,C-Code-File.PEI_CORE.ARM,C-Code-File.PEIM.ARM]
<InputFile>
?.c
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 76ec62f4bb0d..8888c34a8f53 100644
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4335,6 +4335,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 -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -mthumb -mfloat-abi=soft
+DEFINE GCC_ARM_CC_XIPFLAGS = -mno-unaligned-access
DEFINE GCC_AARCH64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-builtin -Wno-address -fno-asynchronous-unwind-tables
DEFINE GCC_AARCH64_CC_XIPFLAGS = -mstrict-align
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
@@ -4394,6 +4395,7 @@ DEFINE GCC46_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
DEFINE GCC46_ASM_FLAGS = DEF(GCC45_ASM_FLAGS)
DEFINE GCC46_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
DEFINE GCC46_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations -save-temps
+DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) -Wl,--oformat=elf32-littlearm
DEFINE GCC46_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220
DEFINE GCC46_ARM_ASLDLINK_FLAGS = DEF(GCC_ARM_ASLDLINK_FLAGS) -Wl,--oformat=elf32-littlearm
@@ -4409,7 +4411,8 @@ DEFINE GCC47_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
DEFINE GCC47_ASM_FLAGS = DEF(GCC46_ASM_FLAGS)
DEFINE GCC47_ARM_ASM_FLAGS = DEF(GCC46_ARM_ASM_FLAGS)
DEFINE GCC47_AARCH64_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -mno-unaligned-access
+DEFINE GCC47_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS)
+DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
DEFINE GCC47_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) -mcmodel=large DEF(GCC_AARCH64_CC_FLAGS) -save-temps
DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
@@ -4431,6 +4434,7 @@ DEFINE GCC48_ASM_FLAGS = DEF(GCC47_ASM_FLAGS)
DEFINE GCC48_ARM_ASM_FLAGS = DEF(GCC47_ARM_ASM_FLAGS)
DEFINE GCC48_AARCH64_ASM_FLAGS = DEF(GCC47_AARCH64_ASM_FLAGS)
DEFINE GCC48_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS)
+DEFINE GCC48_ARM_CC_XIPFLAGS = DEF(GCC47_ARM_CC_XIPFLAGS)
DEFINE GCC48_AARCH64_CC_FLAGS = DEF(GCC47_AARCH64_CC_FLAGS)
DEFINE GCC48_AARCH64_CC_XIPFLAGS = DEF(GCC47_AARCH64_CC_XIPFLAGS)
DEFINE GCC48_ARM_DLINK_FLAGS = DEF(GCC47_ARM_DLINK_FLAGS)
@@ -4452,6 +4456,7 @@ DEFINE GCC49_ASM_FLAGS = DEF(GCC48_ASM_FLAGS)
DEFINE GCC49_ARM_ASM_FLAGS = DEF(GCC48_ARM_ASM_FLAGS)
DEFINE GCC49_AARCH64_ASM_FLAGS = DEF(GCC48_AARCH64_ASM_FLAGS)
DEFINE GCC49_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS)
+DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
DEFINE GCC49_AARCH64_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -save-temps
DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
@@ -4473,6 +4478,7 @@ DEFINE GCC5_ASM_FLAGS = DEF(GCC49_ASM_FLAGS)
DEFINE GCC5_ARM_ASM_FLAGS = DEF(GCC49_ARM_ASM_FLAGS)
DEFINE GCC5_AARCH64_ASM_FLAGS = DEF(GCC49_AARCH64_ASM_FLAGS)
DEFINE GCC5_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS)
+DEFINE GCC5_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS)
DEFINE GCC5_AARCH64_CC_FLAGS = DEF(GCC49_AARCH64_CC_FLAGS)
DEFINE GCC5_AARCH64_CC_XIPFLAGS = DEF(GCC49_AARCH64_CC_XIPFLAGS)
DEFINE GCC5_ARM_DLINK_FLAGS = DEF(GCC49_ARM_DLINK_FLAGS)
@@ -4812,9 +4818,10 @@ RELEASE_GCC46_X64_CC_FLAGS = DEF(GCC46_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC46_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC46_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_GCC46_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC46_ARM_CC_XIPFLAGS = DEF(GCC46_ARM_CC_XIPFLAGS)
- DEBUG_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALIGNED=0 -O0
-RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -D__ARM_FEATURE_UNALIGNED=0 -Wno-unused-but-set-variable
+ DEBUG_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -O0
+RELEASE_GCC46_ARM_CC_FLAGS = DEF(GCC46_ARM_CC_FLAGS) -Wno-unused-but-set-variable
####################################################################################
#
@@ -4916,6 +4923,7 @@ RELEASE_GCC47_X64_CC_FLAGS = DEF(GCC47_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC47_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC47_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_GCC47_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC47_ARM_CC_XIPFLAGS = DEF(GCC47_ARM_CC_XIPFLAGS)
DEBUG_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -O0
RELEASE_GCC47_ARM_CC_FLAGS = DEF(GCC47_ARM_CC_FLAGS) -Wno-unused-but-set-variable
@@ -5048,6 +5056,7 @@ RELEASE_GCC48_X64_CC_FLAGS = DEF(GCC48_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC48_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC48_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_GCC48_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC48_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
DEBUG_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -O0
RELEASE_GCC48_ARM_CC_FLAGS = DEF(GCC48_ARM_CC_FLAGS) -Wno-unused-but-set-variable
@@ -5180,6 +5189,7 @@ RELEASE_GCC49_X64_CC_FLAGS = DEF(GCC49_X64_CC_FLAGS) -Wno-unused-but-set-v
*_GCC49_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC49_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_GCC49_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC49_ARM_CC_XIPFLAGS = DEF(GCC49_ARM_CC_XIPFLAGS)
DEBUG_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -O0
RELEASE_GCC49_ARM_CC_FLAGS = DEF(GCC49_ARM_CC_FLAGS) -Wno-unused-but-set-variable
@@ -5312,6 +5322,7 @@ RELEASE_GCC5_X64_CC_FLAGS = DEF(GCC5_X64_CC_FLAGS) -Wno-unused-but-set-va
*_GCC5_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_PP_FLAGS)
*_GCC5_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_GCC5_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_VFRPP_FLAGS)
+*_GCC5_ARM_CC_XIPFLAGS = DEF(GCC5_ARM_CC_XIPFLAGS)
DEBUG_GCC5_ARM_CC_FLAGS = DEF(GCC5_ARM_CC_FLAGS) -O0
DEBUG_GCC5_ARM_DLINK_FLAGS = DEF(GCC5_ARM_DLINK_FLAGS)
@@ -5382,7 +5393,7 @@ DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabihf
DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu
DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body
-DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) -mstrict-align DEF(CLANG35_WARNING_OVERRIDES)
+DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES)
DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES)
##################
@@ -5401,6 +5412,7 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64
*_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS)
*_CLANG35_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)
*_CLANG35_ARM_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG35_ARM_TARGET)
+*_CLANG35_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
DEBUG_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -O0
RELEASE_CLANG35_ARM_CC_FLAGS = DEF(CLANG35_ARM_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -Oz
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support
2016-08-08 10:40 [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support Ard Biesheuvel
2016-08-08 10:40 ` [PATCH 1/2] BaseTools CLANG35: add missing XIP flags for AARCH64 Ard Biesheuvel
2016-08-08 10:40 ` [PATCH 2/2] BaseTools ARM: impose strict alignment only for XIP modules Ard Biesheuvel
@ 2016-08-09 4:01 ` Gao, Liming
2016-08-09 7:53 ` Ard Biesheuvel
2 siblings, 1 reply; 5+ messages in thread
From: Gao, Liming @ 2016-08-09 4:01 UTC (permalink / raw)
To: Ard Biesheuvel, leif.lindholm@linaro.org, Zhu, Yonghong,
edk2-devel@lists.01.org
Reviewed-by: Liming Gao <liming.gao@intel.com>
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, August 08, 2016 6:40 PM
> To: leif.lindholm@linaro.org; Zhu, Yonghong <yonghong.zhu@intel.com>;
> Gao, Liming <liming.gao@intel.com>; edk2-devel@lists.01.org
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH 0/2] BaseTools ARM/AARCH64: improve XIP support
>
> Patch #1 adds the missing XIP flags to CLANG35, to prevent code to be
> generated that performs unaligned accesses before the MMU is on.
>
> Patch #2 extends the XIP CC flags support to ARM.
>
> Ard Biesheuvel (2):
> BaseTools CLANG35: add missing XIP flags for AARCH64
> BaseTools ARM: impose strict alignment only for XIP modules
>
> BaseTools/Conf/build_rule.template | 2 +-
> BaseTools/Conf/tools_def.template | 21 ++++++++++++++++----
> 2 files changed, 18 insertions(+), 5 deletions(-)
>
> --
> 2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread