[LinkerWrapper] Only import static libraries with needed symbols
Currently, we pull in every single static archive member as long as we have an offloading architecture that requires it. This goes against the standard sematnics of static libraries that only pull in symbols that define currently undefined symbols. In order to support this we roll some custom symbol resolution logic to check if a static library is needed. Because of offloading semantics, this requires an extra check for externally visibile symbols. E.g. if a static member defines a kernel we should import it. The main benefit to this is that we can now link against the `libomptarget.devicertl.a` library unconditionally. This removes the requirement for users to specify LTO on the link command. This will also allow us to stop using the `amdgcn` bitcode versions of the libraries. ``` clang foo.c -fopenmp --offload-arch=gfx1030 -foffload-lto -c clang foo.o -fopenmp --offload-arch=gfx1030 -foffload-lto ``` Reviewed By: tra Differential Revision: https://reviews.llvm.org/D142484
Loading
Please sign in to comment