@@ -727,38 +727,15 @@ void PPC64::relaxTlsGdToLe(uint8_t *loc, const Relocation &rel,
727
727
writeFromHalf16 (loc, 0x3c6d0000 ); // addis r3, r13
728
728
relocateNoSym (loc, R_PPC64_TPREL16_HA, val);
729
729
break ;
730
- case R_PPC64_GOT_TLSGD_PCREL34:
731
- // Relax from paddi r3, 0, x@got@tlsgd@pcrel, 1 to
732
- // paddi r3, r13, x@tprel, 0
733
- writePrefixedInstruction (loc, 0x06000000386d0000 );
734
- relocateNoSym (loc, R_PPC64_TPREL34, val);
735
- break ;
736
- case R_PPC64_TLSGD: {
737
- // PC Relative Relaxation:
738
- // Relax from bl __tls_get_addr@notoc(x@tlsgd) to
739
- // nop
740
- // TOC Relaxation:
741
- // Relax from bl __tls_get_addr(x@tlsgd)
742
- // nop
743
- // to
744
- // nop
745
- // addi r3, r3, x@tprel@l
746
- const uintptr_t locAsInt = reinterpret_cast <uintptr_t >(loc);
747
- if (locAsInt % 4 == 0 ) {
748
- write32 (loc, NOP); // nop
749
- write32 (loc + 4 , 0x38630000 ); // addi r3, r3
750
- // Since we are relocating a half16 type relocation and Loc + 4 points to
751
- // the start of an instruction we need to advance the buffer by an extra
752
- // 2 bytes on BE.
753
- relocateNoSym (loc + 4 + (config->ekind == ELF64BEKind ? 2 : 0 ),
754
- R_PPC64_TPREL16_LO, val);
755
- } else if (locAsInt % 4 == 1 ) {
756
- write32 (loc - 1 , NOP);
757
- } else {
758
- errorOrWarn (" R_PPC64_TLSGD has unexpected byte alignment" );
759
- }
730
+ case R_PPC64_TLSGD:
731
+ write32 (loc, NOP);
732
+ write32 (loc + 4 , 0x38630000 ); // addi r3, r3
733
+ // Since we are relocating a half16 type relocation and Loc + 4 points to
734
+ // the start of an instruction we need to advance the buffer by an extra
735
+ // 2 bytes on BE.
736
+ relocateNoSym (loc + 4 + (config->ekind == ELF64BEKind ? 2 : 0 ),
737
+ R_PPC64_TPREL16_LO, val);
760
738
break ;
761
- }
762
739
default :
763
740
llvm_unreachable (" unsupported relocation for TLS GD to LE relaxation" );
764
741
}
@@ -970,8 +947,6 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &s,
970
947
case R_PPC64_GOT_TLSGD16_HI:
971
948
case R_PPC64_GOT_TLSGD16_LO:
972
949
return R_TLSGD_GOT;
973
- case R_PPC64_GOT_TLSGD_PCREL34:
974
- return R_TLSGD_PC;
975
950
case R_PPC64_GOT_TLSLD16:
976
951
case R_PPC64_GOT_TLSLD16_HA:
977
952
case R_PPC64_GOT_TLSLD16_HI:
@@ -1286,7 +1261,6 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
1286
1261
break ;
1287
1262
case R_PPC64_PCREL34:
1288
1263
case R_PPC64_GOT_PCREL34:
1289
- case R_PPC64_GOT_TLSGD_PCREL34:
1290
1264
case R_PPC64_GOT_TPREL_PCREL34:
1291
1265
case R_PPC64_TPREL34: {
1292
1266
const uint64_t si0Mask = 0x00000003ffff0000 ;
@@ -1366,8 +1340,7 @@ RelExpr PPC64::adjustRelaxExpr(RelType type, const uint8_t *data,
1366
1340
if ((readPrefixedInstruction (data) & 0xfc000000 ) == 0xe4000000 )
1367
1341
return R_PPC64_RELAX_GOT_PC;
1368
1342
}
1369
-
1370
- if (type != R_PPC64_GOT_TLSGD_PCREL34 && expr == R_RELAX_TLS_GD_TO_IE)
1343
+ if (expr == R_RELAX_TLS_GD_TO_IE)
1371
1344
return R_RELAX_TLS_GD_TO_IE_GOT_OFF;
1372
1345
if (expr == R_RELAX_TLS_LD_TO_LE)
1373
1346
return R_RELAX_TLS_LD_TO_LE_ABS;
@@ -1408,35 +1381,10 @@ void PPC64::relaxTlsGdToIe(uint8_t *loc, const Relocation &rel,
1408
1381
relocateNoSym (loc, R_PPC64_GOT_TPREL16_LO_DS, val);
1409
1382
return ;
1410
1383
}
1411
- case R_PPC64_GOT_TLSGD_PCREL34: {
1412
- // Relax from paddi r3, 0, sym@got@tlsgd@pcrel, 1 to
1413
- // pld r3, sym@got@tprel@pcrel
1414
- writePrefixedInstruction (loc, 0x04100000e4600000 );
1415
- relocateNoSym (loc, R_PPC64_GOT_TPREL_PCREL34, val);
1416
- return ;
1417
- }
1418
- case R_PPC64_TLSGD: {
1419
- // PC Relative Relaxation:
1420
- // Relax from bl __tls_get_addr@notoc(x@tlsgd) to
1421
- // nop
1422
- // TOC Relaxation:
1423
- // Relax from bl __tls_get_addr(x@tlsgd)
1424
- // nop
1425
- // to
1426
- // nop
1427
- // add r3, r3, r13
1428
- const uintptr_t locAsInt = reinterpret_cast <uintptr_t >(loc);
1429
- if (locAsInt % 4 == 0 ) {
1430
- write32 (loc, NOP); // bl __tls_get_addr(sym@tlsgd) --> nop
1431
- write32 (loc + 4 , 0x7c636A14 ); // nop --> add r3, r3, r13
1432
- } else if (locAsInt % 4 == 1 ) {
1433
- // bl __tls_get_addr(sym@tlsgd) --> add r3, r3, r13
1434
- write32 (loc - 1 , 0x7c636a14 );
1435
- } else {
1436
- errorOrWarn (" R_PPC64_TLSGD has unexpected byte alignment" );
1437
- }
1384
+ case R_PPC64_TLSGD:
1385
+ write32 (loc, NOP); // bl __tls_get_addr(sym@tlsgd) --> nop
1386
+ write32 (loc + 4 , 0x7c636A14 ); // nop --> add r3, r3, r13
1438
1387
return ;
1439
- }
1440
1388
default :
1441
1389
llvm_unreachable (" unsupported relocation for TLS GD to IE relaxation" );
1442
1390
}
0 commit comments