[PATCH] D98220: [WPD][ELF] Allow whole program devirtualization for hidden/internal symbols

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 8 16:10:20 PST 2021


tejohnson added inline comments.


================
Comment at: lld/test/ELF/lto/devirt_vcall_vis_hidden.ll:25
+ at _ZTV1A = available_externally hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !vcall_visibility !2
+ at _ZTV1B = linkonce_odr hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1, !vcall_visibility !2
+
----------------
lanza wrote:
> tejohnson wrote:
> > These hidden symbols should start out with Linkage Unit LTO visibility (CodeGenModule::GetVCallVisibilityLevel)
> Yea, this shouldn't have `!vcall_visibility`. A version script could be used here to say that `_ZTV1B` is global but `_ZTV1A` is local. 
> 
> ```
> {
>     global:
>     _ZTV1B;
>     local:
>     *;
> };
> ```
Well right now they are marked with public visibility, which is the same thing as not having any vcall_visibility. Since they are marked in the IR as having hidden visibility, clang presumably should have marked them with a more restricted vcall_visibility (linkage unit level).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98220/new/

https://reviews.llvm.org/D98220



More information about the llvm-commits mailing list