[all-commits] [llvm/llvm-project] 4c0769: Build ASAN libraries with /MD instead of /MT on wi...
Charlie Barto via All-commits
all-commits at lists.llvm.org
Fri Sep 6 18:40:30 PDT 2024
Branch: refs/heads/users/chbarto/test_onedll
Home: https://github.com/llvm/llvm-project
Commit: 4c0769ce7af84600de069cb25e9ba5ceda7affa8
https://github.com/llvm/llvm-project/commit/4c0769ce7af84600de069cb25e9ba5ceda7affa8
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/CMakeLists.txt
M compiler-rt/lib/profile/CMakeLists.txt
Log Message:
-----------
Build ASAN libraries with /MD instead of /MT on winodws
The profiling runtime is still built with /MT, as it does not work with
/MD (and not well supported on windows)
Co-authored-by: Amy Wishnousky <amyw at microsoft.com>
Commit: d51cbaa10a61f9ba3e99883bc71e75403abf582a
https://github.com/llvm/llvm-project/commit/d51cbaa10a61f9ba3e99883bc71e75403abf582a
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/CMakeLists.txt
M compiler-rt/lib/asan/asan_globals_win.cpp
A compiler-rt/lib/asan/asan_malloc_win_thunk.cpp
A compiler-rt/lib/asan/asan_win_common_runtime_thunk.cpp
A compiler-rt/lib/asan/asan_win_common_runtime_thunk.h
R compiler-rt/lib/asan/asan_win_dll_thunk.cpp
M compiler-rt/lib/asan/asan_win_dynamic_runtime_thunk.cpp
A compiler-rt/lib/asan/asan_win_static_runtime_thunk.cpp
M compiler-rt/lib/sanitizer_common/CMakeLists.txt
M compiler-rt/lib/sanitizer_common/sanitizer_common_interface.inc
R compiler-rt/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cpp
R compiler-rt/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_coverage_win_runtime_thunk.cpp
R compiler-rt/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cpp
R compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.h
R compiler-rt/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_win_immortalize.h
A compiler-rt/lib/sanitizer_common/sanitizer_win_interception.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_win_interception.h
A compiler-rt/lib/sanitizer_common/sanitizer_win_runtime_thunk.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.cpp
A compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
R compiler-rt/lib/sanitizer_common/sanitizer_win_weak_interception.cpp
R compiler-rt/lib/sanitizer_common/sanitizer_win_weak_interception.h
M compiler-rt/lib/ubsan/CMakeLists.txt
R compiler-rt/lib/ubsan/ubsan_win_dll_thunk.cpp
R compiler-rt/lib/ubsan/ubsan_win_dynamic_runtime_thunk.cpp
A compiler-rt/lib/ubsan/ubsan_win_runtime_thunk.cpp
R compiler-rt/lib/ubsan/ubsan_win_weak_interception.cpp
Log Message:
-----------
Remove the static ASAN runtimes
Instead build only ONE asan runtime on windows.
File Overview:
* asan_malloc_win_thunk.cpp
Contains interceptors for malloc/free for applications using the static CRT.
These are intercepted with an oldnames style library that takes precedence
over the CRT because of linker search order. This is used instead of
the library interception routines used for other functions so that we
can intercept mallocs that happen before our interceptors run. Some
other CRT functions are also included here, because they are provided by the same
objects as allocation functions in the debug CRT.
* asan_win_common_runtime_thunk.cpp
just the common init code for both static and dynamic CRTs
* asan_win_static_runtime_thunk.cpp
static CRT specific initialization
* asan_win_dynamic_runtime_thunk.cpp
dynamic crt initialization, most of the content that was here
has been moved to the common runtime thunk
* asan_win_dll_thunk.cpp
This used to provide functionality to redirect
calls from DLLs to asan instrumented functions in the main library,
but this never worked that well and was a nightmare. It's gone now
* sanitizer_common/sanitizer_common_interface.inc:
The added functions are for the thunks to be able to delegate to the
asan runtime DLL in order to override functions that live in the application
executable at initialization. The ASAN dll can't do this itself because it
doesn't have a way to get the addresses of these functions.
* sanitizer_common/sanitizer_win_immortalize:
This is just an implementation of call_once that doens't require the CRT
or C++ stdlib. We need this because we need to do this sort of thing
before the CRT has initialized. This infrastructure is kinda ugly, we're sorry.
* sanitizer_common/sanitizer_win_interception.cpp:
Provides the interface inside the sanitizer runtime DLL that instramented apps
call to intercept stuff.
* sanitizer_common/sanitizer_win_thunk_interception.cpp:
this is the code to setup and run the static initializers and/or TLS
initializers, implemented basically how any initializers are on windows,
these ones are registered before all the CRT initializers.
* sanitizer_common/sanitizer_win_thunk_interception.h
INTERCEPT_LIBRARY_FUNCTION and REGISTER_WEAK_FUNCTION
are the called initializers for each relevant function inside the instrumented
binary. Note the optimizer is disabled for weak function registration routines
because it detects that the two functions being compared have different names
and deduces they must be the same, and no actual codegen for the if is required,
causing an infinite loop. Clang does this in debug mode as well as release mode,
and the cast to uintptr_t is required to suppress it in debug mode.
Co-Authored-By: Amy Wishnousky <amyw at microsoft.com>
Commit: a3410261ec8312d4eddb506631c8536dc6a13ee9
https://github.com/llvm/llvm-project/commit/a3410261ec8312d4eddb506631c8536dc6a13ee9
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M clang/lib/Driver/SanitizerArgs.cpp
Log Message:
-----------
make it an error to pass -static-libsan on windows and make shared the default.
Commit: 998f586cc6d6aa72c513f78ada4db07648d9f067
https://github.com/llvm/llvm-project/commit/998f586cc6d6aa72c513f78ada4db07648d9f067
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M clang/lib/Driver/ToolChains/MSVC.cpp
Log Message:
-----------
Teach the MSVC toolchain driver to link the correct asan libraries.
Now that the static runtime is gone the required librares are different.
Note that /MD or -D_DLL causes the dynamic runtime to get linked,
this is a little gross but emulates the behavior of MSVC.
"Real" msvc will link the debug build of asan if you specify /DEBUG or _DEBUG,
but that's not really necessary and requires building multiple
configurations from the same tree.
Commit: f10eae89dbdb6ba638fc9900feb090c48dc3b3ac
https://github.com/llvm/llvm-project/commit/f10eae89dbdb6ba638fc9900feb090c48dc3b3ac
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/asan_flags.cpp
Log Message:
-----------
Because all DLLs get initialized before the main module
weak functions are registered after the asan runtime initializes.
This means __asan_default_options isn't available during asan
runtime initialization. Thus we split asan flag processing into
two parts and register a callback for the second part that's
executed after __asan_default_options is registered.
Co-Authored-By: Amy Wishnousky <amyw at microsoft.com>
Commit: 675e9acba9e394a65c57567f806910218274f9ee
https://github.com/llvm/llvm-project/commit/675e9acba9e394a65c57567f806910218274f9ee
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/asan_malloc_win.cpp
Log Message:
-----------
Clean up asan_malloc_win.cpp and add exports
ALLOCATION_FUNCTION_ATTRIBUTE wasn't used elsewhere, and was just one
attribute, so abstracting it through a macro wasn't doing much good now that it's
not conditional on runtime type.
We're always in the dynamic runtime now so eliminate the preprocessor conditional.
The new exported functions are the interface used by the intercepted malloc/free family
in the instrumented binary to call the asan versions inside the dll runtime.
Co-authored-by: Amy Wishnousky <amyw at microsoft.com>
Commit: 95a96da1db11890fbf4df87034deb39dc9f2045c
https://github.com/llvm/llvm-project/commit/95a96da1db11890fbf4df87034deb39dc9f2045c
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/test/asan/lit.cfg.py
Log Message:
-----------
add new substitutions to the tests to support the new static/dynamic runtime thunks
and the fact we're "always" using the dynamic asan runtime.
python formatting
Commit: 869bd5bf0b9422e6918fabdade6b640b8dbd3ba7
https://github.com/llvm/llvm-project/commit/869bd5bf0b9422e6918fabdade6b640b8dbd3ba7
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/asan_win_static_runtime_thunk.cpp
Log Message:
-----------
intercept atoll for the static runtime.
Commit: e3cf86e21dae2e6bd62ff7f351f160350e4348af
https://github.com/llvm/llvm-project/commit/e3cf86e21dae2e6bd62ff7f351f160350e4348af
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/CMakeLists.txt
Log Message:
-----------
Remove sanitizer_win_dll_thunk.h from the build
Commit: b7dca2845333b63d20fd71fe14179649bcda5af1
https://github.com/llvm/llvm-project/commit/b7dca2845333b63d20fd71fe14179649bcda5af1
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/test/asan/TestCases/Darwin/interface_symbols_darwin.cpp
M compiler-rt/test/asan/TestCases/Linux/interface_symbols_linux.cpp
Log Message:
-----------
exclude windows specific interface symbols from linux/darwin tests.
Commit: 1d9725472c730fe3b56aa0fd9ad51d5a5f630e27
https://github.com/llvm/llvm-project/commit/1d9725472c730fe3b56aa0fd9ad51d5a5f630e27
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M clang/test/Driver/cl-link.c
Log Message:
-----------
correct asan library checks in clang driver tests.
Commit: f35df51dc3a841e9a9366f099b2e9bd2ca8f854b
https://github.com/llvm/llvm-project/commit/f35df51dc3a841e9a9366f099b2e9bd2ca8f854b
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
R compiler-rt/lib/sanitizer_common/sanitizer_win_dll_thunk.cpp
R compiler-rt/lib/sanitizer_common/sanitizer_win_runtime_thunk.cpp
Log Message:
-----------
remove unused files from asan windows build
Commit: 6d72c92fb14028d1240590439c7139c493c54aa3
https://github.com/llvm/llvm-project/commit/6d72c92fb14028d1240590439c7139c493c54aa3
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/CMakeLists.txt
Log Message:
-----------
Clean up wording of comment in compiler-rt cmakelists file
Commit: 30e4174ab0b280784c3c0079884d924a7fd3034e
https://github.com/llvm/llvm-project/commit/30e4174ab0b280784c3c0079884d924a7fd3034e
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
Log Message:
-----------
rename sanitizer_win_thunk_interception.h header guard
Commit: 05d982b6a905e0820685de4c16b1d142b648419c
https://github.com/llvm/llvm-project/commit/05d982b6a905e0820685de4c16b1d142b648419c
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/test/asan/TestCases/Windows/free_hook_realloc.cpp
M compiler-rt/test/asan/TestCases/Windows/msvc/dll_and_lib.cpp
M compiler-rt/test/asan/TestCases/Windows/msvc/dll_large_function.cpp
M compiler-rt/test/asan/TestCases/Windows/unsymbolized.cpp
M compiler-rt/test/asan/TestCases/debug_double_free.cpp
M compiler-rt/test/asan/TestCases/debug_report.cpp
M compiler-rt/test/asan/TestCases/default_options.cpp
M compiler-rt/test/asan/TestCases/on_error_callback.cpp
M compiler-rt/test/asan/TestCases/report_error_summary.cpp
Log Message:
-----------
Test fixups requiring functional changes
These test changes are seperated from the test changes in
0360f3218a13666123849f6699216bdbebe64833 because they require
various functional changes to asan.
This reverts commit f54e0b4dbf12a155350c53193a42115ec9210587.
Commit: 0b749a214aefff96c148e186d6ca162c7d2ada92
https://github.com/llvm/llvm-project/commit/0b749a214aefff96c148e186d6ca162c7d2ada92
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/test/asan/lit.cfg.py
Log Message:
-----------
Add the compiler-rt libdir to path for lit in both static and dynamic config
After the windows static runtime is removed these static=static CRT and dynamic=dynamic CRT, both using the dynamic asan runtime.
Commit: 6b1c6226158a43ae14252b66068274d9f3eac514
https://github.com/llvm/llvm-project/commit/6b1c6226158a43ae14252b66068274d9f3eac514
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/tests/CMakeLists.txt
Log Message:
-----------
Pass -D_DLL and -D_MT to the linker for tests
This is required because now that there's only one asan runtime dll
the dynamic/static CRT wholearchived runtime thunk "flavor"
is determined by passing the /MD or /MDd options, or defining -D_DLL.
Commit: 8607602374865ddaf7930b2a9b931db7bc482333
https://github.com/llvm/llvm-project/commit/8607602374865ddaf7930b2a9b931db7bc482333
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
Log Message:
-----------
clang-format
Commit: ed8221cf4de88e07d11e27c02bbb60b236fbc190
https://github.com/llvm/llvm-project/commit/ed8221cf4de88e07d11e27c02bbb60b236fbc190
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/test/asan/TestCases/Windows/double_free.cpp
M compiler-rt/test/asan/TestCases/Windows/malloc_left_oob.cpp
M compiler-rt/test/asan/TestCases/Windows/malloc_right_oob.cpp
M compiler-rt/test/asan/TestCases/Windows/malloc_uaf.cpp
M compiler-rt/test/asan/TestCases/Windows/realloc_left_oob.cpp
M compiler-rt/test/asan/TestCases/Windows/realloc_right_oob.cpp
M compiler-rt/test/asan/TestCases/Windows/realloc_uaf.cpp
M compiler-rt/test/asan/TestCases/Windows/symbols_path.cpp
M compiler-rt/test/asan/TestCases/Windows/use_after_realloc.cpp
Log Message:
-----------
[asan][windows] Yet more relaxation of tests
Commit: e8c28074e9bf2db996b73607c1f9baa627be1ff4
https://github.com/llvm/llvm-project/commit/e8c28074e9bf2db996b73607c1f9baa627be1ff4
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
Log Message:
-----------
[LLVM 19] don't optimize register_weak_<whatever> when building with msvc
Commit: 4f72a1e96e7e5aef936452edbb943d403152aebc
https://github.com/llvm/llvm-project/commit/4f72a1e96e7e5aef936452edbb943d403152aebc
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/lib/asan/CMakeLists.txt
Log Message:
-----------
ensure the asan runtime is always linked with /OPT:NOICF on windows, which is requried for weak exports to function correctly
Commit: 75239e2d3c66c1a2521e154392498ae45abad350
https://github.com/llvm/llvm-project/commit/75239e2d3c66c1a2521e154392498ae45abad350
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
R compiler-rt/lib/asan/asan_win_weak_interception.cpp
Log Message:
-----------
delete asan_win_weak_interception, which was unused
Commit: 3667ecd4735b1309efd0d644409673f906d1bdb1
https://github.com/llvm/llvm-project/commit/3667ecd4735b1309efd0d644409673f906d1bdb1
Author: Charlie Barto <chbarto at microsoft.com>
Date: 2024-09-06 (Fri, 06 Sep 2024)
Changed paths:
M compiler-rt/CMakeLists.txt
M compiler-rt/lib/asan/CMakeLists.txt
M compiler-rt/lib/asan/tests/CMakeLists.txt
M compiler-rt/lib/interception/CMakeLists.txt
M compiler-rt/lib/sanitizer_common/CMakeLists.txt
Log Message:
-----------
set the C runtime linkage to /MD only for sanitizer_common, interception, and asan. Keep the other sanitizers as /MT since they don't support OneDLL
Compare: https://github.com/llvm/llvm-project/compare/4c0769ce7af8%5E...3667ecd4735b
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list