diff --git a/llvm/lib/Target/X86/X86ArgumentStackSlotRebase.cpp b/llvm/lib/Target/X86/X86ArgumentStackSlotRebase.cpp --- a/llvm/lib/Target/X86/X86ArgumentStackSlotRebase.cpp +++ b/llvm/lib/Target/X86/X86ArgumentStackSlotRebase.cpp @@ -114,7 +114,7 @@ if (F.hasFnAttribute(Attribute::Naked)) return false; // Only support Linux - if (!STI.isTargetLinux()) + if (!STI.isTargetLinux() && !STI.isTargetELF()) return false; if (!TRI->hasBasePointer(MF)) return false; diff --git a/llvm/test/CodeGen/X86/i386-baseptr.ll b/llvm/test/CodeGen/X86/i386-baseptr.ll --- a/llvm/test/CodeGen/X86/i386-baseptr.ll +++ b/llvm/test/CodeGen/X86/i386-baseptr.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=i386-pc-linux -stackrealign < %s | FileCheck %s +; RUN: llc -mtriple=i386-pc-none-elf -stackrealign < %s | FileCheck %s declare i32 @helper() nounwind define void @base() #0 {