package/llvm: add llvm RTTI option
authorRomain Naour <romain.naour@gmail.com>
Sat, 5 Oct 2019 09:48:15 +0000 (11:48 +0200)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 25 Oct 2019 21:27:36 +0000 (23:27 +0200)
Allow to build LLVM with run-time type information as this feature is
needed (for example) by mesa3d's Gallium Nouveau driver or the Clover
OpenCL state tracker when llvm support is enabled in mesa3d.

While we only care about RTTI support in the target, we also need to
enable it in the host LLVM, so that llvm-config gives the proper
result.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/llvm/Config.in
package/llvm/llvm.mk

index 83e94660eb612f4db17361ab2542f97b59838b56..e235efed9af0d74da8199f904b48536ba379f241 100644 (file)
@@ -35,6 +35,19 @@ config BR2_PACKAGE_LLVM_AMDGPU
          Build AMDGPU target. Select this option if you are going
          to install mesa3d with llvm and use Gallium Radeon driver.
 
+config BR2_PACKAGE_LLVM_RTTI
+       bool "enable rtti"
+       help
+         Build LLVM with run-time type information. LLVM can be built
+         without rtti, but turning it off changes the ABI of C++
+         programs.
+
+         This features is needed to build the Gallium Nouveau driver
+         or the Clover OpenCL state tracker when llvm support is
+         enabled.
+
+         https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
+
 endif
 
 comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 4.8, host gcc >= 4.8, dynamic library"
index 4d9bb1d12f902e2277b36b2d1715dc116ca87650..2b2bcf336efcee2a986898910031520f4377d56b 100644 (file)
@@ -219,6 +219,14 @@ LLVM_CONF_OPTS += \
        -DLLVM_INCLUDE_TOOLS=ON \
        -DLLVM_BUILD_TOOLS=OFF
 
+ifeq ($(BR2_PACKAGE_LLVM_RTTI),y)
+HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
+LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
+else
+HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
+LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
+endif
+
 # Compiler-rt not in the source tree.
 # llvm runtime libraries are not in the source tree.
 # Polly is not in the source tree.