Skip to content

Commit 8b4f9c1

Browse files
committed
[AArch64][ELF][PAC] Do not emit *.ptrauth pseudo-symbols in assembly
- Do not use relative lookup tables - Do not emit .weak attribute - Do not emit .addrsig attribute
1 parent 70efb00 commit 8b4f9c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,8 @@ bool AsmPrinter::doFinalization(Module &M) {
22952295
for (const auto &GO : M.global_objects()) {
22962296
if (!GO.hasExternalWeakLinkage())
22972297
continue;
2298-
OutStreamer->emitSymbolAttribute(getSymbol(&GO), MCSA_WeakReference);
2298+
if (GO.getSection() != "llvm.ptrauth")
2299+
OutStreamer->emitSymbolAttribute(getSymbol(&GO), MCSA_WeakReference);
22992300
}
23002301
if (shouldEmitWeakSwiftAsyncExtendedFramePointerFlags()) {
23012302
auto SymbolName = "swift_async_extendedFramePointerFlags";
@@ -2369,7 +2370,7 @@ bool AsmPrinter::doFinalization(Module &M) {
23692370
for (const GlobalValue &GV : M.global_values()) {
23702371
if (!GV.use_empty() && !GV.isThreadLocal() &&
23712372
!GV.hasDLLImportStorageClass() && !GV.getName().startswith("llvm.") &&
2372-
!GV.hasAtLeastLocalUnnamedAddr())
2373+
!GV.hasAtLeastLocalUnnamedAddr() && GV.getSection() != "llvm.ptrauth")
23732374
OutStreamer->emitAddrsigSym(getSymbol(&GV));
23742375
}
23752376
}

llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ static bool shouldConvertToRelLookupTable(Module &M, GlobalVariable &GV) {
8181
if (!GlovalVarOp || !GlovalVarOp->isConstant())
8282
return false;
8383

84+
if (GlovalVarOp->getSection() == "llvm.ptrauth")
85+
return false;
86+
8487
if (!GlovalVarOp->hasLocalLinkage() ||
8588
!GlovalVarOp->isDSOLocal() ||
8689
!GlovalVarOp->isImplicitDSOLocal())

0 commit comments

Comments
 (0)