From abacad30a54c59ad437ccf54ec5236a8dd7f3ba9 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 17 Feb 2017 19:37:28 +0000 Subject: [PATCH] Vendor import of compiler-rt release_40 branch r295380: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_40@295380 --- lib/builtins/arm/subsf3vfp.S | 2 +- .../sanitizer_platform_limits_posix.cc | 7 +------ test/builtins/Unit/clear_cache_test.c | 16 ++++++++++++++-- test/builtins/Unit/fixunsdfdi_test.c | 3 --- test/builtins/Unit/fixunssfdi_test.c | 2 -- test/lsan/TestCases/strace_test.cc | 1 + test/lsan/lit.common.cfg | 5 +++++ 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lib/builtins/arm/subsf3vfp.S b/lib/builtins/arm/subsf3vfp.S index a9f3ba9422cf..3e83ea26507d 100644 --- a/lib/builtins/arm/subsf3vfp.S +++ b/lib/builtins/arm/subsf3vfp.S @@ -21,7 +21,7 @@ DEFINE_COMPILERRT_FUNCTION(__subsf3vfp) #if defined(COMPILER_RT_ARMHF_TARGET) vsub.f32 s0, s0, s1 -#elsee +#else vmov s14, r0 // move first param from r0 into float register vmov s15, r1 // move second param from r1 into float register vsub.f32 s14, s14, s15 diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc index fbde5e17dc63..683f019d70c3 100644 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -23,11 +23,6 @@ #ifdef _FILE_OFFSET_BITS #undef _FILE_OFFSET_BITS #endif -#if SANITIZER_FREEBSD -#define _WANT_RTENTRY -#include -#include -#endif #include #include #include @@ -433,6 +428,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned struct_input_absinfo_sz = sizeof(struct input_absinfo); unsigned struct_input_id_sz = sizeof(struct input_id); unsigned struct_mtpos_sz = sizeof(struct mtpos); + unsigned struct_rtentry_sz = sizeof(struct rtentry); unsigned struct_termio_sz = sizeof(struct termio); unsigned struct_vt_consize_sz = sizeof(struct vt_consize); unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes); @@ -452,7 +448,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); unsigned struct_midi_info_sz = sizeof(struct midi_info); unsigned struct_mtget_sz = sizeof(struct mtget); unsigned struct_mtop_sz = sizeof(struct mtop); - unsigned struct_rtentry_sz = sizeof(struct rtentry); unsigned struct_sbi_instrument_sz = sizeof(struct sbi_instrument); unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec); unsigned struct_synth_info_sz = sizeof(struct synth_info); diff --git a/test/builtins/Unit/clear_cache_test.c b/test/builtins/Unit/clear_cache_test.c index 3c893018545f..0ef704fcde88 100644 --- a/test/builtins/Unit/clear_cache_test.c +++ b/test/builtins/Unit/clear_cache_test.c @@ -18,9 +18,20 @@ void __clear_cache(void* start, void* end) if (!FlushInstructionCache(GetCurrentProcess(), start, end-start)) exit(1); } + +static uintptr_t get_page_size() { + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +} #else +#include #include extern void __clear_cache(void* start, void* end); + +static uintptr_t get_page_size() { + return sysconf(_SC_PAGE_SIZE); +} #endif @@ -56,8 +67,9 @@ unsigned char execution_buffer[128]; int main() { // make executable the page containing execution_buffer - char* start = (char*)((uintptr_t)execution_buffer & (-4095)); - char* end = (char*)((uintptr_t)(&execution_buffer[128+4096]) & (-4095)); + uintptr_t page_size = get_page_size(); + char* start = (char*)((uintptr_t)execution_buffer & (-page_size)); + char* end = (char*)((uintptr_t)(&execution_buffer[128+page_size]) & (-page_size)); #if defined(_WIN32) DWORD dummy_oldProt; MEMORY_BASIC_INFORMATION b; diff --git a/test/builtins/Unit/fixunsdfdi_test.c b/test/builtins/Unit/fixunsdfdi_test.c index 1ddc5340b03d..3998482876f3 100644 --- a/test/builtins/Unit/fixunsdfdi_test.c +++ b/test/builtins/Unit/fixunsdfdi_test.c @@ -95,9 +95,6 @@ int main() if (test__fixunsdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL)) return 1; - if (test__fixunsdfdi(0x1.p+64, 0xFFFFFFFFFFFFFFFFLL)) - return 1; - #if !TARGET_LIBGCC if (test__fixunsdfdi(-0x1.FFFFFFFFFFFFFp+62, 0)) return 1; diff --git a/test/builtins/Unit/fixunssfdi_test.c b/test/builtins/Unit/fixunssfdi_test.c index 166153cb5b51..812457a002de 100644 --- a/test/builtins/Unit/fixunssfdi_test.c +++ b/test/builtins/Unit/fixunssfdi_test.c @@ -79,8 +79,6 @@ int main() return 1; if (test__fixunssfdi(0x1.000000p+63F, 0x8000000000000000LL)) return 1; - if (test__fixunssfdi(0x1.000000p+64F, 0xFFFFFFFFFFFFFFFFLL)) - return 1; if (test__fixunssfdi(0x1.FFFFFEp+62F, 0x7FFFFF8000000000LL)) return 1; if (test__fixunssfdi(0x1.FFFFFCp+62F, 0x7FFFFF0000000000LL)) diff --git a/test/lsan/TestCases/strace_test.cc b/test/lsan/TestCases/strace_test.cc index b3568d0b44e8..b25e05753848 100644 --- a/test/lsan/TestCases/strace_test.cc +++ b/test/lsan/TestCases/strace_test.cc @@ -1,4 +1,5 @@ // Test that lsan reports a proper error when running under strace. +// REQUIRES: strace // RUN: %clangxx_lsan %s -o %t // RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s diff --git a/test/lsan/lit.common.cfg b/test/lsan/lit.common.cfg index 6002e2d69444..8580eec33d28 100644 --- a/test/lsan/lit.common.cfg +++ b/test/lsan/lit.common.cfg @@ -4,6 +4,8 @@ import os +import lit.util + def get_required_attr(config, attr_name): attr_value = getattr(config, attr_name, None) if attr_value == None: @@ -29,6 +31,9 @@ else: lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode) config.name += config.name_suffix +if lit.util.which('strace'): + config.available_features.add('strace') + clang_cflags = ["-O0", config.target_cflags] + config.debug_info_flags clang_cxxflags = config.cxx_mode_flags + clang_cflags lsan_incdir = config.test_source_root + "/../"