Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Commit

Permalink
Fix compilation of sanitizers on Linux
Browse files Browse the repository at this point in the history
Dunno why it's necessary, but seems not bad? Who knows!
  • Loading branch information
alexcrichton committed Apr 8, 2019
1 parent 0c9c55c commit d85fb9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/asan/asan_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void AsanCheckIncompatibleRT() {
// the functions in dynamic ASan runtime instead of the functions in
// system libraries, causing crashes later in ASan initialization.
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
char filename[PATH_MAX];
char filename[4096];
MemoryMappedSegment segment(filename, sizeof(filename));
while (proc_maps.Next(&segment)) {
if (IsDynamicRTName(segment.filename)) {
Expand Down
6 changes: 1 addition & 5 deletions lib/sanitizer_common/sanitizer_linux_libcdep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,8 @@ u32 GetNumberOfCPUs() {
}
internal_close(fd);
return n_cpus;
#elif SANITIZER_SOLARIS
return sysconf(_SC_NPROCESSORS_ONLN);
#else
cpu_set_t CPUs;
CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
return CPU_COUNT(&CPUs);
return sysconf(_SC_NPROCESSORS_ONLN);
#endif
}

Expand Down
7 changes: 4 additions & 3 deletions lib/sanitizer_common/sanitizer_platform_limits_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ typedef struct user_fpregs elf_fpregset_t;
#endif

#if SANITIZER_LINUX && !SANITIZER_ANDROID
#include <stdio.h>
#include <glob.h>
#include <obstack.h>
#include <mqueue.h>
Expand Down Expand Up @@ -1011,9 +1012,9 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
#endif

#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
CHECK_TYPE_SIZE(mmsghdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
// CHECK_TYPE_SIZE(mmsghdr);
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
#endif

COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
Expand Down

0 comments on commit d85fb9e

Please sign in to comment.