Skip to content

Commit 4fe98aa

Browse files
authored
Revert "[PAC][ELF][AArch64] Support signed personality function pointer (#113…"
This reverts commit 4fb1cda.
1 parent a4c7c66 commit 4fe98aa

16 files changed

+8
-176
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,9 +1218,6 @@ void CodeGenModule::Release() {
12181218
getModule().addModuleFlag(llvm::Module::Min, "ptrauth-elf-got", 1);
12191219

12201220
if (getTriple().isOSLinux()) {
1221-
if (LangOpts.PointerAuthCalls)
1222-
getModule().addModuleFlag(llvm::Module::Min, "ptrauth-sign-personality",
1223-
1);
12241221
assert(getTriple().isOSBinFormatELF());
12251222
using namespace llvm::ELF;
12261223
uint64_t PAuthABIVersion =
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=OFF
22
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-elf-got -emit-llvm %s -o - | FileCheck %s --check-prefix=ELFGOT
3-
// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -emit-llvm %s -o - | FileCheck %s --check-prefix=PERSONALITY
43

54
// ELFGOT: !llvm.module.flags = !{
65
// ELFGOT-SAME: !1
76
// ELFGOT: !1 = !{i32 8, !"ptrauth-elf-got", i32 1}
87

9-
// PERSONALITY: !llvm.module.flags = !{
10-
// PERSONALITY-SAME: !1
11-
// PERSONALITY: !1 = !{i32 8, !"ptrauth-sign-personality", i32 1}
12-
138
// OFF-NOT: "ptrauth-

llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,7 @@ class TargetLoweringObjectFileELF : public TargetLoweringObjectFile {
5252
void emitModuleMetadata(MCStreamer &Streamer, Module &M) const override;
5353

5454
void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &DL,
55-
const MCSymbol *Sym,
56-
const MachineModuleInfo *MMI) const override;
57-
58-
virtual void emitPersonalityValueImpl(MCStreamer &Streamer,
59-
const DataLayout &DL,
60-
const MCSymbol *Sym,
61-
const MachineModuleInfo *MMI) const;
55+
const MCSymbol *Sym) const override;
6256

6357
/// Given a constant with the SectionKind, return a section that it should be
6458
/// placed in.

llvm/include/llvm/Target/TargetLoweringObjectFile.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ class TargetLoweringObjectFile : public MCObjectFileInfo {
8282
virtual void Initialize(MCContext &ctx, const TargetMachine &TM);
8383

8484
virtual void emitPersonalityValue(MCStreamer &Streamer, const DataLayout &TM,
85-
const MCSymbol *Sym,
86-
const MachineModuleInfo *MMI) const;
85+
const MCSymbol *Sym) const;
8786

8887
/// Emit the module-level metadata that the platform cares about.
8988
virtual void emitModuleMetadata(MCStreamer &Streamer, Module &M) const {}

llvm/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ void DwarfCFIException::endModule() {
5050
// Emit indirect reference table for all used personality functions
5151
for (const GlobalValue *Personality : Personalities) {
5252
MCSymbol *Sym = Asm->getSymbol(Personality);
53-
TLOF.emitPersonalityValue(*Asm->OutStreamer, Asm->getDataLayout(), Sym,
54-
Asm->MMI);
53+
TLOF.emitPersonalityValue(*Asm->OutStreamer, Asm->getDataLayout(), Sym);
5554
}
5655
Personalities.clear();
5756
}

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
413413
}
414414

415415
void TargetLoweringObjectFileELF::emitPersonalityValue(
416-
MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym,
417-
const MachineModuleInfo *MMI) const {
416+
MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym) const {
418417
SmallString<64> NameData("DW.ref.");
419418
NameData += Sym->getName();
420419
MCSymbolELF *Label =
@@ -432,13 +431,6 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(
432431
Streamer.emitELFSize(Label, E);
433432
Streamer.emitLabel(Label);
434433

435-
emitPersonalityValueImpl(Streamer, DL, Sym, MMI);
436-
}
437-
438-
void TargetLoweringObjectFileELF::emitPersonalityValueImpl(
439-
MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym,
440-
const MachineModuleInfo *MMI) const {
441-
unsigned Size = DL.getPointerSize();
442434
Streamer.emitSymbolValue(Sym, Size);
443435
}
444436

llvm/lib/Target/AArch64/AArch64MachineModuleInfo.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

llvm/lib/Target/AArch64/AArch64MachineModuleInfo.h

Lines changed: 0 additions & 35 deletions
This file was deleted.

llvm/lib/Target/AArch64/AArch64TargetObjectFile.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "AArch64TargetObjectFile.h"
10-
#include "AArch64MachineModuleInfo.h"
1110
#include "AArch64TargetMachine.h"
1211
#include "MCTargetDesc/AArch64MCExpr.h"
13-
#include "MCTargetDesc/AArch64TargetStreamer.h"
1412
#include "llvm/BinaryFormat/Dwarf.h"
1513
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
1614
#include "llvm/IR/Mangler.h"
@@ -30,21 +28,6 @@ void AArch64_ELFTargetObjectFile::Initialize(MCContext &Ctx,
3028
SupportDebugThreadLocalLocation = false;
3129
}
3230

33-
void AArch64_ELFTargetObjectFile::emitPersonalityValueImpl(
34-
MCStreamer &Streamer, const DataLayout &DL, const MCSymbol *Sym,
35-
const MachineModuleInfo *MMI) const {
36-
if (!MMI->getObjFileInfo<AArch64MachineModuleInfo>().hasSignedPersonality()) {
37-
TargetLoweringObjectFileELF::emitPersonalityValueImpl(Streamer, DL, Sym,
38-
MMI);
39-
return;
40-
}
41-
auto *TS = static_cast<AArch64TargetStreamer *>(Streamer.getTargetStreamer());
42-
// The value is ptrauth_string_discriminator("personality")
43-
constexpr uint16_t Discriminator = 0x7EAD;
44-
TS->emitAuthValue(MCSymbolRefExpr::create(Sym, getContext()), Discriminator,
45-
AArch64PACKey::IA, /*HasAddressDiversity=*/true);
46-
}
47-
4831
const MCExpr *AArch64_ELFTargetObjectFile::getIndirectSymViaGOTPCRel(
4932
const GlobalValue *GV, const MCSymbol *Sym, const MCValue &MV,
5033
int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const {

llvm/lib/Target/AArch64/AArch64TargetObjectFile.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ class AArch64_ELFTargetObjectFile : public TargetLoweringObjectFileELF {
3535
MachineModuleInfo *MMI, const MCSymbol *RawSym,
3636
AArch64PACKey::ID Key,
3737
uint16_t Discriminator) const;
38-
39-
void emitPersonalityValueImpl(MCStreamer &Streamer, const DataLayout &DL,
40-
const MCSymbol *Sym,
41-
const MachineModuleInfo *MMI) const override;
4238
};
4339

4440
/// AArch64_MachoTargetObjectFile - This TLOF implementation is used for Darwin.

llvm/lib/Target/AArch64/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ add_llvm_target(AArch64CodeGen
6767
AArch64LoadStoreOptimizer.cpp
6868
AArch64LowerHomogeneousPrologEpilog.cpp
6969
AArch64MachineFunctionInfo.cpp
70-
AArch64MachineModuleInfo.cpp
7170
AArch64MachineScheduler.cpp
7271
AArch64MacroFusion.cpp
7372
AArch64MIPeepholeOpt.cpp

llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ AArch64TargetStreamer::AArch64TargetStreamer(MCStreamer &S)
3535

3636
AArch64TargetStreamer::~AArch64TargetStreamer() = default;
3737

38-
void AArch64TargetStreamer::emitAuthValue(const MCExpr *Expr,
39-
uint16_t Discriminator,
40-
AArch64PACKey::ID Key,
41-
bool HasAddressDiversity) {
42-
Streamer.emitValueImpl(AArch64AuthMCExpr::create(Expr, Discriminator, Key,
43-
HasAddressDiversity,
44-
Streamer.getContext()),
45-
8);
46-
}
47-
4838
// The constant pool handling is shared by all AArch64TargetStreamer
4939
// implementations.
5040
const MCExpr *AArch64TargetStreamer::addConstantPoolEntry(const MCExpr *Expr,

llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
1010
#define LLVM_LIB_TARGET_AARCH64_MCTARGETDESC_AARCH64TARGETSTREAMER_H
1111

12-
#include "AArch64MCExpr.h"
1312
#include "llvm/MC/MCStreamer.h"
1413

1514
namespace {
@@ -39,11 +38,6 @@ class AArch64TargetStreamer : public MCTargetStreamer {
3938
void emitNoteSection(unsigned Flags, uint64_t PAuthABIPlatform = -1,
4039
uint64_t PAuthABIVersion = -1);
4140

42-
/// Callback used to emit AUTH expressions (e.g. signed
43-
/// personality function pointer).
44-
void emitAuthValue(const MCExpr *Expr, uint16_t Discriminator,
45-
AArch64PACKey::ID Key, bool HasAddressDiversity);
46-
4741
/// Callback used to implement the .inst directive.
4842
virtual void emitInst(uint32_t Inst);
4943

llvm/lib/Target/TargetLoweringObjectFile.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
141141
return TM.getSymbol(GV);
142142
}
143143

144-
void TargetLoweringObjectFile::emitPersonalityValue(
145-
MCStreamer &Streamer, const DataLayout &, const MCSymbol *Sym,
146-
const MachineModuleInfo *MMI) const {}
144+
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
145+
const DataLayout &,
146+
const MCSymbol *Sym) const {
147+
}
147148

148149
void TargetLoweringObjectFile::emitCGProfileMetadata(MCStreamer &Streamer,
149150
Module &M) const {

llvm/test/CodeGen/AArch64/ptrauth-sign-personality.ll

Lines changed: 0 additions & 39 deletions
This file was deleted.

llvm/utils/gn/secondary/llvm/lib/Target/AArch64/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ static_library("LLVMAArch64CodeGen") {
135135
"AArch64MCInstLower.cpp",
136136
"AArch64MIPeepholeOpt.cpp",
137137
"AArch64MachineFunctionInfo.cpp",
138-
"AArch64MachineModuleInfo.cpp",
139138
"AArch64MachineScheduler.cpp",
140139
"AArch64MacroFusion.cpp",
141140
"AArch64PBQPRegAlloc.cpp",

0 commit comments

Comments
 (0)