diff options
author | Nuri Amari <nuri.amari99@gmail.com> | 2024-05-31 18:17:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 18:17:51 -0700 |
commit | 1697030d9d7188473cc4129bd28f848a77d04d3d (patch) | |
tree | 3ba6913983931d28b8ba9e3050756b39e0edf7d5 /lld/test | |
parent | 16832eb58563f77d917198ad9f86db1c2ee162c9 (diff) | |
download | llvm-1697030d9d7188473cc4129bd28f848a77d04d3d.zip llvm-1697030d9d7188473cc4129bd28f848a77d04d3d.tar.gz llvm-1697030d9d7188473cc4129bd28f848a77d04d3d.tar.bz2 |
[MachO LLD] Respect -all_load with --start-lib --end-lib style archives (#93993)
The -all_load flag is intended to force the linker to load all lazy members, but doesn't do so if the archive is specified with --start-lib, --end-lib flags. The `-all_load` flag is global, that is it can be placed anywhere in the linker invocation, and it affects the load behavior of all conventional archives listed. Unlike ELF's --whole-archive, the user need not necessarily have access to the entire linker invocation to reasonably make use of the flag. The user can supply `-all_load` to a build system without inspecting the rest of the linker invocation.
To make the behavior of `--start-lib` style archives consistent with regular archives, this patch makes it so that -all_load also applies in this case.
Diffstat (limited to 'lld/test')
-rw-r--r-- | lld/test/MachO/start-lib.s | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/test/MachO/start-lib.s b/lld/test/MachO/start-lib.s index 2da940c..09df292 100644 --- a/lld/test/MachO/start-lib.s +++ b/lld/test/MachO/start-lib.s @@ -86,6 +86,11 @@ # RUN: not %lld --end-lib 2>&1 | FileCheck %s --check-prefix=STRAY # STRAY: error: stray --end-lib +# RUN: %lld -dylib --start-lib %t/1.bc %t/2.o --end-lib -all_load -o %t/out +# RUN: llvm-readobj -s %t/out | FileCheck --check-prefix=ALL-LOAD %s +# ALL-LOAD-DAG: _foo +# ALL-LOAD-DAG: _bar + #--- main.s .globl _main _main: |