This patch contains all of the clang changes from D72959. - Generalize the relative vtables ABI such that it can be used by other targets. - Add an enum VTableComponentLayout which controls whether components in the vtable should be pointers to other structs or relative offsets to those structs. Other ABIs can change this enum to restructure how components in the vtable are laid out/accessed. - Add methods to ConstantInitBuilder for inserting relative offsets to a specified position in the aggregate being constructed. - Fix failing tests under new PM and ASan and MSan issues. See D72959 for background info. Differential Revision: https://reviews.llvm.org/D77592
32 lines
873 B
C++
32 lines
873 B
C++
// Check that virtual thunks are unaffected by the relative ABI.
|
|
// The offset of thunks is mangled into the symbol name, which could result in
|
|
// linking errors for binaries that want to look for symbols in SOs made with
|
|
// this ABI.
|
|
// Running that linked binary still won't work since we're using conflicting
|
|
// ABIs, but we should still be able to link.
|
|
|
|
// RUN: %clang_cc1 %s -triple=aarch64-unknown-fuchsia -O1 -S -o - -emit-llvm -fexperimental-relative-c++-abi-vtables | FileCheck %s
|
|
|
|
// This would be normally n24 (3 ptr widths) but is 12 since the vtable is
|
|
// entierely made of i32s now.
|
|
// CHECK: _ZTv0_n12_N7Derived1fEi
|
|
|
|
class Base {
|
|
public:
|
|
virtual int f(int x);
|
|
|
|
private:
|
|
long x;
|
|
};
|
|
|
|
class Derived : public virtual Base {
|
|
public:
|
|
virtual int f(int x);
|
|
|
|
private:
|
|
long y;
|
|
};
|
|
|
|
int Base::f(int x) { return x + 1; }
|
|
int Derived::f(int x) { return x + 2; }
|