mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
gc.c: move ASAN check to configure
Availability of attributes are checked in configure these days, rather than compiler macros. Also __attribute__((no_address_safety_analysis)) is considered deprecated in both GCC and Clang. Use the current best practice if available. See also: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html https://clang.llvm.org/docs/AddressSanitizer.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ee7af44257
commit
16f5b18b7a
4 changed files with 20 additions and 10 deletions
|
@ -1352,6 +1352,9 @@ RUBY_FUNC_ATTRIBUTE(__deprecated__("by "@%:@n), DEPRECATED_BY(n,x), rb_cv_func_d
|
|||
RUBY_TYPE_ATTRIBUTE(__deprecated__ mesg, DEPRECATED_TYPE(mesg,x), rb_cv_type_deprecated)
|
||||
RUBY_FUNC_ATTRIBUTE(__noinline__, NOINLINE)
|
||||
RUBY_FUNC_ATTRIBUTE(__always_inline__, ALWAYS_INLINE)
|
||||
RUBY_FUNC_ATTRIBUTE(__no_sanitize__(san), NO_SANITIZE(san, x), rb_cv_func_no_sanitize)
|
||||
RUBY_FUNC_ATTRIBUTE(__no_sanitize_address__, NO_SANITIZE_ADDRESS)
|
||||
RUBY_FUNC_ATTRIBUTE(__no_address_safety_analysis__, NO_ADDRESS_SAFETY_ANALYSIS)
|
||||
RUBY_FUNC_ATTRIBUTE(__warn_unused_result__, WARN_UNUSED_RESULT)
|
||||
RUBY_FUNC_ATTRIBUTE(__unused__, MAYBE_UNUSED)
|
||||
RUBY_FUNC_ATTRIBUTE(__error__ mesg, ERRORFUNC(mesg,x), rb_cv_func___error__)
|
||||
|
|
12
gc.c
12
gc.c
|
@ -61,16 +61,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if /* is ASAN enabled? */ \
|
||||
__has_feature(address_sanitizer) /* Clang */ || \
|
||||
defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x */
|
||||
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
|
||||
__attribute__((no_address_safety_analysis)) \
|
||||
__attribute__((noinline))
|
||||
#else
|
||||
#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
@ -4158,8 +4148,10 @@ ruby_stack_check(void)
|
|||
}
|
||||
|
||||
ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
|
||||
(
|
||||
static void
|
||||
mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register long n)
|
||||
)
|
||||
{
|
||||
VALUE v;
|
||||
while (n--) {
|
||||
|
|
14
internal.h
14
internal.h
|
@ -54,6 +54,20 @@ extern "C" {
|
|||
# define WARN_UNUSED_RESULT(x) x
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#elif defined(NO_SANITIZE)
|
||||
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
||||
NO_SANITIZE("address", NOINLINE(x))
|
||||
#elif defined(NO_SANITIZE_ADDRESS)
|
||||
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
||||
NO_SANITIZE_ADDRESS(NOINLINE(x))
|
||||
#elif defined(NO_ADDRESS_SAFETY_ANALYSIS)
|
||||
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS(x) \
|
||||
NO_ADDRESS_SAFETY_ANALYSIS(NOINLINE(x))
|
||||
#else
|
||||
# define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
|
||||
# include <valgrind/memcheck.h>
|
||||
# ifndef VALGRIND_MAKE_MEM_DEFINED
|
||||
|
|
|
@ -29,6 +29,7 @@ ${rbcv_cond+[@%:@define ]attrib[](attrib_params)[ x]}
|
|||
${rbcv_cond+[@%:@endif]})
|
||||
$6
|
||||
@%:@define mesg ("")
|
||||
@%:@define san "address"
|
||||
attrib[](attrib_params)[;], [],
|
||||
[rbcv="$mac"; break])
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue