|
1 | | -From 3dae5eedd73370bad5183b5903cd0e186702fff8 Mon Sep 17 00:00:00 2001 |
2 | | - |
3 | | -Date: Fri, 18 Oct 2024 13:31:34 +0100 |
4 | | -Subject: [PATCH] Revert "[fuzzer] fix clang-cl build fuzzer lit test failure |
5 | | - (#112339)" |
6 | | - |
7 | | -This reverts commit d54953ef472bfd8d4b503aae7682aa76c49f8cc0. |
8 | | ---- |
9 | | - .../lib/fuzzer/FuzzerExtFunctionsWindows.cpp | 28 +++++++++---------- |
10 | | - 1 file changed, 14 insertions(+), 14 deletions(-) |
11 | | - |
12 | 1 | diff --git a/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWindows.cpp b/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWindows.cpp |
13 | | -index dfc32ac9db2979..688bad1d51ca5b 100644 |
| 2 | +index dfc32ac9db29..7d0c7573f2e0 100644 |
14 | 3 | --- a/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWindows.cpp |
15 | 4 | +++ b/compiler-rt/lib/fuzzer/FuzzerExtFunctionsWindows.cpp |
16 | | -@@ -22,11 +22,6 @@ using namespace fuzzer; |
17 | | - #define STRINGIFY(A) STRINGIFY_(A) |
18 | | - |
| 5 | +@@ -24,7 +24,7 @@ using namespace fuzzer; |
19 | 6 | #if LIBFUZZER_MSVC |
20 | | --#define GET_FUNCTION_ADDRESS(fn) &fn |
21 | | --#else |
| 7 | + #define GET_FUNCTION_ADDRESS(fn) &fn |
| 8 | + #else |
22 | 9 | -#define GET_FUNCTION_ADDRESS(fn) __builtin_function_start(fn) |
23 | | --#endif // LIBFUZER_MSVC |
24 | | -- |
25 | | - // Copied from compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h |
26 | | - #if defined(_M_IX86) || defined(__i386__) |
27 | | - #define WIN_SYM_PREFIX "_" |
28 | | -@@ -36,9 +31,17 @@ using namespace fuzzer; |
29 | | - |
30 | | - // Declare external functions as having alternativenames, so that we can |
31 | | - // determine if they are not defined. |
32 | | --#define EXTERNAL_FUNC(Name, Default) \ |
33 | | -- __pragma(comment(linker, "/alternatename:" WIN_SYM_PREFIX STRINGIFY( \ |
34 | | -+#define EXTERNAL_FUNC(Name, Default) \ |
35 | | -+ __pragma(comment(linker, "/alternatename:" WIN_SYM_PREFIX STRINGIFY( \ |
36 | | - Name) "=" WIN_SYM_PREFIX STRINGIFY(Default))) |
37 | | -+#else |
38 | | -+// Declare external functions as weak to allow them to default to a specified |
39 | | -+// function if not defined explicitly. We must use weak symbols because clang's |
40 | | -+// support for alternatename is not 100%, see |
41 | | -+// https://bugs.llvm.org/show_bug.cgi?id=40218 for more details. |
42 | | -+#define EXTERNAL_FUNC(Name, Default) \ |
43 | | -+ __attribute__((weak, alias(STRINGIFY(Default)))) |
44 | | -+#endif // LIBFUZZER_MSVC |
45 | | - |
46 | | - extern "C" { |
47 | | - #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ |
48 | | -@@ -54,23 +57,20 @@ extern "C" { |
49 | | - } |
50 | | - |
51 | | - template <typename T> |
52 | | --static T *GetFnPtr(void *Fun, void *FunDef, const char *FnName, |
53 | | -- bool WarnIfMissing) { |
54 | | -+static T *GetFnPtr(T *Fun, T *FunDef, const char *FnName, bool WarnIfMissing) { |
55 | | - if (Fun == FunDef) { |
56 | | - if (WarnIfMissing) |
57 | | - Printf("WARNING: Failed to find function \"%s\".\n", FnName); |
58 | | - return nullptr; |
59 | | - } |
60 | | -- return (T *)Fun; |
61 | | -+ return Fun; |
62 | | - } |
63 | | - |
64 | | - namespace fuzzer { |
65 | | - |
66 | | - ExternalFunctions::ExternalFunctions() { |
67 | | --#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ |
68 | | -- this->NAME = GetFnPtr<decltype(::NAME)>(GET_FUNCTION_ADDRESS(::NAME), \ |
69 | | -- GET_FUNCTION_ADDRESS(::NAME##Def), \ |
70 | | -- #NAME, WARN); |
71 | | -+#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ |
72 | | -+ this->NAME = GetFnPtr<decltype(::NAME)>(::NAME, ::NAME##Def, #NAME, WARN); |
73 | | - |
74 | | - #include "FuzzerExtFunctions.def" |
| 10 | ++#define GET_FUNCTION_ADDRESS(fn) (void *)fn |
| 11 | + #endif // LIBFUZER_MSVC |
75 | 12 |
|
| 13 | + // Copied from compiler-rt/lib/sanitizer_common/sanitizer_win_defs.h |
0 commit comments