[Mesa-dev] [PATCH 5/7] meson: fix builds against LLVM built without rtti

Dylan Baker dylan at pnwbakers.com
Tue Apr 17 18:58:26 UTC 2018


Quoting Dylan Baker (2018-04-16 16:48:59)
> Building without rtti is a frought with peril, but it's something that
> autotools supports so we need to support it too.
> 
> Since we've moved to version 0.44 as a whole we can use the meson
> functionality for accessing random llvm-config options we can check for
> rtti and add -fno-rtti to all C++ code accordingly.
> 
> Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
> ---
>  meson.build | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index b79d7b9c7f2..beb65b314ac 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1143,6 +1143,13 @@ if with_llvm
>      '-DHAVE_LLVM=0x0 at 0@0 at 1@'.format(_llvm_version[0], _llvm_version[1]),
>      '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
>    ]
> +
> +  # LLVM can be built without rtti, turning off rtti changes the ABI of C++
> +  # programs, so we need to build all C++ code in mesa without rtti as well to
> +  # ensure that linking works.
> +  if dep_llvm.get_configtool_variable('has-rtti') == 'NO'
> +    cpp_args('-fno-rtti')
> +  endif
>  elif with_amd_vk or with_gallium_radeonsi or with_gallium_swr
>    error('The following drivers require LLVM: Radv, RadeonSI, SWR. One of these is enabled, but LLVM is disabled.')
>  endif
> -- 
> 2.17.0
> 

I meant to CC you guys on this since you've actually run into the problem
before. This should make Marek's no-rtti build of LLVM link against mesa with
meson without any extra flags.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180417/2bf76630/attachment.sig>


More information about the mesa-dev mailing list