From 109f825def819377b84854f81380d74283ea6fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 20 Jan 2022 17:27:01 +0900 Subject: [PATCH] Remove Darwin workaround (#163) 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`). --- llvm/tools/objwriter/objwriter.cpp | 15 +-------------- llvm/tools/objwriter/objwriter.h | 1 - 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/llvm/tools/objwriter/objwriter.cpp b/llvm/tools/objwriter/objwriter.cpp index 5ba8cfa1a17710..3fe42df9b7a3bc 100644 --- a/llvm/tools/objwriter/objwriter.cpp +++ b/llvm/tools/objwriter/objwriter.cpp @@ -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. @@ -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; diff --git a/llvm/tools/objwriter/objwriter.h b/llvm/tools/objwriter/objwriter.h index 1bf7fa16fcb4d7..863ad2fa1a56da 100644 --- a/llvm/tools/objwriter/objwriter.h +++ b/llvm/tools/objwriter/objwriter.h @@ -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,