Index: ELF/Thunks.cpp =================================================================== --- ELF/Thunks.cpp +++ ELF/Thunks.cpp @@ -50,27 +50,27 @@ // Specific ARM Thunk implementations. The naming convention is: // Source State, TargetState, Target Requirement, ABS or PI, Range -template class ARMToThumbV7ABSLongThunk final : public Thunk { +template class ARMV7ABSLongThunk final : public Thunk { public: - ARMToThumbV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) {} + ARMV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) {} uint32_t size() const override { return 12; } void writeTo(uint8_t *Buf, ThunkSection &IS) const override; void addSymbols(ThunkSection &IS) override; }; -template class ARMToThumbV7PILongThunk final : public Thunk { +template class ARMV7PILongThunk final : public Thunk { public: - ARMToThumbV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) {} + ARMV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) {} uint32_t size() const override { return 16; } void writeTo(uint8_t *Buf, ThunkSection &IS) const override; void addSymbols(ThunkSection &IS) override; }; -template class ThumbToARMV7ABSLongThunk final : public Thunk { +template class ThumbV7ABSLongThunk final : public Thunk { public: - ThumbToARMV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) { + ThumbV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) { this->alignment = 2; } @@ -79,9 +79,9 @@ void addSymbols(ThunkSection &IS) override; }; -template class ThumbToARMV7PILongThunk final : public Thunk { +template class ThumbV7PILongThunk final : public Thunk { public: - ThumbToARMV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) { + ThumbV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) { this->alignment = 2; } @@ -110,8 +110,7 @@ } template -void ARMToThumbV7ABSLongThunk::writeTo(uint8_t *Buf, - ThunkSection &IS) const { +void ARMV7ABSLongThunk::writeTo(uint8_t *Buf, ThunkSection &IS) const { const uint8_t Data[] = { 0x00, 0xc0, 0x00, 0xe3, // movw ip,:lower16:S 0x00, 0xc0, 0x40, 0xe3, // movt ip,:upper16:S @@ -124,16 +123,15 @@ } template -void ARMToThumbV7ABSLongThunk::addSymbols(ThunkSection &IS) { +void ARMV7ABSLongThunk::addSymbols(ThunkSection &IS) { this->ThunkSym = addSyntheticLocal( - Saver.save("__ARMToThumbv7ABSLongThunk_" + this->Destination.getName()), + Saver.save("__ARMv7ABSLongThunk_" + this->Destination.getName()), STT_FUNC, this->Offset, size(), &IS); addSyntheticLocal("$a", STT_NOTYPE, this->Offset, 0, &IS); } template -void ThumbToARMV7ABSLongThunk::writeTo(uint8_t *Buf, - ThunkSection &IS) const { +void ThumbV7ABSLongThunk::writeTo(uint8_t *Buf, ThunkSection &IS) const { const uint8_t Data[] = { 0x40, 0xf2, 0x00, 0x0c, // movw ip, :lower16:S 0xc0, 0xf2, 0x00, 0x0c, // movt ip, :upper16:S @@ -146,16 +144,15 @@ } template -void ThumbToARMV7ABSLongThunk::addSymbols(ThunkSection &IS) { +void ThumbV7ABSLongThunk::addSymbols(ThunkSection &IS) { this->ThunkSym = addSyntheticLocal( - Saver.save("__ThumbToARMv7ABSLongThunk_" + this->Destination.getName()), + Saver.save("__Thumbv7ABSLongThunk_" + this->Destination.getName()), STT_FUNC, this->Offset, size(), &IS); addSyntheticLocal("$t", STT_NOTYPE, this->Offset, 0, &IS); } template -void ARMToThumbV7PILongThunk::writeTo(uint8_t *Buf, - ThunkSection &IS) const { +void ARMV7PILongThunk::writeTo(uint8_t *Buf, ThunkSection &IS) const { const uint8_t Data[] = { 0xf0, 0xcf, 0x0f, 0xe3, // P: movw ip,:lower16:S - (P + (L1-P) +8) 0x00, 0xc0, 0x40, 0xe3, // movt ip,:upper16:S - (P + (L1-P+4) +8) @@ -170,16 +167,15 @@ } template -void ARMToThumbV7PILongThunk::addSymbols(ThunkSection &IS) { +void ARMV7PILongThunk::addSymbols(ThunkSection &IS) { this->ThunkSym = addSyntheticLocal( - Saver.save("__ARMToThumbV7PILongThunk_" + this->Destination.getName()), - STT_FUNC, this->Offset, size(), &IS); + Saver.save("__ARMV7PILongThunk_" + this->Destination.getName()), STT_FUNC, + this->Offset, size(), &IS); addSyntheticLocal("$a", STT_NOTYPE, this->Offset, 0, &IS); } template -void ThumbToARMV7PILongThunk::writeTo(uint8_t *Buf, - ThunkSection &IS) const { +void ThumbV7PILongThunk::writeTo(uint8_t *Buf, ThunkSection &IS) const { const uint8_t Data[] = { 0x4f, 0xf6, 0xf4, 0x7c, // P: movw ip,:lower16:S - (P + (L1-P) + 4) 0xc0, 0xf2, 0x00, 0x0c, // movt ip,:upper16:S - (P + (L1-P+4) + 4) @@ -194,9 +190,9 @@ } template -void ThumbToARMV7PILongThunk::addSymbols(ThunkSection &IS) { +void ThumbV7PILongThunk::addSymbols(ThunkSection &IS) { this->ThunkSym = addSyntheticLocal( - Saver.save("__ThumbToARMV7PILongThunk_" + this->Destination.getName()), + Saver.save("__ThumbV7PILongThunk_" + this->Destination.getName()), STT_FUNC, this->Offset, size(), &IS); addSyntheticLocal("$t", STT_NOTYPE, this->Offset, 0, &IS); } @@ -232,8 +228,7 @@ Thunk::~Thunk() = default; // Creates a thunk for Thumb-ARM interworking. -template -static Thunk *addThunkArm(uint32_t Reloc, SymbolBody &S) { +template static Thunk *addThunkArm(uint32_t Reloc, SymbolBody &S) { // ARM relocations need ARM to Thumb interworking Thunks. // Thumb relocations need Thumb to ARM relocations. // Use position independent Thunks if we require position independent code. @@ -242,13 +237,13 @@ case R_ARM_PLT32: case R_ARM_JUMP24: if (Config->Pic) - return make>(S); - return make>(S); + return make>(S); + return make>(S); case R_ARM_THM_JUMP19: case R_ARM_THM_JUMP24: if (Config->Pic) - return make>(S); - return make>(S); + return make>(S); + return make>(S); } fatal("unrecognized relocation type"); } Index: test/ELF/arm-thumb-interwork-shared.s =================================================================== --- test/ELF/arm-thumb-interwork-shared.s +++ test/ELF/arm-thumb-interwork-shared.s @@ -16,15 +16,15 @@ // CHECK: Disassembly of section .text: // CHECK-NEXT: sym1: -// CHECK-NEXT: 1000: 00 f0 02 b8 b.w #4 <__ThumbToARMV7PILongThunk_elsewhere> -// CHECK-NEXT: 1004: 00 f0 06 b8 b.w #12 <__ThumbToARMV7PILongThunk_weakref> -// CHECK: __ThumbToARMV7PILongThunk_elsewhere: +// CHECK-NEXT: 1000: 00 f0 02 b8 b.w #4 <__ThumbV7PILongThunk_elsewhere> +// CHECK-NEXT: 1004: 00 f0 06 b8 b.w #12 <__ThumbV7PILongThunk_weakref> +// CHECK: __ThumbV7PILongThunk_elsewhere: // CHECK-NEXT: 1008: 40 f2 20 0c movw r12, #32 // CHECK-NEXT: 100c: c0 f2 00 0c movt r12, #0 // CHECK-NEXT: 1010: fc 44 add r12, pc // CHECK-NEXT: 1012: 60 47 bx r12 -// CHECK: __ThumbToARMV7PILongThunk_weakref: +// CHECK: __ThumbV7PILongThunk_weakref: // CHECK-NEXT: 1014: 40 f2 24 0c movw r12, #36 // CHECK-NEXT: 1018: c0 f2 00 0c movt r12, #0 // CHECK-NEXT: 101c: fc 44 add r12, pc Index: test/ELF/arm-thumb-interwork-thunk.s =================================================================== --- test/ELF/arm-thumb-interwork-thunk.s +++ test/ELF/arm-thumb-interwork-thunk.s @@ -82,26 +82,26 @@ // CHECK-ARM-ABS-ARM-NEXT: arm_caller: // CHECK-ARM-ABS-ARM-NEXT: 1300: 3e ff ff fa blx #-776 // CHECK-ARM-ABS-ARM-NEXT: 1304: 3d ff ff fa blx #-780 -// CHECK-ARM-ABS-ARM-NEXT: 1308: 06 00 00 ea b #24 <__ARMToThumbv7ABSLongThunk_thumb_callee1> -// CHECK-ARM-ABS-ARM-NEXT: 130c: 05 00 00 ea b #20 <__ARMToThumbv7ABSLongThunk_thumb_callee1> -// CHECK-ARM-ABS-ARM-NEXT: 1310: 07 00 00 ea b #28 <__ARMToThumbv7ABSLongThunk_thumb_callee2> -// CHECK-ARM-ABS-ARM-NEXT: 1314: 09 00 00 ea b #36 <__ARMToThumbv7ABSLongThunk_thumb_callee3> +// CHECK-ARM-ABS-ARM-NEXT: 1308: 06 00 00 ea b #24 <__ARMv7ABSLongThunk_thumb_callee1> +// CHECK-ARM-ABS-ARM-NEXT: 130c: 05 00 00 ea b #20 <__ARMv7ABSLongThunk_thumb_callee1> +// CHECK-ARM-ABS-ARM-NEXT: 1310: 07 00 00 ea b #28 <__ARMv7ABSLongThunk_thumb_callee2> +// CHECK-ARM-ABS-ARM-NEXT: 1314: 09 00 00 ea b #36 <__ARMv7ABSLongThunk_thumb_callee3> // CHECK-ARM-ABS-ARM-NEXT: 1318: 78 ff ff ea b #-544 // CHECK-ARM-ABS-ARM-NEXT: 131c: b7 00 00 0a beq #732 // CHECK-ARM-ABS-ARM-NEXT: 1320: b7 00 00 1a bne #732 // CHECK-ARM-ABS-ARM-NEXT: 1324: 1e ff 2f e1 bx lr -// CHECK-ARM-ABS-ARM: __ARMToThumbv7ABSLongThunk_thumb_callee1: +// CHECK-ARM-ABS-ARM: __ARMv7ABSLongThunk_thumb_callee1: // 0x1001 = thumb_callee1 // CHECK-ARM-ABS-ARM-NEXT: 1328: 01 c0 01 e3 movw r12, #4097 // CHECK-ARM-ABS-ARM-NEXT: 132c: 00 c0 40 e3 movt r12, #0 // CHECK-ARM-ABS-ARM-NEXT: 1330: 1c ff 2f e1 bx r12 // 0x1501 = thumb_callee2 -// CHECK-ARM-ABS-ARM: __ARMToThumbv7ABSLongThunk_thumb_callee2: +// CHECK-ARM-ABS-ARM: __ARMv7ABSLongThunk_thumb_callee2: // CHECK-ARM-ABS-ARM-NEXT: 1334: 01 c5 01 e3 movw r12, #5377 // CHECK-ARM-ABS-ARM-NEXT: 1338: 00 c0 40 e3 movt r12, #0 // CHECK-ARM-ABS-ARM-NEXT: 133c: 1c ff 2f e1 bx r12 // 0x1503 = thumb_callee3 -// CHECK-ARM-ABS-ARM: __ARMToThumbv7ABSLongThunk_thumb_callee3: +// CHECK-ARM-ABS-ARM: __ARMv7ABSLongThunk_thumb_callee3: // CHECK-ARM-ABS-ARM-NEXT: 1340: 03 c5 01 e3 movw r12, #5379 // CHECK-ARM-ABS-ARM-NEXT: 1344: 00 c0 40 e3 movt r12, #0 // CHECK-ARM-ABS-ARM-NEXT: 1348: 1c ff 2f e1 bx r12 @@ -110,27 +110,27 @@ // CHECK-PI-ARM-NEXT: arm_caller: // CHECK-PI-ARM-NEXT: 1300: 3e ff ff fa blx #-776 // CHECK-PI-ARM-NEXT: 1304: 3d ff ff fa blx #-780 -// CHECK-PI-ARM-NEXT: 1308: 06 00 00 ea b #24 <__ARMToThumbV7PILongThunk_thumb_callee1> -// CHECK-PI-ARM-NEXT: 130c: 05 00 00 ea b #20 <__ARMToThumbV7PILongThunk_thumb_callee1> -// CHECK-PI-ARM-NEXT: 1310: 08 00 00 ea b #32 <__ARMToThumbV7PILongThunk_thumb_callee2> -// CHECK-PI-ARM-NEXT: 1314: 0b 00 00 ea b #44 <__ARMToThumbV7PILongThunk_thumb_callee3> +// CHECK-PI-ARM-NEXT: 1308: 06 00 00 ea b #24 <__ARMV7PILongThunk_thumb_callee1> +// CHECK-PI-ARM-NEXT: 130c: 05 00 00 ea b #20 <__ARMV7PILongThunk_thumb_callee1> +// CHECK-PI-ARM-NEXT: 1310: 08 00 00 ea b #32 <__ARMV7PILongThunk_thumb_callee2> +// CHECK-PI-ARM-NEXT: 1314: 0b 00 00 ea b #44 <__ARMV7PILongThunk_thumb_callee3> // CHECK-PI-ARM-NEXT: 1318: 78 ff ff ea b #-544 // CHECK-PI-ARM-NEXT: 131c: b7 00 00 0a beq #732 // CHECK-PI-ARM-NEXT: 1320: b7 00 00 1a bne #732 // CHECK-PI-ARM-NEXT: 1324: 1e ff 2f e1 bx lr -// CHECK-PI-ARM: __ARMToThumbV7PILongThunk_thumb_callee1: +// CHECK-PI-ARM: __ARMV7PILongThunk_thumb_callee1: // 0x1330 + 8 - 0x337 = 0x1001 = thumb_callee1 // CHECK-PI-ARM-NEXT: 1328: c9 cc 0f e3 movw r12, #64713 // CHECK-PI-ARM-NEXT: 132c: ff cf 4f e3 movt r12, #65535 // CHECK-PI-ARM-NEXT: 1330: 0f c0 8c e0 add r12, r12, pc // CHECK-PI-ARM-NEXT: 1334: 1c ff 2f e1 bx r12 -// CHECK-PI-ARM: __ARMToThumbV7PILongThunk_thumb_callee2: +// CHECK-PI-ARM: __ARMV7PILongThunk_thumb_callee2: // CHECK-PI-ARM-NEXT: 1338: b9 c1 00 e3 movw r12, #441 // CHECK-PI-ARM-NEXT: 133c: 00 c0 40 e3 movt r12, #0 // CHECK-PI-ARM-NEXT: 1340: 0f c0 8c e0 add r12, r12, pc // CHECK-PI-ARM-NEXT: 1344: 1c ff 2f e1 bx r12 -// CHECK-PI-ARM: __ARMToThumbV7PILongThunk_thumb_callee3: +// CHECK-PI-ARM: __ARMV7PILongThunk_thumb_callee3: // 0x1340 + 8 + 0x1b9 = 0x1501 // CHECK-PI-ARM-NEXT: 1348: ab c1 00 e3 movw r12, #427 // CHECK-PI-ARM-NEXT: 134c: 00 c0 40 e3 movt r12, #0 @@ -187,24 +187,24 @@ // CHECK-ABS-THUMB-NEXT: thumb_caller: // CHECK-ABS-THUMB-NEXT: 1400: ff f7 7e ee blx #-772 // CHECK-ABS-THUMB-NEXT: 1404: ff f7 7c ee blx #-776 -// CHECK-ABS-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 <__ThumbToARMv7ABSLongThunk_arm_callee1> -// CHECK-ABS-THUMB-NEXT: 140c: 00 f0 0d b8 b.w #26 <__ThumbToARMv7ABSLongThunk_arm_callee2> -// CHECK-ABS-THUMB-NEXT: 1410: 00 f0 10 b8 b.w #32 <__ThumbToARMv7ABSLongThunk_arm_callee3> -// CHECK-ABS-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 <__ThumbToARMv7ABSLongThunk_arm_callee1> -// CHECK-ABS-THUMB-NEXT: 1418: 00 f0 07 80 beq.w #14 <__ThumbToARMv7ABSLongThunk_arm_callee2> -// CHECK-ABS-THUMB-NEXT: 141c: 40 f0 0a 80 bne.w #20 <__ThumbToARMv7ABSLongThunk_arm_callee3> -// CHECK-ABS-THUMB: __ThumbToARMv7ABSLongThunk_arm_callee1: +// CHECK-ABS-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 <__Thumbv7ABSLongThunk_arm_callee1> +// CHECK-ABS-THUMB-NEXT: 140c: 00 f0 0d b8 b.w #26 <__Thumbv7ABSLongThunk_arm_callee2> +// CHECK-ABS-THUMB-NEXT: 1410: 00 f0 10 b8 b.w #32 <__Thumbv7ABSLongThunk_arm_callee3> +// CHECK-ABS-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 <__Thumbv7ABSLongThunk_arm_callee1> +// CHECK-ABS-THUMB-NEXT: 1418: 00 f0 07 80 beq.w #14 <__Thumbv7ABSLongThunk_arm_callee2> +// CHECK-ABS-THUMB-NEXT: 141c: 40 f0 0a 80 bne.w #20 <__Thumbv7ABSLongThunk_arm_callee3> +// CHECK-ABS-THUMB: __Thumbv7ABSLongThunk_arm_callee1: // 0x1100 = arm_callee1 // CHECK-ABS-THUMB-NEXT: 1420: 41 f2 00 1c movw r12, #4352 // CHECK-ABS-THUMB-NEXT: 1424: c0 f2 00 0c movt r12, #0 // CHECK-ABS-THUMB-NEXT: 1428: 60 47 bx r12 -// CHECK-ABS-THUMB: __ThumbToARMv7ABSLongThunk_arm_callee2: +// CHECK-ABS-THUMB: __Thumbv7ABSLongThunk_arm_callee2: // 0x1600 = arm_callee2 // CHECK-ABS-THUMB-NEXT: 142a: 41 f2 00 6c movw r12, #5632 // CHECK-ABS-THUMB-NEXT: 142e: c0 f2 00 0c movt r12, #0 // CHECK-ABS-THUMB-NEXT: 1432: 60 47 bx r12 // 0x1604 = arm_callee3 -// CHECK-ABS-THUMB: __ThumbToARMv7ABSLongThunk_arm_callee3: +// CHECK-ABS-THUMB: __Thumbv7ABSLongThunk_arm_callee3: // CHECK-ABS-THUMB-NEXT: 1434: 41 f2 04 6c movw r12, #5636 // CHECK-ABS-THUMB-NEXT: 1438: c0 f2 00 0c movt r12, #0 // CHECK-ABS-THUMB-NEXT: 143c: 60 47 bx r12 @@ -213,25 +213,25 @@ // CHECK-PI-THUMB-NEXT: thumb_caller: // CHECK-PI-THUMB-NEXT: 1400: ff f7 7e ee blx #-772 // CHECK-PI-THUMB-NEXT: 1404: ff f7 7c ee blx #-776 -// CHECK-PI-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 <__ThumbToARMV7PILongThunk_arm_callee1> -// CHECK-PI-THUMB-NEXT: 140c: 00 f0 0e b8 b.w #28 <__ThumbToARMV7PILongThunk_arm_callee2> -// CHECK-PI-THUMB-NEXT: 1410: 00 f0 12 b8 b.w #36 <__ThumbToARMV7PILongThunk_arm_callee3> -// CHECK-PI-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 <__ThumbToARMV7PILongThunk_arm_callee1> -// CHECK-PI-THUMB-NEXT: 1418: 00 f0 08 80 beq.w #16 <__ThumbToARMV7PILongThunk_arm_callee2> -// CHECK-PI-THUMB-NEXT: 141c: 40 f0 0c 80 bne.w #24 <__ThumbToARMV7PILongThunk_arm_callee3> -// CHECK-PI-THUMB: __ThumbToARMV7PILongThunk_arm_callee1: +// CHECK-PI-THUMB-NEXT: 1408: 00 f0 0a b8 b.w #20 <__ThumbV7PILongThunk_arm_callee1> +// CHECK-PI-THUMB-NEXT: 140c: 00 f0 0e b8 b.w #28 <__ThumbV7PILongThunk_arm_callee2> +// CHECK-PI-THUMB-NEXT: 1410: 00 f0 12 b8 b.w #36 <__ThumbV7PILongThunk_arm_callee3> +// CHECK-PI-THUMB-NEXT: 1414: 00 f0 04 80 beq.w #8 <__ThumbV7PILongThunk_arm_callee1> +// CHECK-PI-THUMB-NEXT: 1418: 00 f0 08 80 beq.w #16 <__ThumbV7PILongThunk_arm_callee2> +// CHECK-PI-THUMB-NEXT: 141c: 40 f0 0c 80 bne.w #24 <__ThumbV7PILongThunk_arm_callee3> +// CHECK-PI-THUMB: __ThumbV7PILongThunk_arm_callee1: // 0x1428 + 4 - 0x32c = 0x1100 = arm_callee1 // CHECK-PI-THUMB-NEXT: 1420: 4f f6 d4 4c movw r12, #64724 // CHECK-PI-THUMB-NEXT: 1424: cf f6 ff 7c movt r12, #65535 // CHECK-PI-THUMB-NEXT: 1428: fc 44 add r12, pc // CHECK-PI-THUMB-NEXT: 142a: 60 47 bx r12 -// CHECK-PI-THUMB: __ThumbToARMV7PILongThunk_arm_callee2: +// CHECK-PI-THUMB: __ThumbV7PILongThunk_arm_callee2: // 0x1434 + 4 + 0x1c8 = 0x1600 = arm_callee2 // CHECK-PI-THUMB-NEXT: 142c: 40 f2 c8 1c movw r12, #456 // CHECK-PI-THUMB-NEXT: 1430: c0 f2 00 0c movt r12, #0 // CHECK-PI-THUMB-NEXT: 1434: fc 44 add r12, pc // CHECK-PI-THUMB-NEXT: 1436: 60 47 bx r12 -// CHECK-PI-THUMB: __ThumbToARMV7PILongThunk_arm_callee3: +// CHECK-PI-THUMB: __ThumbV7PILongThunk_arm_callee3: // 0x1440 + 4 + 0x1c0 = 0x1604 = arm_callee3 // CHECK-PI-THUMB-NEXT: 1438: 40 f2 c0 1c movw r12, #448 // CHECK-PI-THUMB-NEXT: 143c: c0 f2 00 0c movt r12, #0