diff options
author | Fangrui Song <maskray@google.com> | 2020-04-08 21:45:21 -0700 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-04-22 12:34:20 -0700 |
commit | c384ca3c6a49197c3f752b64871379cb673d52b9 (patch) | |
tree | aef8bed4d727b168595695d82ba87a25e072c84d /lldb/source/Plugins/ScriptInterpreter/Python | |
parent | cd66970b371240d90e163d2020c1a42bb2b7e1b9 (diff) | |
download | llvm-c384ca3c6a49197c3f752b64871379cb673d52b9.zip llvm-c384ca3c6a49197c3f752b64871379cb673d52b9.tar.gz llvm-c384ca3c6a49197c3f752b64871379cb673d52b9.tar.bz2 |
[ELF] For relative paths in INPUT() and GROUP(), search the directory of the current linker script before searching other paths
For a relative path in INPUT() or GROUP(), this patch changes the search order by adding the directory of the current linker script.
The new search order (consistent with GNU ld >= 2.35 regarding the new test `test/ELF/input-relative.s`):
1. the directory of the current linker script (GNU ld from Binutils 2.35 onwards; https://sourceware.org/bugzilla/show_bug.cgi?id=25806)
2. the current working directory
3. library paths (-L)
This behavior makes it convenient to replace a .so or .a with a linker script with additional input. For example, glibc
```
% cat /usr/lib/x86_64-linux-gnu/libm.a
/* GNU ld script
*/
OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /usr/lib/x86_64-linux-gnu/libm-2.29.a /usr/lib/x86_64-linux-gnu/libmvec.a )
```
could be simplified as `GROUP(libm-2.29.a libmvec.a)`.
Another example is to make libc++.a a linker script:
```
INPUT(libc++.a.1 libc++abi.a)
```
Note, -l is not affected.
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D77779
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
0 files changed, 0 insertions, 0 deletions