[compiler-rt] [asan][win][msvc] override new and delete and seperate TUs (PR #68754)

Charlie Barto via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 13:47:08 PST 2023


================
@@ -0,0 +1,51 @@
+//===-- asan_win_thunk_common.h  --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of AddressSanitizer, an address sanity checker.
+//
+// Windows-specific common utilities to communicate between static and DLL
+// portions of the ASAN runtime.
+//
+// This file must not include any core components of the ASAN runtime as it must
+// be able to be included in the portions statically linked with the user
+// program.
+//
+//===----------------------------------------------------------------------===//
+
+#pragma once
+#include <sanitizer_common/sanitizer_internal_defs.h>
+namespace __sanitizer {
+
+__declspec(noinline) inline __sanitizer::uptr __asan_GetCurrentPc() {
+  return GET_CALLER_PC();
+}
+
+struct __asan_win_stack_data {
----------------
barcharcraz wrote:

The trouble is that without the stack trace changes the top of the captured stack trace won't be operator new anymore, thus breaking tests. Alternatively we could just eliminate asan_win_new_delete and put the operator bodies in the import library, but that would be a bunch of new code that we'd have to undo in order to move them back to the dll later.

I've fixed most of the tests, I'll fix the last few and then push it and you can see what you think

https://github.com/llvm/llvm-project/pull/68754


More information about the llvm-commits mailing list