Author: Martin Storsjö Date: 2021-01-08T22:54:03+02:00 New Revision: ffac9001d987096537b94ed7a1e4e4a4665d571f
URL: https://github.com/llvm/llvm-project/commit/ffac9001d987096537b94ed7a1e4e4a4665d571f DIFF: https://github.com/llvm/llvm-project/commit/ffac9001d987096537b94ed7a1e4e4a4665d571f.diff LOG: [compiler-rt] [sanitizer] Silence -Wframe-larger-than= for a few windows functions with large stack buffers Also update a documentation url while touching code nearby, as requested in review. Differential Revision: https://reviews.llvm.org/D91853 Added: Modified: compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp compiler-rt/lib/sanitizer_common/sanitizer_win.cpp Removed: ################################################################################ diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp index 48fa2d1033ae..7db7d3b0eb9d 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp @@ -133,10 +133,14 @@ void InitializeDbgHelpIfNeeded() { } } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wframe-larger-than=" +#endif bool WinSymbolizerTool::SymbolizePC(uptr addr, SymbolizedStack *frame) { InitializeDbgHelpIfNeeded(); - // See http://msdn.microsoft.com/en-us/library/ms680578(VS.85).aspx + // See https://docs.microsoft.com/en-us/windows/win32/debug/retrieving-symbol-information-by-address char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(CHAR)]; PSYMBOL_INFO symbol = (PSYMBOL_INFO)buffer; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); @@ -162,6 +166,9 @@ bool WinSymbolizerTool::SymbolizePC(uptr addr, SymbolizedStack *frame) { // Otherwise, try llvm-symbolizer. return got_fileline; } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif const char *WinSymbolizerTool::Demangle(const char *name) { CHECK(is_dbghelp_initialized); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp index e2edf428004e..7e01c81d0422 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_unwind_win.cpp @@ -43,6 +43,10 @@ void BufferedStackTrace::UnwindSlow(uptr pc, u32 max_depth) { trace_buffer[0] = pc; } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wframe-larger-than=" +#endif void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) { CHECK(context); CHECK_GE(max_depth, 2); @@ -74,6 +78,9 @@ void BufferedStackTrace::UnwindSlow(uptr pc, void *context, u32 max_depth) { trace_buffer[size++] = (uptr)stack_frame.AddrPC.Offset; } } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #endif // #if !SANITIZER_GO #endif // SANITIZER_WINDOWS diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp index 281854aff261..63c90785f270 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -611,6 +611,10 @@ static uptr GetPreferredBase(const char *modname) { return (uptr)pe_header->ImageBase; } +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wframe-larger-than=" +#endif void ListOfModules::init() { clearOrInit(); HANDLE cur_process = GetCurrentProcess(); @@ -672,6 +676,9 @@ void ListOfModules::init() { } UnmapOrDie(hmodules, modules_buffer_size); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif void ListOfModules::fallbackInit() { clear(); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits