summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2014-04-08 11:43:49 +0000
committerJoerg Sonnenberger <joerg@bec.de>2014-04-08 11:43:49 +0000
commit7955feb82f2b91358dab5de7afd2e3fe55da46b0 (patch)
treec78bfcc92276b2d375263344237d4f31e0ab36f1 /libcxxabi/src
parent559c8623c56bcece5a8a33ee51951b0b8f609fa9 (diff)
downloadbcm5719-llvm-7955feb82f2b91358dab5de7afd2e3fe55da46b0.tar.gz
bcm5719-llvm-7955feb82f2b91358dab5de7afd2e3fe55da46b0.zip
The content of .eh_frame may be misaligned, so use memcpy. This is seen
in the wild on SH3. llvm-svn: 205756
Diffstat (limited to 'libcxxabi/src')
-rw-r--r--libcxxabi/src/Unwind/AddressSpace.hpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/libcxxabi/src/Unwind/AddressSpace.hpp b/libcxxabi/src/Unwind/AddressSpace.hpp
index fafee04cf9a..aac8b7fbd9d 100644
--- a/libcxxabi/src/Unwind/AddressSpace.hpp
+++ b/libcxxabi/src/Unwind/AddressSpace.hpp
@@ -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);
OpenPOWER on IntegriCloud