[PATCH] D126046: [lld-macho] Support -non_global_symbols_strip_list, -non_global_symbols_no_strip_list, -x

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 21 11:08:52 PDT 2022


MaskRay added inline comments.


================
Comment at: lld/MachO/Config.h:97
 
+enum class SymtabPresence {
+  All,
----------------
This is for local symbols so the name can be more specific. One idea is

```
enum class LocalSymbolPolicy {
  All,
  None,
  IncludeSelected,
  ExcludeSelected,
};
```


================
Comment at: lld/MachO/Driver.cpp:1443
+        if (hasInclude) {
+          error("cannot use both -non_global_symbols_no_strip_list and "
+                "-non_global_symbols_strip_list");
----------------
FWIW ld.lld uses `error: ... and ... may not be used together`


================
Comment at: lld/MachO/SyntheticSections.cpp:708
+  uint64_t offset =
+      in.lazyPointers->addr - dataSeg->addr + sym.stubsIndex * target->wordSize;
   encodeULEB128(offset, os);
----------------
Drop formatting


================
Comment at: lld/MachO/SyntheticSections.cpp:966
 
+  std::function<void(Symbol *)> localSymbolsHandler;
+  switch (config->localSymbolsPresence) {
----------------
It seems simpler to use `bool(Symbol *)` and let the for loop call `addSymbol(localSymbols, sym);`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126046/new/

https://reviews.llvm.org/D126046



More information about the llvm-commits mailing list