[flang-commits] [flang] 85e2731 - [flang] Fix DYLIB builds

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Fri Mar 11 08:13:08 PST 2022


Author: Andrzej Warzynski
Date: 2022-03-11T16:12:36Z
New Revision: 85e2731aa3d440384067001a9a460a889037eb11

URL: https://github.com/llvm/llvm-project/commit/85e2731aa3d440384067001a9a460a889037eb11
DIFF: https://github.com/llvm/llvm-project/commit/85e2731aa3d440384067001a9a460a889037eb11.diff

LOG: [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

Added: 
    

Modified: 
    flang/lib/Frontend/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/lib/Frontend/CMakeLists.txt b/flang/lib/Frontend/CMakeLists.txt
index a68e0e9a74634..d6520e705dc9f 100644
--- a/flang/lib/Frontend/CMakeLists.txt
+++ b/flang/lib/Frontend/CMakeLists.txt
@@ -27,8 +27,6 @@ add_flang_library(flangFrontend
   FortranLower
   clangBasic
   clangDriver
-  LLVMAnalysis
-  LLVMTarget
   FIRDialect
   FIRSupport
   FIRBuilder
@@ -40,8 +38,10 @@ add_flang_library(flangFrontend
   ${dialect_libs}
 
   LINK_COMPONENTS
+  Analysis
   Option
   Support
+  Target
   FrontendOpenACC
   FrontendOpenMP
 )


        


More information about the flang-commits mailing list