Skip to content

Commit

Permalink
Remove Darwin workaround (dotnet#163)
Browse files Browse the repository at this point in the history
This caught my attention as I was looking at the ObjWriter. LLVM no longer emits a `LC_VERSION_MIN_MACOSX` load command unless we explicitly set a version. I don't see a difference in `llvm-objdump -macho -x foo.o` with/without these lines (I didn't bother myself to boot into macOS to run `otool`).
  • Loading branch information
MichalStrehovsky authored and filipnavara committed Nov 16, 2022
1 parent 1a27b31 commit 109f825
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
15 changes: 1 addition & 14 deletions llvm/tools/objwriter/objwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,6 @@ void ObjectWriter::InitTripleName(const char* tripleName) {
TripleName = tripleName != nullptr ? tripleName : sys::getDefaultTargetTriple();
}

Triple ObjectWriter::GetTriple() {
Triple TheTriple(TripleName);

if (TheTriple.getOS() == Triple::OSType::Darwin) {
TheTriple = Triple(
TheTriple.getArchName(), TheTriple.getVendorName(), "darwin",
TheTriple
.getEnvironmentName()); // it is workaround for llvm bug
// https://bugs.llvm.org//show_bug.cgi?id=24927.
}
return TheTriple;
}

bool ObjectWriter::Init(llvm::StringRef ObjectFilePath, const char* tripleName) {
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.

Expand All @@ -88,7 +75,7 @@ bool ObjectWriter::Init(llvm::StringRef ObjectFilePath, const char* tripleName)
InitializeAllTargetMCs();

InitTripleName(tripleName);
Triple TheTriple = GetTriple();
Triple TheTriple(TripleName);

// Get the target specific parser.
std::string TargetError;
Expand Down
1 change: 0 additions & 1 deletion llvm/tools/objwriter/objwriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class ObjectWriter {
void EmitCVUserDefinedTypesSymbols();

void InitTripleName(const char* tripleName = nullptr);
Triple GetTriple();
unsigned GetDFSize();
void EmitRelocDirective(const int Offset, StringRef Name, const MCExpr *Expr);
const MCExpr *GenTargetExpr(const MCSymbol* Symbol,
Expand Down

0 comments on commit 109f825

Please sign in to comment.