[clang] [llvm] [PAC] Fix address discrimination for type info vtable pointers (PR #102199)
Daniil Kovalev via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 03:34:36 PDT 2024
================
@@ -4207,16 +4214,31 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(
break;
}
- llvm::Constant *Init = llvm::ConstantStruct::getAnon(Fields);
-
SmallString<256> Name;
llvm::raw_svector_ostream Out(Name);
CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out);
llvm::Module &M = CGM.getModule();
llvm::GlobalVariable *OldGV = M.getNamedGlobal(Name);
- llvm::GlobalVariable *GV =
- new llvm::GlobalVariable(M, Init->getType(),
- /*isConstant=*/true, Linkage, Init, Name);
+ llvm::GlobalVariable *GV = new llvm::GlobalVariable(
+ M, llvm::ConstantStruct::getTypeForElements(Fields),
----------------
kovdan01 wrote:
@efriedma-quic Thanks for suggestion! Followed this way in b08172fa576e5bb7849aa13d503180cfef5bcd0b. This actually changes order of globals definitions in output IR and requires changing related tests correspondingly (see c9d26dd6dd7648c25e44e576891e838a418eacae), but, as far as I understand, this should not cause any problems.
https://github.com/llvm/llvm-project/pull/102199
More information about the cfe-commits
mailing list