[PATCH] D155735: [lld-macho] Implement -no_uuid
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 11:08:40 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 subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.
Since UUID generation in lld is fast this is rarely used but it can be
helpful to avoid temporary issues like https://github.com/llvm/llvm-project/issues/63961
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155735
Files:
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/MachO/Writer.cpp
lld/test/MachO/uuid.s
Index: lld/test/MachO/uuid.s
===================================================================
--- lld/test/MachO/uuid.s
+++ lld/test/MachO/uuid.s
@@ -16,6 +16,9 @@
# RUN: llvm-dwarfdump --uuid %t/c | awk '{print $2}' > %t/uuidc
# RUN: cmp %t/uuida %t/uuidc
+## Test disabling UUID generation
+# RUN: %lld -lSystem %t/test.o -o %t/d -no_uuid
+# RUN: llvm-dwarfdump --uuid %t/d | count 0
# CHECK: 4C4C44{{([[:xdigit:]]{2})}}-5555-{{([[:xdigit:]]{4})}}-A1{{([[:xdigit:]]{2})}}-{{([[:xdigit:]]{12})}}
Index: lld/MachO/Writer.cpp
===================================================================
--- lld/MachO/Writer.cpp
+++ lld/MachO/Writer.cpp
@@ -813,8 +813,10 @@
llvm_unreachable("unhandled output file type");
}
- uuidCommand = make<LCUuid>();
- in.header->addLoadCommand(uuidCommand);
+ if (!config->disableUuid) {
+ uuidCommand = make<LCUuid>();
+ in.header->addLoadCommand(uuidCommand);
+ }
if (useLCBuildVersion(config->platformInfo))
in.header->addLoadCommand(make<LCBuildVersion>(config->platformInfo));
@@ -1264,7 +1266,8 @@
writeSections();
applyOptimizationHints();
buildFixupChains();
- writeUuid();
+ if (!config->disableUuid)
+ writeUuid();
writeCodeSignature();
if (auto e = buffer->commit())
Index: lld/MachO/Options.td
===================================================================
--- lld/MachO/Options.td
+++ lld/MachO/Options.td
@@ -791,7 +791,6 @@
Group<grp_rare>;
def no_uuid : Flag<["-"], "no_uuid">,
HelpText<"Do not generate the LC_UUID load command">,
- Flags<[HelpHidden]>,
Group<grp_rare>;
def root_safe : Flag<["-"], "root_safe">,
HelpText<"Set the MH_ROOT_SAFE bit in the mach-o header">,
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1640,6 +1640,7 @@
config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager);
config->csProfileGenerate = args.hasArg(OPT_cs_profile_generate);
config->csProfilePath = args.getLastArgValue(OPT_cs_profile_path);
+ config->disableUuid = args.hasArg(OPT_no_uuid);
for (const Arg *arg : args.filtered(OPT_alias)) {
config->aliasedSymbols.push_back(
Index: lld/MachO/Config.h
===================================================================
--- lld/MachO/Config.h
+++ lld/MachO/Config.h
@@ -227,6 +227,7 @@
llvm::SmallVector<llvm::StringRef, 0> mllvmOpts;
bool zeroModTime = true;
+ bool disableUuid = false;
llvm::StringRef osoPrefix;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155735.542120.patch
Type: text/x-patch
Size: 2544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/670a5b76/attachment.bin>
More information about the llvm-commits
mailing list