Skip to content

Commit 243ec8f

Browse files
committed
[NFC] Fix code format
1 parent f74ad7a commit 243ec8f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lld/ELF/Arch/LoongArch.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,9 @@ void LoongArch::tlsdescToIe(uint8_t *loc, const Relocation &rel,
11001100

11011101
// Convert TLSDESC GD/LD to LE.
11021102
// The code sequence obtained in the normal or medium code model is as follows:
1103-
// * lu12i.w $a0, %le_hi20(sym_le) # le_hi20 != 0
1104-
// * ori $a0 $a0, %le_lo12(sym_le)
1103+
// * lu12i.w $a0, %le_hi20(sym) # le_hi20 != 0, otherwise NOP
1104+
// * ori $a0, src, %le_lo12(sym) # le_hi20 != 0, src = $a0,
1105+
// # otherwise, src = $zero
11051106
// See the comment in tlsdescToIe for detailed information.
11061107
void LoongArch::tlsdescToLe(uint8_t *loc, const Relocation &rel,
11071108
uint64_t val) const {
@@ -1124,7 +1125,7 @@ void LoongArch::tlsdescToLe(uint8_t *loc, const Relocation &rel,
11241125
break;
11251126
case R_LARCH_TLS_DESC_CALL:
11261127
if (isUInt12)
1127-
write32le(loc, insn(ORI, R_A0, R_ZERO, val)); // ori $a0, $r0, %le_lo12
1128+
write32le(loc, insn(ORI, R_A0, R_ZERO, val)); // ori $a0, $zero, %le_lo12
11281129
else
11291130
write32le(loc,
11301131
insn(ORI, R_A0, R_A0, lo12(val))); // ori $a0, $a0, %le_lo12
@@ -1179,7 +1180,7 @@ void LoongArch::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
11791180
// * i+2 -- R_LARCH_TLS_IE64_PC_LO20
11801181
// * i+3 -- R_LARCH_TLS_IE64_PC_HI12
11811182
isExtreme =
1182-
(i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_IE64_PC_LO20);
1183+
i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_IE64_PC_LO20;
11831184
}
11841185
if (isExtreme) {
11851186
rel.expr = getRelExpr(rel.type, *rel.sym, loc);
@@ -1203,7 +1204,7 @@ void LoongArch::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
12031204
// * i+2 -- R_LARCH_TLS_DESC64_PC_LO20
12041205
// * i+3 -- R_LARCH_TLS_DESC64_PC_HI12
12051206
isExtreme =
1206-
(i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_DESC64_PC_LO20);
1207+
i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_DESC64_PC_LO20;
12071208
}
12081209
[[fallthrough]];
12091210
case R_RELAX_TLS_GD_TO_IE_ABS:
@@ -1221,7 +1222,7 @@ void LoongArch::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const {
12211222
case R_RELAX_TLS_GD_TO_LE:
12221223
if (rel.type == R_LARCH_TLS_DESC_PC_HI20) {
12231224
isExtreme =
1224-
(i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_DESC64_PC_LO20);
1225+
i + 2 < size && relocs[i + 2].type == R_LARCH_TLS_DESC64_PC_LO20;
12251226
}
12261227
if (isExtreme) {
12271228
if (rel.type == R_LARCH_TLS_DESC_CALL)

0 commit comments

Comments
 (0)