Something appears to have changed regarding generation of a relocation against an undefined VTT symbol between clang 11 and 12.
struct A {};
struct B : virtual A {};
struct C : virtual A {};
struct D : B , C {
virtual void foo();
};
void bar() {
D* d = new D;
d->foo();
}
Minimal reproducer on Godbolt (flip between clang 11.0.0 and 12.0.0 to see the relocations change)
- In clang 11, an
R_X86_64_64
reloc is used for the VTT for D - In clang 12+, an
R_X86_64_REX_GOTPCRELX
is used for the VTT for D
I tried searching through relevant changes in that timeframe, but came up empty. I must admit I’m unfamiliar with this area of code.
Note that the example (and my situation) don’t cause a link error because I’m only concerned with relocatable object output for the file in question.
Does anyone know what may have changed (and why)?
Thanks!