[PATCH] D135082: [lld-macho] Mark aliased symbols as noDeadStrip
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 3 09:13:57 PDT 2022
keith created this revision.
keith added a reviewer: thakis.
Herald added a subscriber: jeroen.dobbelaere.
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.
This matches ld64 behavior
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D135082
Files:
lld/MachO/Driver.cpp
lld/MachO/MarkLive.cpp
lld/test/MachO/alias-option.s
Index: lld/test/MachO/alias-option.s
===================================================================
--- lld/test/MachO/alias-option.s
+++ lld/test/MachO/alias-option.s
@@ -21,7 +21,7 @@
# MAIN: [[#%x,FOO_ADDR:]] T _foo
# MAIN: [[#FOO_ADDR]] T _main
-# RUN: %lld -alias _foo _bar -alias _main _fake_main %t/main.o %t/foo.o -o %t/multiple.o
+# RUN: %lld -dead_strip -alias _foo _bar -alias _main _fake_main %t/main.o %t/foo.o -o %t/multiple.o
# RUN: llvm-nm %t/multiple.o | FileCheck %s --check-prefix=MULTIPLE
# MULTIPLE: [[#%x,FOO_ADDR:]] T _bar
Index: lld/MachO/MarkLive.cpp
===================================================================
--- lld/MachO/MarkLive.cpp
+++ lld/MachO/MarkLive.cpp
@@ -229,7 +229,7 @@
// FIXME: When we implement these flags, make symbols from them GC
// roots:
// * -reexported_symbol(s_list)
- // * -alias(-list)
+ // * -alias_list
// * -init
// In dylibs and bundles and in executables with -export_dynamic,
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1200,7 +1200,8 @@
for (const auto &pair : config->aliasedSymbols) {
if (const auto &sym = symtab->find(pair.first)) {
if (const auto &defined = dyn_cast<Defined>(sym)) {
- symtab->aliasDefined(defined, pair.second, defined->getFile());
+ symtab->aliasDefined(defined, pair.second, defined->getFile())
+ ->noDeadStrip = true;
} else {
error("TODO: support aliasing to symbols of kind " +
Twine(sym->kind()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135082.464710.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221003/06374453/attachment.bin>
More information about the llvm-commits
mailing list