1 /// Same as global-location.cpp, but without debuginfo. In a separate file to 2 /// allow this test to also run on Windows (which can't be done for the 3 /// debuginfo variant). 4 5 // RUN: %clangxx_asan -O2 %S/global-location.cpp -o %t -Wl,-S 6 // RUN: not %run %t g 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=GLOB-NO-G 7 // RUN: not %run %t c 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CLASS_STATIC-NO-G 8 // RUN: not %run %t f 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=FUNC_STATIC-NO-G 9 // RUN: not %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=LITERAL-NO-G 10 11 /// Solaris ld -S has different semantics. 12 // XFAIL: solaris 13 14 /// MSVC linker doesn't support `-S`. 15 // UNSUPPORTED: windows 16 17 // CHECK: AddressSanitizer: global-buffer-overflow 18 // CLASS_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}C::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 19 // GLOB-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}global{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 20 // FUNC_STATIC-NO-G: 0x{{.*}} is located 4 bytes to the right of global variable '{{.*}}main::array{{.*}}' defined in '{{.*}}global-location.cpp' {{.*}} of size 40 21 // LITERAL-NO-G: 0x{{.*}} is located 0 bytes to the right of global variable {{.*}} defined in '{{.*}}global-location.cpp' {{.*}} of size 11 22 // CHECK: SUMMARY: AddressSanitizer: global-buffer-overflow 23