[PATCH] D113167: [lld-macho] Allow exporting weak def private-extern symbols.
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 3 22:24:14 PDT 2021
oontvoo updated this revision to Diff 384663.
oontvoo added a comment.
typos
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113167/new/
https://reviews.llvm.org/D113167
Files:
lld/MachO/Driver.cpp
lld/MachO/MarkLive.cpp
Index: lld/MachO/MarkLive.cpp
===================================================================
--- lld/MachO/MarkLive.cpp
+++ lld/MachO/MarkLive.cpp
@@ -67,7 +67,7 @@
// FIXME: Instead of doing this here, maybe the Driver code doing
// the matching should add them to explicitUndefineds? Then the
// explicitUndefineds code below would handle this automatically.
- assert(!defined->privateExtern &&
+ assert((!defined->privateExtern || defined->isWeakDef()) &&
"should have been rejected by driver");
addSym(defined);
continue;
Index: lld/MachO/Driver.cpp
===================================================================
--- lld/MachO/Driver.cpp
+++ lld/MachO/Driver.cpp
@@ -1472,8 +1472,15 @@
StringRef symbolName = defined->getName();
if (config->exportedSymbols.match(symbolName)) {
if (defined->privateExtern) {
- warn("cannot export hidden symbol " + symbolName +
- "\n>>> defined in " + toString(defined->getFile()));
+ // If it's a weak, it's not "hidden".
+ if (!defined->isWeakDef())
+ warn("cannot export hidden symbol " + symbolName +
+ "\n>>> defined in " + toString(defined->getFile()));
+ else
+ // When a weakdef private extern symbol is exported,
+ // it becomes "non-private".
+ // This matches LD64's behavior.
+ defined->privateExtern = false;
}
} else {
defined->privateExtern = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113167.384663.patch
Type: text/x-patch
Size: 1623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211104/4826b5db/attachment-0001.bin>
More information about the llvm-commits
mailing list