mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-19 06:13:14 +01:00
Always add 'uwtable' attribute on x86_64.
This is what Clang does, and omitting it could lead to problems w.r.t. the System V ABI. Doesn't seem to have caused any issues so far, though.
This commit is contained in:
@@ -968,6 +968,19 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||
if (fd->isMain())
|
||||
gIR->emitMain = true;
|
||||
|
||||
// On x86_64, always set 'uwtable' for System V ABI compatibility.
|
||||
// TODO: Find a better place for this.
|
||||
if (global.params.targetTriple.getArch() == llvm::Triple::x86_64)
|
||||
{
|
||||
#if LDC_LLVM_VER >= 303
|
||||
func->addFnAttr(llvm::Attribute::UWTable);
|
||||
#elif LDC_LLVM_VER == 302
|
||||
func->addFnAttr(llvm::Attributes::UWTable);
|
||||
#else
|
||||
func->addFnAttr(UWTable);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string entryname("entry");
|
||||
|
||||
llvm::BasicBlock* beginbb = llvm::BasicBlock::Create(gIR->context(), entryname,func);
|
||||
|
||||
Reference in New Issue
Block a user