From c1a6defd9ff1540638d660888c5f32ea5cf4fa7d Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 16 Nov 2024 20:26:33 -0800 Subject: [ELF] Make RelType a struct type otherwise operator<<(const ELFSyncStream &s, RelType type) applies to non-reloc-type uint32_t, which can be confusing. --- lld/ELF/InputFiles.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lld/ELF/InputFiles.cpp') diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 5a446f3544ad..011ad7e26985 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -1042,8 +1042,8 @@ InputSectionBase *ObjFile::getRelocTarget(uint32_t idx, uint32_t info) { return target; } - ErrAlways(ctx) << this << Twine(": relocation section (index ") << Twine(idx) - << ") has invalid sh_info (" << Twine(info) << ")"; + ErrAlways(ctx) << this << Twine(": relocation section (index ") << idx + << ") has invalid sh_info (" << info << ')'; return nullptr; } @@ -1211,9 +1211,8 @@ void ObjFile::initSectionsAndLocalSyms(bool ignoreComdats) { if (LLVM_UNLIKELY(secIdx >= sections.size())) Fatal(ctx) << this << ": invalid section index: " << Twine(secIdx); if (LLVM_UNLIKELY(eSym.getBinding() != STB_LOCAL)) - ErrAlways(ctx) << this << ": non-local symbol (" << Twine(i) - << ") found at index < .symtab's sh_info (" << Twine(end) - << ")"; + ErrAlways(ctx) << this << ": non-local symbol (" << i + << ") found at index < .symtab's sh_info (" << end << ")"; InputSectionBase *sec = sections[secIdx]; uint8_t type = eSym.getType(); @@ -1247,8 +1246,8 @@ template void ObjFile::postParse() { uint8_t binding = eSym.getBinding(); if (LLVM_UNLIKELY(binding != STB_GLOBAL && binding != STB_WEAK && binding != STB_GNU_UNIQUE)) - Err(ctx) << this << ": symbol (" << Twine(i) - << ") has invalid binding: " << Twine((int)binding); + Err(ctx) << this << ": symbol (" << i + << ") has invalid binding: " << (int)binding; // st_value of STT_TLS represents the assigned offset, not the actual // address which is used by STT_FUNC and STT_OBJECT. STT_TLS symbols can -- cgit v1.2.3