Skip to content

Commit 69870a5

Browse files
committed
Update some diagnostics in readEntry and clang-format
1 parent 22f1ef4 commit 69870a5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lld/ELF/SyntheticSections.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "llvm/Support/LEB128.h"
4343
#include "llvm/Support/Parallel.h"
4444
#include "llvm/Support/TimeProfiler.h"
45+
#include <cinttypes>
4546
#include <cstdlib>
4647

4748
using namespace llvm;
@@ -2744,18 +2745,17 @@ readEntry(uint64_t &offset, const DWARFDebugNames::NameIndex &ni,
27442745
uint64_t ulebVal = namesExtractor.getULEB128(&offset, &err);
27452746
if (err)
27462747
return createStringError(inconvertibleErrorCode(),
2747-
"invalid abbrev code in entry: %s",
2748+
"invalid abbrev code: %s",
27482749
toString(std::move(err)).c_str());
2749-
if (ulebVal <= UINT32_MAX)
2750-
ie->abbrevCode = static_cast<uint32_t>(ulebVal);
2751-
else
2750+
if (!isUInt<32>(ulebVal))
27522751
return createStringError(inconvertibleErrorCode(),
2753-
"abbrev code in entry too large for DWARF32: %d",
2752+
"abbrev code too large for DWARF32: %" PRIu64,
27542753
ulebVal);
2754+
ie->abbrevCode = static_cast<uint32_t>(ulebVal);
27552755
auto it = ni.getAbbrevs().find_as(ie->abbrevCode);
27562756
if (it == ni.getAbbrevs().end())
27572757
return createStringError(inconvertibleErrorCode(),
2758-
"entry abbrev code not found in abbrev table: %d",
2758+
"abbrev code not found in abbrev table: %" PRIu32,
27592759
ie->abbrevCode);
27602760

27612761
DebugNamesBaseSection::AttrValue attr, cuAttr = {0, 0};
@@ -2806,7 +2806,6 @@ readEntry(uint64_t &offset, const DWARFDebugNames::NameIndex &ni,
28062806

28072807
// Canonicalize abbrev by placing the CU/TU index at the end.
28082808
ie->attrValues.push_back(cuAttr);
2809-
28102809
return ie;
28112810
}
28122811

@@ -2919,7 +2918,7 @@ void DebugNamesBaseSection::computeHdrAndAbbrevTable(
29192918
hdr.CompUnitCount += nd.hdr.CompUnitCount;
29202919
// TODO: We don't handle type units yet, so LocalTypeUnitCount &
29212920
// ForeignTypeUnitCount are left as 0.
2922-
if (nd.hdr.LocalTypeUnitCount || nd. hdr.ForeignTypeUnitCount)
2921+
if (nd.hdr.LocalTypeUnitCount || nd.hdr.ForeignTypeUnitCount)
29232922
warn(toString(inputChunk.section.sec) +
29242923
Twine(": type units are not implemented"));
29252924
// If augmentation strings are not identical, use an empty string.

lld/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ ELF Improvements
3333
``R_AARCH64_AUTH_RELATIVE`` relocations are now supported.
3434
(`#72714 <https://github.com/llvm/llvm-project/pull/72714>`_)
3535
* ``--debug-names`` is added to create a merged ``.debug_names`` index
36-
from input ``.debug_names`` sections.
36+
from input ``.debug_names`` sections. Type units are not handled yet.
37+
(`#86508 <https://github.com/llvm/llvm-project/pull/86508>`_)
3738

3839
Breaking changes
3940
----------------

lld/test/ELF/debug-names-bad.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# RUN: ld.lld --debug-names bad-abbrev-code.o -o bad-abbrev-code --noinhibit-exec
4242
# RUN: llvm-dwarfdump --debug-names bad-abbrev-code | FileCheck %s --check-prefix=BAD-ABBREV-CODE-DWARF
4343

44-
# BAD-ABBREV-CODE: error: bad-abbrev-code.o:(.debug_names): entry abbrev code not found in abbrev table: 3
44+
# BAD-ABBREV-CODE: error: bad-abbrev-code.o:(.debug_names): abbrev code not found in abbrev table: 3
4545

4646
# BAD-ABBREV-CODE-DWARF: Abbreviations [
4747
# BAD-ABBREV-CODE-DWARF-NEXT: Abbreviation 0x1 {

0 commit comments

Comments
 (0)