-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][MinGW] Add asan DLL lib before other libs and objects
As stated in #61685, by passing LLD the import lib of the asan DLL first, the asan DLL will be listed as the first entry in the Import Directory Table, making it be loaded first before other user DLLs. This allows asan to be initialized as early as possible to increase its instrumentation coverage to include other DLLs not built with asan. This also avoids some false asan reports on `realloc` for memory allocated during initialization of user DLLs being loaded earlier than asan, because after this change they will be loaded later than asan. Differential Revision: https://reviews.llvm.org/D146908
- Loading branch information
1 parent
2abdc0f
commit 81358e9
Showing
2 changed files
with
26 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-I686 %s | ||
// ASAN-I686: "{{.*}}libclang_rt.asan_dynamic-i386.dll.a" | ||
// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" | ||
// ASAN-I686: "--require-defined" "___asan_seh_interceptor" | ||
// ASAN-I686: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" "--no-whole-archive" | ||
|
||
// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-X86_64 %s | ||
// ASAN-X86_64: "{{.*}}libclang_rt.asan_dynamic-x86_64.dll.a" | ||
// RUN: touch %t.a | ||
// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s | ||
// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s | ||
// | ||
// ASAN-ALL-NOT:"-l{{[^"]+"]}}" | ||
// ASAN-ALL-NOT:"[[INPUT]]" | ||
// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic-i386.dll.a" | ||
// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic-x86_64.dll.a" | ||
// ASAN-ALL: "-lcomponent" | ||
// ASAN-ALL: "[[INPUT]]" | ||
// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic-i386.dll.a" | ||
// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" | ||
// ASAN-I686: "--require-defined" "___asan_seh_interceptor" | ||
// ASAN-I686: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" "--no-whole-archive" | ||
// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic-x86_64.dll.a" | ||
// ASAN-X86_64: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" | ||
// ASAN-X86_64: "--require-defined" "__asan_seh_interceptor" | ||
// ASAN-X86_64: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" "--no-whole-archive" | ||
// ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-x86_64.a" "--no-whole-archive" | ||
|
||
// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=vptr |