[all-commits] [llvm/llvm-project] 93e5cf: [clang] Do not instrument relative vtables under h...

PiJoules via All-commits all-commits at lists.llvm.org
Fri Aug 26 11:22:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 93e5cf6b9c08d99cf7cefc0adda346bd7ba56049
      https://github.com/llvm/llvm-project/commit/93e5cf6b9c08d99cf7cefc0adda346bd7ba56049
  Author: Leonard Chan <leonardchan at google.com>
  Date:   2022-08-26 (Fri, 26 Aug 2022)

  Changed paths:
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CGVTables.h
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    A clang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-hwasan.cpp

  Log Message:
  -----------
  [clang] Do not instrument relative vtables under hwasan

Full context in
https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=107017.

Instrumenting hwasan with globals results in a linker error under the
relative vtables abi:

```
ld.lld: error:
libunwind.cpp:(.rodata..L_ZTVN9libunwind12UnwindCursorINS_17LocalAddressSpaceENS_15Registers_arm64EEE.hwasan+0x8):
relocation R_AARCH64_PLT32 out of range: 6845471433603167792 is not in
[-2147483648, 2147483647]; references
libunwind::AbstractUnwindCursor::~AbstractUnwindCursor()
>>> defined in
libunwind/src/CMakeFiles/unwind_shared.dir/libunwind.cpp.obj
```

This is because the tag is included in the vtable address when
calculating the offset between the vtable and virtual function. A
temporary solution until we can resolve this is to just disable hwasan
instrumentation on relative vtables specifically, which can be done in
the frontend.

Differential Revision: https://reviews.llvm.org/D132425




More information about the All-commits mailing list