Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void MemoryMappingLayout::Reset() {
// The dyld load address should be unchanged throughout process execution,
// and it is expensive to compute once many libraries have been loaded,
// so cache it here and do not reset.
static mach_header *dyld_hdr = 0;
static const mach_header* dyld_hdr = 0;
static const char kDyldPath[] = "/usr/lib/dyld";
static const int kDyldImageIdx = -1;

Expand Down Expand Up @@ -244,14 +244,18 @@ extern intptr_t _dyld_get_image_slide(const struct mach_header* mh);
extern int dyld_shared_cache_iterate_text(
const uuid_t cacheUuid,
void (^callback)(const dyld_shared_cache_dylib_text_info *info));
SANITIZER_WEAK_IMPORT const struct mach_header* _dyld_get_dyld_header(void);
} // extern "C"

static mach_header *GetDyldImageHeaderViaSharedCache() {
static const mach_header* GetDyldImageHeaderViaSharedCache() {
uuid_t uuid;
bool hasCache = _dyld_get_shared_cache_uuid(uuid);
if (!hasCache)
return nullptr;

if (&_dyld_get_dyld_header != nullptr)
return _dyld_get_dyld_header();

size_t cacheLength;
__block uptr cacheStart = (uptr)_dyld_get_shared_cache_range(&cacheLength);
CHECK(cacheStart && cacheLength);
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/sanitizer_common/weak_symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ ___sanitizer_symbolize_demangle
___sanitizer_symbolize_flush
___sanitizer_symbolize_set_demangle
___sanitizer_symbolize_set_inline_frames
__dyld_get_dyld_header
2 changes: 1 addition & 1 deletion compiler-rt/lib/tsan/go/buildgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ elif [ "$GOOS" = "netbsd" ]; then
"
elif [ "$GOOS" = "darwin" ]; then
OSCFLAGS="-fPIC -Wno-unused-const-variable -Wno-unknown-warning-option -mmacosx-version-min=10.7"
OSLDFLAGS="-lpthread -fPIC -fpie -mmacosx-version-min=10.7"
OSLDFLAGS="-lpthread -fPIC -fpie -mmacosx-version-min=10.7 -Wl,-U,__dyld_get_dyld_header"
SRCS="
$SRCS
../rtl/tsan_platform_mac.cpp
Expand Down
Loading