[Sanitizer] Fix mac build.

llvm-svn: 158141
This commit is contained in:
Alexey Samsonov 2012-06-07 07:32:00 +00:00
parent 4b1f1031e6
commit cf4d3a027d
5 changed files with 6 additions and 8 deletions

View File

@ -41,8 +41,6 @@ extern "C" void* _DYNAMIC;
namespace __asan {
const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M
void *AsanDoesNotSupportStaticLinkage() {
// This will fail to link with -static.
return &_DYNAMIC; // defined in link.h

View File

@ -28,7 +28,7 @@ const uptr kPageSize = 1UL << kPageSizeBits;
// Threads
int GetPid();
void GetThreadStackTopAndBottom(bool is_main_thread, uptr *stack_top,
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom);
// Memory management

View File

@ -73,12 +73,12 @@ int internal_dup2(int oldfd, int newfd) {
}
// ----------------- sanitizer_common.h
void GetThreadStackTopAndBottom(bool is_main_thread, uptr *stack_top,
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
static const uptr kMaxThreadStackSize = 256 * (1 << 20); // 256M
CHECK(stack_top);
CHECK(stack_bottom);
if (is_main_thread) {
if (at_initialization) {
// This is the main thread. Libpthread may not be initialized yet.
struct rlimit rl;
CHECK(getrlimit(RLIMIT_STACK, &rl) == 0);

View File

@ -70,14 +70,14 @@ int internal_dup2(int oldfd, int newfd) {
}
// ----------------- sanitizer_common.h
void GetThreadStackTopAndBottom(bool is_main_thread, uptr *stack_top,
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
CHECK(stack_top);
CHECK(stack_bottom);
uptr stacksize = pthread_get_stacksize_np(pthread_self());
void *stackaddr = pthread_get_stackaddr_np(pthread_self());
*stack_top = (uptr)stackaddr;
*stack_bottom = stack_top_ - stacksize;
*stack_bottom = *stack_top - stacksize;
}

View File

@ -24,7 +24,7 @@ int GetPid() {
return GetProcessId(GetCurrentProcess());
}
void GetThreadStackTopAndBottom(bool is_main_thread, uptr *stack_top,
void GetThreadStackTopAndBottom(bool at_initialization, uptr *stack_top,
uptr *stack_bottom) {
CHECK(stack_top);
CHECK(stack_bottom);