Skip to content

Commit 1b11b5b

Browse files
committed
[AArch64] Replace fixup_aarch64_tlsdesc_call with FirstLiteralRelocationKind + R_AARCH64_{,P32_}TLSDESC_CALL
1 parent 5f39522 commit 1b11b5b

File tree

5 files changed

+8
-14
lines changed

5 files changed

+8
-14
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ class AArch64AsmBackend : public MCAsmBackend {
6767
{"fixup_aarch64_pcrel_branch14", 5, 14, PCRelFlagVal},
6868
{"fixup_aarch64_pcrel_branch19", 5, 19, PCRelFlagVal},
6969
{"fixup_aarch64_pcrel_branch26", 0, 26, PCRelFlagVal},
70-
{"fixup_aarch64_pcrel_call26", 0, 26, PCRelFlagVal},
71-
{"fixup_aarch64_tlsdesc_call", 0, 0, 0}};
70+
{"fixup_aarch64_pcrel_call26", 0, 26, PCRelFlagVal}};
7271

7372
// Fixup kinds from .reloc directive are like R_AARCH64_NONE. They do not
7473
// require any extra processing.
@@ -109,9 +108,6 @@ static unsigned getFixupKindNumBytes(unsigned Kind) {
109108
default:
110109
llvm_unreachable("Unknown fixup kind!");
111110

112-
case AArch64::fixup_aarch64_tlsdesc_call:
113-
return 0;
114-
115111
case FK_Data_1:
116112
return 1;
117113

@@ -367,7 +363,6 @@ unsigned AArch64AsmBackend::getFixupKindContainereSizeInBytes(unsigned Kind) con
367363
case FK_Data_8:
368364
return 8;
369365

370-
case AArch64::fixup_aarch64_tlsdesc_call:
371366
case AArch64::fixup_aarch64_movw:
372367
case AArch64::fixup_aarch64_pcrel_branch14:
373368
case AArch64::fixup_aarch64_add_imm12:

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ unsigned AArch64ELFObjectWriter::getRelocType(MCContext &Ctx,
444444
Ctx.reportError(Fixup.getLoc(),
445445
"invalid fixup for movz/movk instruction");
446446
return ELF::R_AARCH64_NONE;
447-
case AArch64::fixup_aarch64_tlsdesc_call:
448-
return R_CLS(TLSDESC_CALL);
449447
default:
450448
Ctx.reportError(Fixup.getLoc(), "Unknown ELF relocation type");
451449
return ELF::R_AARCH64_NONE;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ enum Fixups {
5555
// branch26 only on ELF.
5656
fixup_aarch64_pcrel_call26,
5757

58-
// zero-space placeholder for the ELF R_AARCH64_TLSDESC_CALL relocation.
59-
fixup_aarch64_tlsdesc_call,
60-
6158
// Marker
6259
LastTargetFixupKind,
6360
NumTargetFixupKinds = LastTargetFixupKind - FirstTargetFixupKind

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,12 @@ void AArch64MCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
599599
// This is a directive which applies an R_AARCH64_TLSDESC_CALL to the
600600
// following (BLR) instruction. It doesn't emit any code itself so it
601601
// doesn't go through the normal TableGenerated channels.
602-
MCFixupKind Fixup = MCFixupKind(AArch64::fixup_aarch64_tlsdesc_call);
603-
Fixups.push_back(MCFixup::create(0, MI.getOperand(0).getExpr(), Fixup));
602+
auto Reloc = STI.getTargetTriple().getEnvironment() == Triple::GNUILP32
603+
? ELF::R_AARCH64_P32_TLSDESC_CALL
604+
: ELF::R_AARCH64_TLSDESC_CALL;
605+
Fixups.push_back(
606+
MCFixup::create(0, MI.getOperand(0).getExpr(),
607+
MCFixupKind(FirstLiteralRelocationKind + Reloc)));
604608
return;
605609
}
606610

llvm/test/MC/AArch64/tls-relocs.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@
388388
// CHECK: add x5, x4, :tlsdesc_lo12:var // encoding: [0x85,0bAAAAAA00,0b00AAAAAA,0x91]
389389
// CHECK: // fixup A - offset: 0, value: :tlsdesc_lo12:var, kind: fixup_aarch64_add_imm12
390390
// CHECK: .tlsdesccall var // encoding: []
391-
// CHECK: // fixup A - offset: 0, value: var, kind: fixup_aarch64_tlsdesc_call
391+
// CHECK-NEXT: // fixup A - offset: 0, value: var, kind: FK_NONE
392392
// CHECK: blr x3 // encoding: [0x60,0x00,0x3f,0xd6]
393393

394394
// CHECK-ELF-NEXT: 0x104 R_AARCH64_TLSDESC_ADR_PAGE21 [[VARSYM]]

0 commit comments

Comments
 (0)