All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/clang: link libclang against libLLVM.so
@ 2018-05-04 12:27 Valentin Korenblit
  2018-05-04 15:05 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Korenblit @ 2018-05-04 12:27 UTC (permalink / raw)
  To: buildroot

libclang.so is statically linking against all LLVM static libraries
instead of linking dynamically against libLLVM.so.

This patch fixes this problem partially: libclang links against libLLVM.so
but the following LLVM libraries are still being linked statically:

libLLVMOption.a
libLLVMMCParser.a
libLLVMProfileData.a
libLLVMBitReader.a
libLLVMBinaryFormat.a
libLLVMCore.a
libLLVMMC.a
libLLVMSupport.a
libLLVMDemangle.a

This problem comes out when clang is not built as a subproject of
LLVM (llvm/tools/clang).

Signed-off-by: Valentin Korenblit <valentin.korenblit@smile.fr>
---
 .../0001-Avoid-linking-LLVM-static-libs.patch      | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/clang/0001-Avoid-linking-LLVM-static-libs.patch

diff --git a/package/clang/0001-Avoid-linking-LLVM-static-libs.patch b/package/clang/0001-Avoid-linking-LLVM-static-libs.patch
new file mode 100644
index 0000000000..919667c2e6
--- /dev/null
+++ b/package/clang/0001-Avoid-linking-LLVM-static-libs.patch
@@ -0,0 +1,31 @@
+From 37c3271cc49fd1556783dae33e0fcb142d6809cd Mon Sep 17 00:00:00 2001
+From: Valentin Korenblit <valentin.korenblit@smile.fr>
+Date: Fri, 4 May 2018 10:54:38 +0200
+Subject: [PATCH] Avoid linking LLVM static libs
+
+Signed-off-by: Valentin Korenblit <valentin.korenblit@smile.fr>
+---
+ tools/libclang/CMakeLists.txt | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 2dd6703076..c7346c04e5 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -90,12 +90,8 @@ add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
+   DEPENDS clang-headers
+ 
+   LINK_LIBS
+-  ${LIBS}
++  ${LIBS} libLLVM.so
+ 
+-  LINK_COMPONENTS
+-  ${LLVM_TARGETS_TO_BUILD}
+-  Core
+-  Support
+   )
+ 
+ if(ENABLE_SHARED)
+-- 
+2.14.3
+
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package/clang: link libclang against libLLVM.so
  2018-05-04 12:27 [Buildroot] [PATCH] package/clang: link libclang against libLLVM.so Valentin Korenblit
@ 2018-05-04 15:05 ` Thomas Petazzoni
  2018-05-11 11:37   ` Valentin Korenblit
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2018-05-04 15:05 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri,  4 May 2018 14:27:43 +0200, Valentin Korenblit wrote:
> libclang.so is statically linking against all LLVM static libraries
> instead of linking dynamically against libLLVM.so.
> 
> This patch fixes this problem partially: libclang links against libLLVM.so
> but the following LLVM libraries are still being linked statically:
> 
> libLLVMOption.a
> libLLVMMCParser.a
> libLLVMProfileData.a
> libLLVMBitReader.a
> libLLVMBinaryFormat.a
> libLLVMCore.a
> libLLVMMC.a
> libLLVMSupport.a
> libLLVMDemangle.a
> 
> This problem comes out when clang is not built as a subproject of
> LLVM (llvm/tools/clang).

Is this a problem you have discussed with upstream ? Has the patch
you did on the clang CMakeLists.txt any chance from being accepted
upstream ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH] package/clang: link libclang against libLLVM.so
  2018-05-04 15:05 ` Thomas Petazzoni
@ 2018-05-11 11:37   ` Valentin Korenblit
  0 siblings, 0 replies; 3+ messages in thread
From: Valentin Korenblit @ 2018-05-11 11:37 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On 04/05/2018 17:05, Thomas Petazzoni wrote:
> Hello,
>
> On Fri,  4 May 2018 14:27:43 +0200, Valentin Korenblit wrote:
>> libclang.so is statically linking against all LLVM static libraries
>> instead of linking dynamically against libLLVM.so.
>>
>> This patch fixes this problem partially: libclang links against libLLVM.so
>> but the following LLVM libraries are still being linked statically:
>>
>> libLLVMOption.a
>> libLLVMMCParser.a
>> libLLVMProfileData.a
>> libLLVMBitReader.a
>> libLLVMBinaryFormat.a
>> libLLVMCore.a
>> libLLVMMC.a
>> libLLVMSupport.a
>> libLLVMDemangle.a
>>
>> This problem comes out when clang is not built as a subproject of
>> LLVM (llvm/tools/clang).
> Is this a problem you have discussed with upstream ? Has the patch
> you did on the clang CMakeLists.txt any chance from being accepted
> upstream ?

I didn't, because I was not really convinced about this patch. I've
just found the appropriate solution.

We need to set DLLVM_LINK_LLVM_DYLIB=ON in clang.mk. I'll send the
patch now.

>
> Thanks!
>
> Thomas

Best regards,

Valentin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-11 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 12:27 [Buildroot] [PATCH] package/clang: link libclang against libLLVM.so Valentin Korenblit
2018-05-04 15:05 ` Thomas Petazzoni
2018-05-11 11:37   ` Valentin Korenblit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.