Skip to content

Commit 32f83d3

Browse files
committed
MCFixup: Remove FK_PCRel_
The generic FK_Data_ fixup kinds handle both absolute and PC-relative fixups. ELFObjectWriter sets IsPCRel to true for `.long foo-.`, so the backend has to handle PC-relative FK_Data_. However, the existence of FK_PCRel_ encouraged backends to implement it as a separate fixup type, leading to redundant and error-prone code. Removing FK_PCRel_ simplifies the overall fixup mechanism.
1 parent 158fa4a commit 32f83d3

File tree

5 files changed

+343
-353
lines changed

5 files changed

+343
-353
lines changed

llvm/include/llvm/MC/MCFixup.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ enum MCFixupKind : uint16_t {
3434
FK_Data_4, ///< A four-byte fixup.
3535
FK_Data_8, ///< A eight-byte fixup.
3636
FK_Data_leb128, ///< A leb128 fixup.
37-
FK_PCRel_1, ///< A one-byte pc relative fixup.
38-
FK_PCRel_2, ///< A two-byte pc relative fixup.
39-
FK_PCRel_4, ///< A four-byte pc relative fixup.
40-
FK_PCRel_8, ///< A eight-byte pc relative fixup.
4137
FK_SecRel_1, ///< A one-byte section relative fixup.
4238
FK_SecRel_2, ///< A two-byte section relative fixup.
4339
FK_SecRel_4, ///< A four-byte section relative fixup.

llvm/lib/MC/MCAsmBackend.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ MCFixupKindInfo MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
9595
{"FK_Data_4", 0, 32, 0},
9696
{"FK_Data_8", 0, 64, 0},
9797
{"FK_Data_leb128", 0, 0, 0},
98-
{"FK_PCRel_1", 0, 8, 0},
99-
{"FK_PCRel_2", 0, 16, 0},
100-
{"FK_PCRel_4", 0, 32, 0},
101-
{"FK_PCRel_8", 0, 64, 0},
10298
{"FK_SecRel_1", 0, 8, 0},
10399
{"FK_SecRel_2", 0, 16, 0},
104100
{"FK_SecRel_4", 0, 32, 0},

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ class HexagonAsmBackend : public MCAsmBackend {
317317
case FK_Data_1:
318318
case FK_Data_2:
319319
case FK_Data_4:
320-
case FK_PCRel_4:
321320
case fixup_Hexagon_32:
322321
// Leave these relocations alone as they are used for EH.
323322
return false;
@@ -335,8 +334,7 @@ class HexagonAsmBackend : public MCAsmBackend {
335334
return 1;
336335
case FK_Data_2:
337336
return 2;
338-
case FK_Data_4: // this later gets mapped to R_HEX_32
339-
case FK_PCRel_4: // this later gets mapped to R_HEX_32_PCREL
337+
case FK_Data_4: // this later gets mapped to R_HEX_32 or R_HEX_32_PCREL
340338
case fixup_Hexagon_32:
341339
case fixup_Hexagon_B32_PCREL_X:
342340
case fixup_Hexagon_B22_PCREL:

0 commit comments

Comments
 (0)