aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-04-10 09:07:43 -0500
committerGitHub <noreply@github.com>2024-04-10 09:07:43 -0500
commit50d368aee981738cd05f3d16f5d1cfc122c9b0ab (patch)
tree2c2012b591cb0db967e90740bb328b60c56fab43 /flang/lib/Frontend/CompilerInvocation.cpp
parent938a73422e0b964eba16f272acdfae1d0281772c (diff)
downloadllvm-50d368aee981738cd05f3d16f5d1cfc122c9b0ab.zip
llvm-50d368aee981738cd05f3d16f5d1cfc122c9b0ab.tar.gz
llvm-50d368aee981738cd05f3d16f5d1cfc122c9b0ab.tar.bz2
[LinkerWrapper] Relax ordering of static libraries for offloading (#87532)
Summary: The linker wrapper attempts to maintain consistent semantics with existing host invocations. Static libraries by default only extract if there are non-weak symbols that remain undefined. However, we have situations between linkers that put different meanings on ordering. The ld.bfd linker requires static libraries to be defined after the symbols, while `ld.lld` relaxes this rule. The linker wrapper went with the former as it's the easier solution, however this has caused a lot of issues as I've had to explain this rule to several people, it also make it difficult to include things like `libc` in the OpenMP runtime because it would sometimes be linked before or after. This patch reworks the logic to more or less perform the following logic for static libraries. 1. Split library / object inputs. 2. Include every object input and record its undefined symbols 3. Repeatedly try to extract static libraries to resolve these symbols. If a file is extracted we need to check every library again to resolve any new undefined symbols. This allows the following to work and will cause fewer issues when replacing HIP, which does `--whole-archive` so it's very likely the old logic will regress. ```console $ clang -lfoo main.c -fopenmp --offload-arch=native ```
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions