[all-commits] [llvm/llvm-project] 85e273: [flang] Fix DYLIB builds

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Fri Mar 11 08:13:16 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 85e2731aa3d440384067001a9a460a889037eb11
      https://github.com/llvm/llvm-project/commit/85e2731aa3d440384067001a9a460a889037eb11
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-03-11 (Fri, 11 Mar 2022)

  Changed paths:
    M flang/lib/Frontend/CMakeLists.txt

  Log Message:
  -----------
  [flang] Fix DYLIB builds

https://reviews.llvm.org/D120568 broke builds that set
both `LLVM_BUILD_LLVM_DYLIB` and `LLVM_LINK_LLVM_DYLIB`. This patch
fixes that.

The build failure was caused by the fact that some LLVM libraries (which
are also LLVM components) were listed directly as link-time dependencies
instead of using `LINK_COMPONENTS` in CMake files. This lead to a linker
invocation like this (simplified version to demonstrate the problem):
```
ld lib/libLLVM.so lib/libLLVMAnalysis.a lib/libLLVMTarget.a
```
That's problematic and unnecessary because `libLLVM.so` incorporates
`libLLVMAnalysis` and `libLLVMTarget`. A correct invocation would look
like this (`LLVM_LINK_LLVM_DYLIB` _is not_ set):
```
ld  lib/libLLVMAnalysis.a lib/libLLVMTarget.a
```
or this (`LLVM_LINK_LLVM_DYLIB` _is_ set):
```
ld lib/libLLVM.so
```

Differential Revision: https://reviews.llvm.org/D121461




More information about the All-commits mailing list