@@ -1014,8 +1014,8 @@ static bool relax(Ctx &ctx, InputSection &sec) {
1014
1014
// * ld.d $a0, $a0, %ie_pc_lo12(sym)
1015
1015
//
1016
1016
// The code sequence converted is as follows:
1017
- // * lu12i.w $a0, %le_hi20(sym) # le_hi20 != 0, otherwise NOP
1018
- // * ori $a0 $a0, %le_lo12(sym)
1017
+ // * lu12i.w $a0, %le_hi20(sym) # le_hi20 != 0, otherwise NOP
1018
+ // * ori $a0, src, %le_lo12(sym) # le_hi20 != 0, src = $a0, otherwise src = $zero
1019
1019
//
1020
1020
// When relaxation enables, redundant NOPs can be removed.
1021
1021
void LoongArch::tlsIeToLe (uint8_t *loc, const Relocation &rel,
@@ -1036,7 +1036,7 @@ void LoongArch::tlsIeToLe(uint8_t *loc, const Relocation &rel,
1036
1036
case R_LARCH_TLS_IE_PC_LO12:
1037
1037
if (isUInt12)
1038
1038
write32le (loc, insn (ORI, getD5 (currInsn), R_ZERO,
1039
- val)); // ori $a0, $r0 , %le_lo12
1039
+ val)); // ori $a0, $zero , %le_lo12
1040
1040
else
1041
1041
write32le (loc, insn (ORI, getD5 (currInsn), getJ5 (currInsn),
1042
1042
lo12 (val))); // ori $a0, $a0, %le_lo12
@@ -1064,7 +1064,7 @@ void LoongArch::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
1064
1064
continue ;
1065
1065
case R_RELAX_TLS_IE_TO_LE:
1066
1066
if (rel.type == R_LARCH_TLS_IE_PC_HI20) {
1067
- // LoongArch does not support IE to LE optimize in the extreme code
1067
+ // LoongArch does not support IE to LE optimization in the extreme code
1068
1068
// model. In this case, the relocs are as follows:
1069
1069
//
1070
1070
// * i -- R_LARCH_TLS_IE_PC_HI20
@@ -1079,8 +1079,9 @@ void LoongArch::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
1079
1079
val = SignExtend64 (sec.getRelocTargetVA (ctx, rel, secAddr + rel.offset ),
1080
1080
bits);
1081
1081
relocateNoSym (loc, rel.type , val);
1082
- } else
1082
+ } else {
1083
1083
tlsIeToLe (loc, rel, val);
1084
+ }
1084
1085
continue ;
1085
1086
default :
1086
1087
break ;
0 commit comments