Use alternatename for external functions only when using
MSVC since Clang doesn't support it and MSVC doesn't support
Clang's method (weak aliases).
Details
Diff Detail
- Build Status
Buildable 26805 Build 26804: arc lint + arc unit
Event Timeline
Matt could you please take a look?
For context, this patch is part of a series that I am trying to land to get libFuzzer working when compiled by MSVC.
@rnk or @thakis what do you think of this workaround for this bug I came up with?
I tried using things like volatile loads of the function pointers to prevent the optimizer from getting in the way, but I couldn't come up with a reliable solution, so I decided not to use alternatename when using clang.
compiler-rt/lib/fuzzer/FuzzerExtFunctionsAlternatename.cpp | ||
---|---|---|
38 ↗ | (On Diff #180931) | Maybe move the above macros into FuzzerDefs.h or create a FuzzerWinDefs.h. Then FuzzerExtFunctionsAlternatename.cpp is unneeded, and we can reuse FuzzerExtFunctionsWeakAlias.cpp. |
compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeakAlias.cpp | ||
0 | This attribute could also become a macro in FuzzerDefs.h or FuzzerWinDefs.h |
compiler-rt/lib/fuzzer/FuzzerExtFunctionsAlternatename.cpp | ||
---|---|---|
38 ↗ | (On Diff #180931) | What do you think of moving them both into a single file FuzzerExtFunctionsWin.cpp? |
compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeakAlias.cpp | ||
0 | If you agree with my above comment to create FuzzerExtFunctionsWin.cpp, then what do you think of just defining this as a macro in that file? |
compiler-rt/lib/fuzzer/FuzzerExtFunctionsWeakAlias.cpp | ||
---|---|---|
0 | SGTM |
Let's move all the macros outside of the extern "C" block except for the EXT_FUNC definition.