meson: check for no_sanitize function attributes
Meson doesn't support for checking no_sanitize attributes, so we do it manually through testing. Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
This commit is contained in:
committed by
Marge Bot
parent
e24db36f20
commit
1c2aa6f5c3
+16
@@ -1047,6 +1047,22 @@ endforeach
|
||||
if cc.has_function_attribute('visibility:hidden')
|
||||
pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISIBILITY'
|
||||
endif
|
||||
|
||||
_no_sanitize_flags = []
|
||||
if ['address', 'address,undefined'].contains(get_option('b_sanitize'))
|
||||
_no_sanitize_flags += ['address']
|
||||
endif
|
||||
if ['undefined', 'address,undefined'].contains(get_option('b_sanitize'))
|
||||
_no_sanitize_flags += ['vptr']
|
||||
endif
|
||||
foreach flag: _no_sanitize_flags
|
||||
if cc.compiles('__attribute__((no_sanitize("@0@"))) int foo(void) { return 0; }'.format(flag),
|
||||
name : 'no_sanitize(@0@)'.format(flag),
|
||||
werror: true)
|
||||
pre_args += '-DHAVE_FUNC_ATTRIBUTE_NO_SANITIZE_@0@'.format(flag.to_upper())
|
||||
endif
|
||||
endforeach
|
||||
|
||||
if cc.compiles('__uint128_t foo(void) { return 0; }',
|
||||
name : '__uint128_t')
|
||||
pre_args += '-DHAVE_UINT128'
|
||||
|
||||
@@ -253,6 +253,12 @@ do { \
|
||||
#define ATTRIBUTE_OPTIMIZE(flags)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FUNC_ATTRIBUTE_NO_SANITIZE_VPTR
|
||||
#define ATTRIBUTE_NO_SANITIZE_VPTR __attribute__((no_sanitize(("vptr"))))
|
||||
#else
|
||||
#define ATTRIBUTE_NO_SANITIZE_VPTR
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* Macro function that evaluates to true if T is a trivially
|
||||
|
||||
Reference in New Issue
Block a user