From aa515f00bb00a172938ac1457e44ddf7f9f94492 Mon Sep 17 00:00:00 2001 From: Viktor Kutuzov Date: Sun, 15 Jun 2014 13:56:28 +0000 Subject: Fix getting IP, BP and SP for address sanitizer's needs on FreeBSD in 32-bit mode git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@210988 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/asan_linux.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'lib/asan') diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc index b3c45ee86..fdd009c96 100644 --- a/lib/asan/asan_linux.cc +++ b/lib/asan/asan_linux.cc @@ -19,6 +19,7 @@ #include "asan_internal.h" #include "asan_thread.h" #include "sanitizer_common/sanitizer_flags.h" +#include "sanitizer_common/sanitizer_freebsd.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_procmaps.h" @@ -46,15 +47,11 @@ extern "C" void* _DYNAMIC; #include #endif -// x86_64 FreeBSD 9.2 and older define 64-bit register names in both 64-bit -// and 32-bit modes. -#if SANITIZER_FREEBSD -#include -# if __FreeBSD_version <= 902001 // v9.2 -# define mc_eip mc_rip -# define mc_ebp mc_rbp -# define mc_esp mc_rsp -# endif +// x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in +// 32-bit mode. +#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) && \ + __FreeBSD_version <= 902001 // v9.2 +#define ucontext_t xucontext_t #endif typedef enum { -- cgit v1.2.3