[lld] 806f5b3 - [lld-macho] Switch to new tool ID
Keith Smiley via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 15 09:40:18 PDT 2023
Author: Keith Smiley
Date: 2023-06-15T09:40:02-07:00
New Revision: 806f5b3019669d0da45903642f3d658a4853f998
URL: https://github.com/llvm/llvm-project/commit/806f5b3019669d0da45903642f3d658a4853f998
DIFF: https://github.com/llvm/llvm-project/commit/806f5b3019669d0da45903642f3d658a4853f998.diff
LOG: [lld-macho] Switch to new tool ID
As of Xcode 15 there is now a tool ID for LLD, likely driven by Apple's
tests with using LLD for their CAS work in clang. This updates LLD to
use the correct ID, and updates the object library so that llvm-objdump
prints it correctly.
Differential Revision: https://reviews.llvm.org/D152929
Added:
Modified:
lld/MachO/Writer.cpp
lld/test/MachO/lc-build-version.s
llvm/include/llvm/BinaryFormat/MachO.h
llvm/include/llvm/Object/MachO.h
Removed:
################################################################################
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 8c457ff692b87..563118231d1cf 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -495,7 +495,7 @@ class LCBuildVersion final : public LoadCommand {
c->ntools = ntools;
auto *t = reinterpret_cast<build_tool_version *>(&c[1]);
- t->tool = TOOL_LD;
+ t->tool = TOOL_LLD;
t->version = encodeVersion(VersionTuple(
LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, LLVM_VERSION_PATCH));
}
diff --git a/lld/test/MachO/lc-build-version.s b/lld/test/MachO/lc-build-version.s
index 07eeae5a5edee..7b78f803428a7 100644
--- a/lld/test/MachO/lc-build-version.s
+++ b/lld/test/MachO/lc-build-version.s
@@ -11,7 +11,7 @@
# MACOS-10-14-NEXT: sdk 10.15
# MACOS-10-14-NEXT: minos 10.14
# MACOS-10-14-NEXT: ntools 1
-# MACOS-10-14-NEXT: tool ld
+# MACOS-10-14-NEXT: tool lld
# MACOS-10-14-NEXT: version {{[0-9\.]+}}
# RUN: %lld -platform_version macos 10.13 10.15 -o %t.macos-10-13 %t.o
diff --git a/llvm/include/llvm/BinaryFormat/MachO.h b/llvm/include/llvm/BinaryFormat/MachO.h
index 8f47fabf286b5..a6d64b4c04eee 100644
--- a/llvm/include/llvm/BinaryFormat/MachO.h
+++ b/llvm/include/llvm/BinaryFormat/MachO.h
@@ -511,7 +511,7 @@ enum PlatformType {
};
// Values for tools enum in build_tool_version.
-enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3 };
+enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3, TOOL_LLD = 4 };
// Structs from <mach-o/loader.h>
diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h
index d2abffdc89069..556310bbbad61 100644
--- a/llvm/include/llvm/Object/MachO.h
+++ b/llvm/include/llvm/Object/MachO.h
@@ -807,6 +807,8 @@ class MachOObjectFile : public ObjectFile {
case MachO::TOOL_CLANG: return "clang";
case MachO::TOOL_SWIFT: return "swift";
case MachO::TOOL_LD: return "ld";
+ case MachO::TOOL_LLD:
+ return "lld";
default:
std::string ret;
raw_string_ostream ss(ret);
More information about the llvm-commits
mailing list