[cfe-dev] Clang7 UBSan + -fvisibility-hidden

Stephan Bergmann via cfe-dev cfe-dev at lists.llvm.org
Tue Mar 26 09:05:31 PDT 2019


On 26/03/2019 16:38, Philipp Berger via cfe-dev wrote:
> We have tried this on Arch linux (with boost 1.69.0-1, clang 7.0.1-1
> using libstd++) and CentOS 7.6 (clang 7.0.0 using libc++ and boost
> 1.69.0 build with the same clang).
> 
> We have bisected this UBSan behavior to boost commit
> 16f52cede5bb0665f36c13dfd76c6badd719f21b, which activated
> -fvisibility-inlines-hidden and -fvisibility=hidden.
> 
> Is there any common knowledge around visibility-hidden +
> visibility-inlines-hidden + UBSan?

On platforms that use the Itanium ABI, Clang UBSan has traditionally 
used just pointer comparison to determine type_info equality (instead of 
string comparison as done by GCC, deviating from the ABI).  That breaks 
down under -fvisibilty=hidden when type_infos from different shared 
objects are compared, as their pointers will always be different, even 
if they are meant to represent the same type.  What we use with some 
success in LibreOffice is to replace -fvisiblity=hidden with 
-fvisibility-ms-compat (which happens to not hide type info symbols) 
when building with Clang UBSan.



More information about the cfe-dev mailing list