diff options
author | Ryan Prichard <rprichard@google.com> | 2019-11-05 14:19:18 -0800 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2019-11-05 14:56:09 -0800 |
commit | 94a8e859edbd6b470699210eea8712e75fd97f79 (patch) | |
tree | 373eb2fb8139055d2f628fb9488d37941dabfbd6 /libc/malloc_hooks/malloc_hooks.cpp | |
parent | 249757bae2b45c845feddee2ba9f794a54d8ea14 (diff) |
linker: avoid -O0 memset while clearing temp_tcb
With -O0, on arm64, Clang uses memset for this declaration:
bionic_tcb temp_tcb = {};
arm64 doesn't currently have an ifunc for memset, but if it did, then this
line would crash when the linker is compiled with -O0. It looks like other
architectures would only use a memset call if the bionic_tcb struct were
larger.
Avoid memset by using a custom memclr function that the compiler optimizes
into something efficient.
Also add __attribute__((uninitialized)) to ensure that
-ftrivial-auto-var-init does not generate a call to memset. See this
change[1] in build/soong.
[1] If085ec53c619e2cebc86ca23f7039298160d99ae
Test: build linker with -O0, linker[64] --help works
Bug: none
Change-Id: I0df8065a362646de4fa021cae63a7d68ca3966b6
Diffstat (limited to 'libc/malloc_hooks/malloc_hooks.cpp')
0 files changed, 0 insertions, 0 deletions