[PATCH] D130725: [lld/mac] Add support for $ld$previous symbols with explicit symbol name

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 16:16:02 PDT 2022


thakis added inline comments.


================
Comment at: lld/MachO/InputFiles.cpp:2077
+
+    // Just adding the symbol to the symtab works because dylibs contain their
+    // symbols in alphabetical order, guaranteeing $ld$ symbols to precede
----------------
int3 wrote:
> what do you mean by "works" here? what's the failure case that we have avoided?
The tbd file usually contains the `$ld$previous` symbol for an old version, and then the symbol itself later, for newer deployment targets, like so:

```
    symbols:         [
      '$ld$previous$/Another$$1$3.0$14.0$_zzz$',
      _zzz,
   ]
```

If they weren't sorted, then `_zzz` would be added with the current dylib first (and since it's added first, it would win over the `$ld$previous` symbol.

Suggestions on how to reword the comment?


================
Comment at: lld/test/MachO/special-symbol-ld-previous.s:33-34
+## Case 4: special symbol $ld$previous affects the install name / compatibility version
+## when the specified version 11.0.0 is within the affected range [3.0, 14.0) when a symbol
+## is part of $previous$ if and only if that symbol is referenced.
+
----------------
int3 wrote:
> > when a symbol is part of $previous$ if and only if that symbol is referenced.
> 
> kind of confused by this. Did you mean "only when the named symbol is referenced"?
Yes, that's what I mean. Reworded it a bit.


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

https://reviews.llvm.org/D130725



More information about the llvm-commits mailing list