[libcxxabi] r205756 - The content of .eh_frame may be misaligned, so use memcpy. This is seen
Joerg Sonnenberger
joerg at bec.de
Tue Apr 8 04:43:50 PDT 2014
Author: joerg
Date: Tue Apr 8 06:43:49 2014
New Revision: 205756
URL: http://llvm.org/viewvc/llvm-project?rev=205756&view=rev
Log:
The content of .eh_frame may be misaligned, so use memcpy. This is seen
in the wild on SH3.
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=205756&r1=205755&r2=205756&view=diff
==============================================================================
--- libcxxabi/trunk/src/Unwind/AddressSpace.hpp (original)
+++ libcxxabi/trunk/src/Unwind/AddressSpace.hpp Tue Apr 8 06:43:49 2014
@@ -16,6 +16,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <dlfcn.h>
#if __APPLE__
@@ -62,12 +63,36 @@ public:
typedef uint32_t pint_t;
typedef int32_t sint_t;
#endif
- uint8_t get8(pint_t addr) { return *((uint8_t *)addr); }
- uint16_t get16(pint_t addr) { return *((uint16_t *)addr); }
- uint32_t get32(pint_t addr) { return *((uint32_t *)addr); }
- uint64_t get64(pint_t addr) { return *((uint64_t *)addr); }
- double getDouble(pint_t addr) { return *((double *)addr); }
- v128 getVector(pint_t addr) { return *((v128 *)addr); }
+ uint8_t get8(pint_t addr) {
+ uint8_t val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
+ uint16_t get16(pint_t addr) {
+ uint16_t val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
+ uint32_t get32(pint_t addr) {
+ uint32_t val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
+ uint64_t get64(pint_t addr) {
+ uint64_t val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
+ double getDouble(pint_t addr) {
+ double val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
+ v128 getVector(pint_t addr) {
+ v128 val;
+ memcpy(&val, (void *)addr, sizeof(val));
+ return val;
+ }
uintptr_t getP(pint_t addr);
static uint64_t getULEB128(pint_t &addr, pint_t end);
static int64_t getSLEB128(pint_t &addr, pint_t end);
@@ -81,7 +106,6 @@ public:
static LocalAddressSpace sThisAddressSpace;
};
-
inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
#if __LP64__
return get64(addr);
More information about the cfe-commits
mailing list