[clang] [llvm] [MTE] Apply alignment / size in AsmPrinter rather than IR (PR #111918)
Florian Mayer via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 12:25:21 PDT 2024
================
@@ -764,11 +764,17 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
const DataLayout &DL = GV->getDataLayout();
uint64_t Size = DL.getTypeAllocSize(GV->getValueType());
+ if (GV->isTagged())
+ Size = alignTo(Size, 16);
// If the alignment is specified, we *must* obey it. Overaligning a global
// with a specified alignment is a prompt way to break globals emitted to
// sections and expected to be contiguous (e.g. ObjC metadata).
- const Align Alignment = getGVAlignment(GV, DL);
+ Align Alignment = getGVAlignment(GV, DL);
+ if (GV->isTagged() && Alignment < 16) {
+ assert(!GV->hasSection());
----------------
fmayer wrote:
It is in `shouldTagGlobal`
https://github.com/llvm/llvm-project/pull/111918
More information about the cfe-commits
mailing list