[PATCH] D113167: [lld-macho]Allow exporting weak_def_can_be_hidden(AKA "autohide") symbols
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 17:49:03 PST 2021
oontvoo added inline comments.
================
Comment at: lld/MachO/Driver.cpp:1478-1484
+ else
+ // weak_def_can_be_hidden symbols behaves similarly to
+ // private_extern symbols in most cases, except for when
+ // it is explicitly exported.
+ // LD64 allows exporting the former, but not the latter.
+ // So we do the same here.
+ defined->privateExtern = false;
----------------
int3 wrote:
> This is basically undoing the promotion work in InputFiles.cpp, right? Would it be simpler if we didn't attempt that promotion, and just treated these two booleans as independent values?
>
> Also, what happens when a symbol is marked both autohide and private_extern?
Well, it's a bit more convoluted than that (sorry!)
It's only undoing the promotion IF the symbol is in the exported list. (if not, it needs to stay privateExtern so we dont put it in the dynamic table).
However, if a symbol is both autohide and private-extern, then the autohide doesn't mean anything - it can't be exported either. (added the test)
We can keep the two flags independent in theory, but that means I'd have to go fix up all the places where privateExtern is treated to also take into account this extra flag, which (aside from being a bit of work) is unnecessary because as mentioned the symbol acts exactly like a privateExtern, only difference is that it can be exported.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113167/new/
https://reviews.llvm.org/D113167
More information about the llvm-commits
mailing list