From 37be06a0c642aa560c544684f458c7aa9d8e9f48 Mon Sep 17 00:00:00 2001 From: Logan Chien Date: Thu, 26 Jun 2014 13:56:23 +0000 Subject: [PATCH] Fix linux build. * Replace strlcpy with snprintf since strlcpy is not available in glibc. * Replace __LINUX__ with __linux__. llvm-svn: 211784 --- libcxxabi/src/Unwind/AddressSpace.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libcxxabi/src/Unwind/AddressSpace.hpp b/libcxxabi/src/Unwind/AddressSpace.hpp index 2682ec4..d0688f7 100644 --- a/libcxxabi/src/Unwind/AddressSpace.hpp +++ b/libcxxabi/src/Unwind/AddressSpace.hpp @@ -32,14 +32,16 @@ namespace libunwind { #include "Registers.hpp" #if LIBCXXABI_ARM_EHABI -#if __LINUX__ - // Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system. - typedef long unsigned int *_Unwind_Ptr; - extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr targetAddr, int *length); - _Unwind_Ptr (*dl_unwind_find_exidx)(_Unwind_Ptr targetAddr, int *length) = - __gnu_Unwind_Find_exidx; +#if __linux__ + +typedef long unsigned int *_Unwind_Ptr; +extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len); + +// Emulate the BSD dl_unwind_find_exidx API when on a GNU libdl system. +#define dl_unwind_find_exidx __gnu_Unwind_Find_exidx + #else - #include +#include #endif #endif // LIBCXXABI_ARM_EHABI @@ -353,7 +355,7 @@ inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, Dl_info dyldInfo; if (dladdr((void *)addr, &dyldInfo)) { if (dyldInfo.dli_sname != NULL) { - strlcpy(buf, dyldInfo.dli_sname, bufLen); + snprintf(buf, bufLen, "%s", dyldInfo.dli_sname); *offset = (addr - (pint_t) dyldInfo.dli_saddr); return true; } -- 2.7.4