Skip to content

Commit

Permalink
BaseTools/tools_def ARM: Disable stack protector with CLANGDWARF
Browse files Browse the repository at this point in the history
Clang insists on emitting a movt/movw pair into the function
pro/epilogues to load the stack protector reference value from memory,
and this movt/movw pair may turn out non-consecutively in the
instruction stream.

The resulting symbol reference cannot be fixed up by GenFw, as PE/COFF
always treats movt/movw as a pair, and the ELF-to-PE conversion will
therefore fail.

Just disable the stack protector when using CLANGDWARF.

Signed-off-by: Ard Biesheuvel <[email protected]>
  • Loading branch information
ardbiesheuvel authored and mergify[bot] committed Sep 18, 2024
1 parent 7796422 commit 170fa8e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BaseTools/Conf/tools_def.template
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@ NOOPT_CLANGDWARF_X64_DLINK2_FLAGS = DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O0 -fu
# CLANGDWARF ARM definitions
##################
DEFINE CLANGDWARF_ARM_TARGET = -target arm-linux-gnueabi
DEFINE CLANGDWARF_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANGDWARF_ARM_TARGET) DEF(CLANGDWARF_WARNING_OVERRIDES) -mno-movt
DEFINE CLANGDWARF_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANGDWARF_ARM_TARGET) DEF(CLANGDWARF_WARNING_OVERRIDES) -mno-movt -fno-stack-protector
DEFINE CLANGDWARF_ARM_DLINK_FLAGS = DEF(CLANGDWARF_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS)

*_CLANGDWARF_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS)
Expand Down

0 comments on commit 170fa8e

Please sign in to comment.