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) Ard Biesheuvel (2): BaseTools: add separate build rule for modules that may execute in place BaseTools AARCH64: build XIP modules with strict alignment BaseTools/Conf/build_rule.template | 26 ++++++++++++++++++++ BaseTools/Conf/tools_def.template | 9 ++++++- 2 files changed, 34 insertions(+), 1 deletion(-) -- 2.5.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel