[all-commits] [llvm/llvm-project] 3747cd: [Fuzzer] Enable custom libc++ for Android (#70407)

Ryan Prichard via All-commits all-commits at lists.llvm.org
Thu Nov 2 14:07:55 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3747cde5e84f7415dbad8d56fb7443237656c820
      https://github.com/llvm/llvm-project/commit/3747cde5e84f7415dbad8d56fb7443237656c820
  Author: Ryan Prichard <rprichard at google.com>
  Date:   2023-11-02 (Thu, 02 Nov 2023)

  Changed paths:
    M compiler-rt/cmake/Modules/AddCompilerRT.cmake
    M compiler-rt/lib/fuzzer/CMakeLists.txt

  Log Message:
  -----------
  [Fuzzer] Enable custom libc++ for Android (#70407)

The Android LLVM build system builds the arm64 fuzzer lib without
HWASan, but then applications that enable HWASan can generated an object
file with a HWASan-ified version of some libc++ symbols (e.g.
`std::__1::piecewise_construct`). The linker can choose the HWASan-ified
definition, but then it cannot resolve the relocation from
libclang_rt.fuzzer-aarch64-android.a to this symbol because the high
bits of the address are unexpectedly set. This produces an error:

```
relocation R_AARCH64_ADR_PREL_PG_HI21 out of range
```

Fix this problem by linking a custom isolated libc++ into Android's
fuzzer library.

We need to pass through ANDROID_NATIVE_API_LEVEL so that the libc++ for
32-bit Android (API < 24) uses LLVM_FORCE_SMALLFILE_FOR_ANDROID.




More information about the All-commits mailing list