[PATCH] D152929: [lld-macho] Switch to new tool ID

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 08:52:59 PDT 2023


keith created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152929

Files:
  lld/MachO/Writer.cpp
  lld/test/MachO/lc-build-version.s
  llvm/include/llvm/BinaryFormat/MachO.h
  llvm/include/llvm/Object/MachO.h


Index: llvm/include/llvm/Object/MachO.h
===================================================================
--- llvm/include/llvm/Object/MachO.h
+++ llvm/include/llvm/Object/MachO.h
@@ -807,6 +807,8 @@
     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);
Index: llvm/include/llvm/BinaryFormat/MachO.h
===================================================================
--- llvm/include/llvm/BinaryFormat/MachO.h
+++ llvm/include/llvm/BinaryFormat/MachO.h
@@ -511,7 +511,7 @@
 };
 
 // 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>
 
Index: lld/test/MachO/lc-build-version.s
===================================================================
--- lld/test/MachO/lc-build-version.s
+++ 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
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -495,7 +495,7 @@
 
     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));
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152929.531363.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230614/2d1d9c78/attachment-0001.bin>


More information about the llvm-commits mailing list