Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable emulated-tls for compiler-rt+tests on Android if ELF_TLS is p…
…resence. This is necessary for enabling LSAN on Android (D89251) because: - LSAN will have false negatives if run with emulated-tls. - Bionic ELF-TLS is not compatible with Gold (hence the need for LLD) Differential Revision: https://reviews.llvm.org/D89615
- Loading branch information
Showing
5 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
compiler-rt/test/sanitizer_common/TestCases/Linux/use_tls_test.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Test that executable with ELF-TLS will link/run successfully on aarch64 | ||
// RUN: %clangxx -fno-emulated-tls %s -o %t | ||
// RUN: %run %t 2>&1 | ||
// REQUIRES: android-28 | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
__thread void *tls_var; | ||
int var; | ||
|
||
void set_var() { | ||
var = 123; | ||
tls_var = &var; | ||
} | ||
int main() { | ||
set_var(); | ||
fprintf(stderr, "Test alloc: %p\n", tls_var); | ||
fflush(stderr); | ||
return 0; | ||
} |