[PATCH] D113167: [lld-macho]Allow exporting weak_def_can_be_hidden(AKA "autohide") symbols
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 10:42:21 PST 2021
int3 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;
----------------
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?
================
Comment at: lld/MachO/Symbols.h:163
+ bool weakDefCanBeHidden : 1;
+
----------------
hmm, this brings us to 9 bits of booleans :/
probably fine in practice, but maybe do a quick benchmark before landing this
================
Comment at: lld/test/MachO/weak-def-can-be-hidden.s:45-46
+## .weak_def_can_be_hidden symbols can still be exported, if explicitly
+## specified via --exported_symbols.
+# RUN: %lld -dylib -exported_symbol "_foo" %t/weak-autohide-foo.o -o %t/exp-autohide.dylib
----------------
could we place this test in `export-options.s`?
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