Skip to content

Commit ee19eb3

Browse files
committed
[ELF] Change some upper-case utohexstr to lower-case to improve consistency
The convention is to use lower-case addresses.
1 parent 10b9847 commit ee19eb3

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

lld/ELF/Arch/Hexagon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static uint32_t findMaskR6(Ctx &ctx, uint32_t insn) {
199199
return i.relocMask;
200200

201201
Err(ctx) << "unrecognized instruction for 6_X relocation: 0x"
202-
<< utohexstr(insn);
202+
<< utohexstr(insn, true);
203203
return 0;
204204
}
205205

lld/ELF/Arch/PPC64.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ void PPC64::relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) const {
695695
if (pcRelInsn == UINT64_C(-1)) {
696696
Err(ctx)
697697
<< "unrecognized instruction for R_PPC64_PCREL_OPT relaxation: 0x"
698-
<< Twine::utohexstr(accessInsn);
698+
<< utohexstr(accessInsn, true);
699699
break;
700700
}
701701

@@ -1337,7 +1337,7 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
13371337
if (isInstructionUpdateForm(insn))
13381338
Err(ctx) << getErrorLoc(ctx, loc)
13391339
<< "can't toc-optimize an update instruction: 0x"
1340-
<< utohexstr(insn);
1340+
<< utohexstr(insn, true);
13411341
writeFromHalf16(ctx, loc, (insn & 0xffe00000) | 0x00020000 | lo(val));
13421342
} else {
13431343
write16(ctx, loc, lo(val));
@@ -1356,8 +1356,8 @@ void PPC64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const {
13561356
// pointer register r2, as the base register.
13571357
if (isInstructionUpdateForm(insn))
13581358
Err(ctx) << getErrorLoc(ctx, loc)
1359-
<< "Can't toc-optimize an update instruction: 0x"
1360-
<< Twine::utohexstr(insn);
1359+
<< "can't toc-optimize an update instruction: 0x"
1360+
<< utohexstr(insn, true);
13611361
insn &= 0xffe00000 | mask;
13621362
writeFromHalf16(ctx, loc, insn | 0x00020000 | lo(val));
13631363
} else {

lld/ELF/OutputSections.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ void OutputSection::commitSection(InputSection *isec) {
155155
// Otherwise, check if new type or flags are compatible with existing ones.
156156
if ((flags ^ isec->flags) & SHF_TLS)
157157
ErrAlways(ctx) << "incompatible section flags for " << name << "\n>>> "
158-
<< isec << ": 0x" << utohexstr(isec->flags)
158+
<< isec << ": 0x" << utohexstr(isec->flags, true)
159159
<< "\n>>> output section " << name << ": 0x"
160-
<< utohexstr(flags);
160+
<< utohexstr(flags, true);
161161
}
162162

163163
isec->parent = this;

lld/ELF/Writer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,8 +2672,9 @@ template <class ELFT> void Writer<ELFT>::checkSections() {
26722672
for (OutputSection *os : ctx.outputSections)
26732673
if ((os->addr + os->size < os->addr) ||
26742674
(!ELFT::Is64Bits && os->addr + os->size > uint64_t(UINT32_MAX) + 1))
2675-
Err(ctx) << "section " << os->name << " at 0x" << utohexstr(os->addr)
2676-
<< " of size 0x" << utohexstr(os->size)
2675+
Err(ctx) << "section " << os->name << " at 0x"
2676+
<< utohexstr(os->addr, true) << " of size 0x"
2677+
<< utohexstr(os->size, true)
26772678
<< " exceeds available address space";
26782679

26792680
// Check for overlapping file offsets. In this case we need to skip any

lld/test/ELF/linkerscript/i386-sections-max-va-overflow.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## .bar section has data in [0xfffffff1, 0xfffffff1 + 0x10] == [0xfffffff1, 0x1].
99
## Check we can catch this overflow.
10-
# ERR: error: section .bar at 0xFFFFFFF1 of size 0x10 exceeds available address space
10+
# ERR: error: section .bar at 0xfffffff1 of size 0x10 exceeds available address space
1111

1212
## [0xfffffff1, 0x100000000) is allowed.
1313
# RUN: echo "SECTIONS { . = 0xfffffff0;" > %t.script

lld/test/ELF/linkerscript/locationcountererr-arm-exidx.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# ERR-NEXT: error: a.t:10: unable to move location counter (0x2000) backward to 0x1f6c for section 'dummy2'
1313
# ERR-NEXT: error: a.t:14: unable to move location counter (0x4104) backward to 0x4070 for section 'code.unused_space'
1414
# ERR-NEXT: error: section '.ARM.exidx' will not fit in region 'CODE': overflowed by 148 bytes
15-
# ERR-NEXT: error: section dummy1 at 0x1000 of size 0xFFFFFFFFFFFFFF6C exceeds available address space
16-
# ERR-NEXT: error: section dummy2 at 0x2000 of size 0xFFFFFFFFFFFFFF6C exceeds available address space
17-
# ERR-NEXT: error: section code.unused_space at 0x4104 of size 0xFFFFFFFFFFFFFF6C exceeds available address space
15+
# ERR-NEXT: error: section dummy1 at 0x1000 of size 0xffffffffffffff6c exceeds available address space
16+
# ERR-NEXT: error: section dummy2 at 0x2000 of size 0xffffffffffffff6c exceeds available address space
17+
# ERR-NEXT: error: section code.unused_space at 0x4104 of size 0xffffffffffffff6c exceeds available address space
1818

1919
## If we merge adjacent duplicate entries, we will have enough space. Don't report
2020
## a spurious error https://github.com/llvm/llvm-project/issues/66836

lld/test/ELF/linkerscript/sections-max-va-overflow.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## .bar section has data in [0xfffffffffffffff1, 0xfffffffffffffff1 + 0x10] ==
99
## [0xfffffffffffffff1, 0x1]. Check we can catch this overflow.
10-
# ERR: error: section .bar at 0xFFFFFFFFFFFFFFF1 of size 0x10 exceeds available address space
10+
# ERR: error: section .bar at 0xfffffffffffffff1 of size 0x10 exceeds available address space
1111

1212
.section .bar,"ax",@progbits
1313
.zero 0x10

0 commit comments

Comments
 (0)