From 28e68f9f2f61d5593b9d602ee066440ed73a3057 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 28 Jun 2013 12:13:31 +0000 Subject: [PATCH] Pass --default-arch flag to external symbolizer. Fix line lengths. llvm-svn: 185144 --- .../sanitizer_common/sanitizer_common_interceptors.inc | 6 ++++-- .../sanitizer_symbolizer_posix_libcdep.cc | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index cc28e835a4ec..7ec90da30264 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -1278,7 +1278,8 @@ INTERCEPTOR(__sanitizer_dirent *, readdir, void *dirp) { return res; } -INTERCEPTOR(int, readdir_r, void *dirp, __sanitizer_dirent *entry, __sanitizer_dirent **result) { +INTERCEPTOR(int, readdir_r, void *dirp, __sanitizer_dirent *entry, + __sanitizer_dirent **result) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, readdir_r, dirp, entry, result); int res = REAL(readdir_r)(dirp, entry, result); @@ -1308,7 +1309,8 @@ INTERCEPTOR(__sanitizer_dirent64 *, readdir64, void *dirp) { return res; } -INTERCEPTOR(int, readdir64_r, void *dirp, __sanitizer_dirent64 *entry, __sanitizer_dirent64 **result) { +INTERCEPTOR(int, readdir64_r, void *dirp, __sanitizer_dirent64 *entry, + __sanitizer_dirent64 **result) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, readdir64_r, dirp, entry, result); int res = REAL(readdir64_r)(dirp, entry, result); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc index dd6ecbb51c41..11bd212caa84 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc @@ -24,6 +24,14 @@ namespace __sanitizer { +#if defined(__x86_64__) +static const char* const kSymbolizerArch = "--default-arch=x86_64"; +#elif defined(__i386__) +static const char* const kSymbolizerArch = "--default-arch=i386"; +#else +static const char* const kSymbolizerArch = ""; +#endif + bool StartSymbolizerSubprocess(const char *path_to_symbolizer, int *input_fd, int *output_fd) { if (!FileExists(path_to_symbolizer)) { @@ -88,7 +96,7 @@ bool StartSymbolizerSubprocess(const char *path_to_symbolizer, internal_close(infd[1]); for (int fd = getdtablesize(); fd > 2; fd--) internal_close(fd); - execl(path_to_symbolizer, path_to_symbolizer, (char*)0); + execl(path_to_symbolizer, path_to_symbolizer, kSymbolizerArch, (char*)0); internal__exit(1); }