summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/interception/interception_win.cc
diff options
context:
space:
mode:
authorEtienne Bergeron <etienneb@google.com>2016-05-27 21:29:31 +0000
committerEtienne Bergeron <etienneb@google.com>2016-05-27 21:29:31 +0000
commit00f3f6e296d49eb261e1ad47868a50122bfc111e (patch)
treecc4f3911fe57c82e871eafa07de3e02e614256cb /compiler-rt/lib/interception/interception_win.cc
parent0364f67f61bdb322972e59c3483612945bc980bc (diff)
downloadbcm5719-llvm-00f3f6e296d49eb261e1ad47868a50122bfc111e.tar.gz
bcm5719-llvm-00f3f6e296d49eb261e1ad47868a50122bfc111e.zip
This patch is activating the build of Asan on Windows 64-bits.
It's fixing compilation errors. The runtime is not yet working. Missing features: OverrideFunction for x64 an equiv function for inline asm (atomic_compare_exchange_strong) shadow memory offset needs to be adjusted RoundUpToInstrBoundary for x64 They will be implemented by subsequent patches. Patch by Wei Wang. Differential revision: http://reviews.llvm.org/D20455 llvm-svn: 271049
Diffstat (limited to 'compiler-rt/lib/interception/interception_win.cc')
-rw-r--r--compiler-rt/lib/interception/interception_win.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/compiler-rt/lib/interception/interception_win.cc b/compiler-rt/lib/interception/interception_win.cc
index 89d52b053eb..4bc42e8e661 100644
--- a/compiler-rt/lib/interception/interception_win.cc
+++ b/compiler-rt/lib/interception/interception_win.cc
@@ -36,7 +36,7 @@ static void _memcpy(void *dst, void *src, size_t sz) {
}
static void WriteJumpInstruction(char *jmp_from, char *to) {
- // jmp XXYYZZWW = E9 WW ZZ YY XX, where XXYYZZWW is an offset fromt jmp_from
+ // jmp XXYYZZWW = E9 WW ZZ YY XX, where XXYYZZWW is an offset from jmp_from
// to the next instruction to the destination.
ptrdiff_t offset = to - jmp_from - 5;
*jmp_from = '\xE9';
@@ -68,6 +68,12 @@ static char *GetMemoryForTrampoline(size_t size) {
// Returns 0 on error.
static size_t RoundUpToInstrBoundary(size_t size, char *code) {
+#ifdef _WIN64
+ // TODO(wwchrome): Implement similar logic for x64 instructions.
+ // Win64 RoundUpToInstrBoundary is not supported yet.
+ __debugbreak();
+ return 0;
+#else
size_t cursor = 0;
while (cursor < size) {
switch (code[cursor]) {
@@ -140,12 +146,16 @@ static size_t RoundUpToInstrBoundary(size_t size, char *code) {
}
return cursor;
+#endif
}
bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) {
#ifdef _WIN64
-#error OverrideFunction is not yet supported on x64
-#endif
+ // TODO(wwchrome): Implement using x64 jmp.
+ // OverrideFunction is not yet supported on x64.
+ __debugbreak();
+ return false;
+#else
// Function overriding works basically like this:
// We write "jmp <new_func>" (5 bytes) at the beginning of the 'old_func'
// to override it.
@@ -190,6 +200,7 @@ bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) {
return false; // not clear if this failure bothers us.
return true;
+#endif
}
static void **InterestingDLLsAvailable() {
OpenPOWER on IntegriCloud