On AARCH64, before we turn on the MMU, unaligned accesses are not allowed. Since the idiom recognition employed by GCC may turn allowable sequences into sequences that result in such unaligned accesses (i.e., a sequence of byte wide loads in reverse order may be turned into a wider load and a rev instruction of the compiler thinks unaligned accesses are allowed), we have to make sure that any code that may execute before the MMU is enabled is built with -mstrict-align.
Since this aligns with the notion of XIP we have in EDK2, let's add a build rule that allows XIP specific CC option overrides to be set, and use it to set the -mstrict-align CC flag for BASE, SEC, PEI_CORE and PEIM modules. (XIPFLAGS has been suggest by Andrew Fish a couple of months ago, when a similar issue came up) Changes since v1: - make the build rule specific to GCC/AARCH64 rather than global for all archs and toolchains Ard Biesheuvel (2): BaseTools AARCH64: add separate GCC build rule for XIP objects BaseTools AARCH64: build XIP modules with strict alignment BaseTools/Conf/build_rule.template | 13 +++++++++++++ BaseTools/Conf/tools_def.template | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) -- 2.5.0 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

