Ensure RTTI symbol visibility for Linux Clang -fsanitize=function,vptr
The problem being that any lib later loaded via osl_loadModule (e.g., libgcc3_uno.so) would not bind to the same global (RTTI-related) symbols as libsofficeapp.so and its dependencies (so, e.g., -fsanitize=function would erroneously assume that bridges/source/cpp_uno/shared/component.cxx's uno_initEnvironment is called with a different, non-matching uno_Environment type). Change-Id: I08b0cbc1f9eb74641eb617c46587a0a528a56c31
This commit is contained in:
@@ -129,9 +129,14 @@ void CheckConfigMacros::checkMacro( const Token& macroToken, SourceLocation loca
|
|||||||
{
|
{
|
||||||
if( configMacros.find( macroToken.getIdentifierInfo()->getName()) != configMacros.end())
|
if( configMacros.find( macroToken.getIdentifierInfo()->getName()) != configMacros.end())
|
||||||
{
|
{
|
||||||
report( DiagnosticsEngine::Error, "checking whether a config macro %0 is defined",
|
const char* filename = compiler.getSourceManager().getPresumedLoc( location ).getFilename();
|
||||||
location ) << macroToken.getIdentifierInfo()->getName();
|
if( filename == NULL
|
||||||
report( DiagnosticsEngine::Note, "use #if instead of #ifdef/#ifndef/defined", location );
|
|| strncmp( filename, SRCDIR "/include/LibreOfficeKit/", strlen( SRCDIR "/include/LibreOfficeKit/" )) != 0 )
|
||||||
|
{
|
||||||
|
report( DiagnosticsEngine::Error, "checking whether a config macro %0 is defined",
|
||||||
|
location ) << macroToken.getIdentifierInfo()->getName();
|
||||||
|
report( DiagnosticsEngine::Note, "use #if instead of #ifdef/#ifndef/defined", location );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,14 @@ extern "C"
|
|||||||
|
|
||||||
void *_dlopen(const char *pFN)
|
void *_dlopen(const char *pFN)
|
||||||
{
|
{
|
||||||
return dlopen(pFN, RTLD_LAZY);
|
return dlopen(pFN, RTLD_LAZY
|
||||||
|
#if defined __clang__ && defined __linux__ \
|
||||||
|
&& defined ENABLE_RUNTIME_OPTIMIZATIONS
|
||||||
|
#if !ENABLE_RUNTIME_OPTIMIZATIONS
|
||||||
|
| RTLD_GLOBAL
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *_dlsym(void *Hnd, const char *pName)
|
void *_dlsym(void *Hnd, const char *pName)
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <rtl/bootstrap.hxx>
|
#include <rtl/bootstrap.hxx>
|
||||||
|
|
||||||
|
#include <config_options.h>
|
||||||
|
// see use of ENABLE_RUNTIME_OPTIMIZATIONS in LibreOfficeKintInit.h
|
||||||
#define LOK_USE_UNSTABLE_API
|
#define LOK_USE_UNSTABLE_API
|
||||||
#include <LibreOfficeKit/LibreOfficeKitInit.h>
|
#include <LibreOfficeKit/LibreOfficeKitInit.h>
|
||||||
#include <LibreOfficeKit/LibreOfficeKit.hxx>
|
#include <LibreOfficeKit/LibreOfficeKit.hxx>
|
||||||
|
Reference in New Issue
Block a user