Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -566,6 +566,17 @@ } } + if (Triple.getEnvironment() == llvm::Triple::EABI) { + switch (Triple.getArch()) { + case llvm::Triple::arm: + case llvm::Triple::thumb: + // ARM EABI doesn't require a frame pointer + return !areOptimizationsEnabled(Args); + default: + return true; + } + } + return true; } Index: test/CodeGen/arm-fp-eabi.c =================================================================== --- /dev/null +++ test/CodeGen/arm-fp-eabi.c @@ -0,0 +1,13 @@ +// RUN: %clang %s -target arm-none-eabi -O2 -S -o nofp.s +// RUN: grep -v '.setfp' nofp.s +// RUN: %clang %s -target arm-none-eabi -fno-omit-frame-pointer -O2 -S -o fp.s +// RUN: grep '.setfp' fp.s + +void +foo(void); + +int main() +{ + foo(); + return 0; +}