
When ASan testing is enabled on SPARC as per PR #107405, the ``` AddressSanitizer-sparc-linux :: TestCases/Linux/odr_c_test.c ``` test `FAIL`s on Linux/sparc64: ``` + projects/compiler-rt/test/asan/SPARCLinuxConfig/TestCases/Linux/Output/odr_c_test.c.tmp + count 0 Expected 0 lines, got 13. AddressSanitizer:DEADLYSIGNAL ================================================================= ==4165420==ERROR: AddressSanitizer: BUS on unknown address (pc 0x7012d5b4 bp 0xffa3b938 sp 0xffa3b8d0 T0) ==4165420==The signal is caused by a READ memory access. ==4165420==Hint: this fault was caused by a dereference of a high value address (see register values below). Disassemble the provided pc to learn which register was used. ``` The test relies on an unaligned access, which cannot work on a strict-alignment target like SPARC. Thus this patch skips the test. Tested on `sparc64-unknown-linux-gnu`.
34 lines
1.3 KiB
C
34 lines
1.3 KiB
C
// Test that we can properly report an ODR violation between an instrumented
|
|
// global and a non-instrumented global if not using private aliases.
|
|
|
|
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib1 -DFILE1
|
|
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=0 -o %dynamiclib2 -DFILE2
|
|
// RUN: %clang_asan -fcommon %s -fPIE %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
|
|
// RUN: not %run %t 2>&1 | FileCheck %s
|
|
|
|
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib1 -DFILE1
|
|
// RUN: %clang_asan -fcommon %s -fPIC -shared -mllvm -asan-use-private-alias=1 -o %dynamiclib2 -DFILE2
|
|
// RUN: %run %t 2>&1 | count 0
|
|
|
|
// Unaligned accesses don't work on strict-alignment targets like SPARC.
|
|
// UNSUPPORTED: sparc-target-arch
|
|
|
|
// CHECK: The following global variable is not properly aligned.
|
|
// CHECK: ERROR: AddressSanitizer: odr-violation
|
|
#if defined(FILE1)
|
|
__attribute__((aligned(8))) int x;
|
|
__attribute__((aligned(1))) char y;
|
|
// The gold linker puts ZZZ at the start of bss (where it is aligned)
|
|
// unless we have a large alternative like Displace:
|
|
__attribute__((aligned(1))) char Displace[105];
|
|
__attribute__((aligned(1))) char ZZZ[100];
|
|
#elif defined(FILE2)
|
|
int ZZZ = 1;
|
|
#else
|
|
extern int ZZZ;
|
|
int main() {
|
|
return ZZZ;
|
|
}
|
|
#endif
|
|
|