[clang] Do not instrument the rtti_proxies under hwasan
authorLeonard Chan <leonardchan@google.com>
Fri, 26 Aug 2022 18:22:17 +0000 (18:22 +0000)
committerLeonard Chan <leonardchan@google.com>
Fri, 26 Aug 2022 18:22:17 +0000 (18:22 +0000)
commitcdb30f7a26354b000310ebe30a6874f7737675ed
tree1e27ded14e6c8dd996ff5f3941af1354c71f4ace
parent93e5cf6b9c08d99cf7cefc0adda346bd7ba56049
[clang] Do not instrument the rtti_proxies under hwasan

We run into a duplicate symbol error when instrumenting the rtti_proxies
generated as part of the relative vtables ABI with hwasan:

```
ld.lld: error: duplicate symbol: typeinfo for icu_71::UObject
(.rtti_proxy)
>>> defined at brkiter.cpp
>>>
arm64-hwasan-shared/obj/third_party/icu/source/common/libicuuc.brkiter.cpp.o:(typeinfo
for icu_71::UObject (.rtti_proxy))
>>> defined at locavailable.cpp
>>>
arm64-hwasan-shared/obj/third_party/icu/source/common/libicuuc.locavailable.cpp.o:(.data.rel.ro..L_ZTIN6icu_717UObjectE.rtti_proxy.hwasan+0xE00000000000000)
```

The issue here is that the hwasan alias carries over the visibility and
linkage of the original proxy, so we have duplicate external symbols
that participate in linking. Similar to D132425 we can just disable
hwasan for the proxies for now.

Differential Revision: https://reviews.llvm.org/D132691
clang/lib/CodeGen/CGVTables.cpp
clang/lib/CodeGen/CGVTables.h
clang/test/CodeGenCXX/RelativeVTablesABI/relative-vtables-hwasan.cpp