This is a very basic static library search addition. This is the pre-Xcode4 behaviour of searching all paths for the shared version before searching for the static version of the library. This behaviour is supposed to be inverted with -search_paths_first being the default. This adds the library search with the intention of providing the setup to merge the paths into one path and making it controllable by OPT_search_paths_first.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I do have the follow up fix that this really begs for. I figure that doing it in slower incremental steps is easier, but Im okay with either doing it in two steps or keeping it a single step.
Doing it in two steps is fine :)
lld/test/MachO/static-link.s | ||
---|---|---|
3–5 | The inclusion of a dylib symbol here seems unrelated to the static linking behavior. Let's try to keep the tests as targeted as possible. Also, static GOTPCREL relocations won't work correctly before D80857: [lld-macho] Handle GOT relocations of non-dylib symbols lands. I think we should just do normal symbol lookup (i.e. X86_64_RELOC_SIGNED), and use llvm-objdump --section-headers --syms -d to check that the resulting code has the correct relocated addresses. relocation.s should be a good reference. | |
10 | we usually put this as the first line in the file |
LGTM, thanks!
lld/test/MachO/static-link.s | ||
---|---|---|
25–30 | nit: we usually put these right after their respective FileCheck invocation line (so after line 11 in this file) |
lld/test/MachO/static-link.s | ||
---|---|---|
17–20 | one more nit: would be nice to clean up the indentation of these comments |
lld/test/MachO/static-link.s | ||
---|---|---|
17–20 | Oh, they are just aligned (with hard tabs as is the general pattern with assembly files), I can change them to be indented with space instead. | |
25–30 | Hmm, most of LLVM IIRC also tends to just group the expectations and the RUN lines so that its easier to understand the full flow of the test. |
lld/MachO/Driver.cpp | ||
---|---|---|
299–302 | You have implemented old -search_dylibs_first semantics. The default since Xcode 4 is -search_paths_first |
You have implemented old -search_dylibs_first semantics. The default since Xcode 4 is -search_paths_first