diff options
| author | Verena Beckham <verena@codeplay.com> | 2016-02-24 13:46:33 +0000 |
|---|---|---|
| committer | Yang Ni <yangni@google.com> | 2016-08-11 20:48:28 +0000 |
| commit | b42b8b86a6e28b96919d0ef40294e3b8636e8fc7 (patch) | |
| tree | 7a59dd370e5f39d983ce129f7f82163cb2a26e30 | |
| parent | ec8778ceb0f7870d50f8a99f706c71e39f1add18 (diff) | |
Rename memcpy to local_memcpy in rs_allocations.c.
This is so it doesn't get linked with instead of the bionic version.
This fixes a crash when compiling with -O0, where the memcpy version
in rs_allocations.c was hanging around (not being inlined) and was
linked with in unrelated code, which led to a crash because the ABI
was not the expected.
Change-Id: I0c699bf3e0ed7b353d0e2108c52fcb19660eecc5
Signed-off-by: Verena Beckham <verena@codeplay.com>
(cherry picked from commit 6fb5a4f5411c16d36f123c7c2c9add4d937479ef)
Bug: 30312793
| -rw-r--r-- | driver/runtime/rs_allocation.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/driver/runtime/rs_allocation.c b/driver/runtime/rs_allocation.c index 490112c4..fc60ea98 100644 --- a/driver/runtime/rs_allocation.c +++ b/driver/runtime/rs_allocation.c @@ -48,7 +48,7 @@ extern rs_element __attribute__((overloadable)) } // TODO: this needs to be optimized, obviously -static void memcpy(void* dst, const void* src, size_t size) { +static void local_memcpy(void* dst, const void* src, size_t size) { char* dst_c = (char*) dst; const char* src_c = (const char*) src; for (; size > 0; size--) { @@ -281,7 +281,7 @@ extern void __attribute__((overloadable)) Allocation_t *alloc = (Allocation_t *)a.p; const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; const uint32_t eSize = alloc->mHal.state.elementSizeBytes; - memcpy((void*)&p[eSize * x], ptr, eSize); + local_memcpy((void*)&p[eSize * x], ptr, eSize); } extern void __attribute__((overloadable)) @@ -290,7 +290,7 @@ extern void __attribute__((overloadable)) const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.lod[0].mallocPtr; const uint32_t eSize = alloc->mHal.state.elementSizeBytes; const uint32_t stride = alloc->mHal.drvState.lod[0].stride; - memcpy((void*)&p[(eSize * x) + (y * stride)], ptr, eSize); + local_memcpy((void*)&p[(eSize * x) + (y * stride)], ptr, eSize); } extern void __attribute__((overloadable)) @@ -300,7 +300,7 @@ extern void __attribute__((overloadable)) const uint32_t eSize = alloc->mHal.state.elementSizeBytes; const uint32_t stride = alloc->mHal.drvState.lod[0].stride; const uint32_t dimY = alloc->mHal.drvState.lod[0].dimY; - memcpy((void*)&p[(eSize * x) + (y * stride) + (z * stride * dimY)], ptr, eSize); + local_memcpy((void*)&p[(eSize * x) + (y * stride) + (z * stride * dimY)], ptr, eSize); } #endif // RS_DEBUG_RUNTIME @@ -412,13 +412,13 @@ extern uchar __attribute__((overloadable)) void __rsAllocationVStoreXImpl_##T \ (rs_allocation a, const T val, uint32_t x, uint32_t y, uint32_t z) {\ T *val_ptr = (T*)rsOffsetNs(a, x, y, z); \ - memcpy(val_ptr, &val, sizeof(T)); \ + local_memcpy(val_ptr, &val, sizeof(T)); \ } \ T __rsAllocationVLoadXImpl_##T \ (rs_allocation a, uint32_t x, uint32_t y, uint32_t z) { \ T result = {}; \ T* val_ptr = (T*)rsOffsetNs(a, x, y, z); \ - memcpy(&result, val_ptr, sizeof(T)); \ + local_memcpy(&result, val_ptr, sizeof(T)); \ return result; \ } |
