Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/backend/llvm/fp_fixups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Intrinsics.h>
#include <llvm/IR/Module.h>
#include <llvm/TargetParser/Triple.h>

#include "common/types.h"

Expand All @@ -18,7 +19,13 @@ static void markColdFixup(Function *function) {
function->addFnAttr(Attribute::NoInline);
function->addFnAttr(Attribute::NoUnwind);
function->addFnAttr(Attribute::WillReturn);
function->setSection(".text.unlikely." + function->getName().str());
// Mach-O section specifiers are "__SEGMENT,__section" and its writer rejects
// anything else outright, so a bare ".text.unlikely.*" name aborts emission on
// Darwin targets ("invalid section specifier"). ELF and COFF both accept the
// name, and the Cold plus NoInline attributes already carry the placement hint
// on every target, so dropping only the name on Mach-O costs nothing.
if (!Triple(function->getParent()->getTargetTriple()).isOSBinFormatMachO())
function->setSection(".text.unlikely." + function->getName().str());
}

Function *getPairNaNFixup(Module &module, Type *pairType) {
Expand Down
Loading