[libcxxabi] r211784 - Fix linux build.

Logan Chien tzuhsiang.chien at gmail.com
Thu Jun 26 06:56:23 PDT 2014


Author: logan
Date: Thu Jun 26 08:56:23 2014
New Revision: 211784

URL: http://llvm.org/viewvc/llvm-project?rev=211784&view=rev
Log:
Fix linux build.

* Replace strlcpy with snprintf since strlcpy is not available
  in glibc.

* Replace __LINUX__ with __linux__.


Modified:
    libcxxabi/trunk/src/Unwind/AddressSpace.hpp

Modified: libcxxabi/trunk/src/Unwind/AddressSpace.hpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/Unwind/AddressSpace.hpp?rev=211784&r1=211783&r2=211784&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/AddressSpace.hpp (original)
+++ libcxxabi/trunk/src/Unwind/AddressSpace.hpp Thu Jun 26 08:56:23 2014
@@ -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 <link.h>
+#include <link.h>
 #endif
 #endif  // LIBCXXABI_ARM_EHABI
 
@@ -353,7 +355,7 @@ inline bool LocalAddressSpace::findFunct
   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;
     }





More information about the cfe-commits mailing list