From 8a28c6694882a47c99de2a7a19724af43411ea9a Mon Sep 17 00:00:00 2001 From: Pavel Kopyl Date: Tue, 28 Jan 2025 01:47:25 +0100 Subject: [PATCH] [EVM][LLD] relocate: remove wrong numeric limit --- lld/ELF/Arch/EVM.cpp | 4 +--- lld/unittests/EVM/LLDTest.cpp | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lld/ELF/Arch/EVM.cpp b/lld/ELF/Arch/EVM.cpp index ac2ab5ff9f25..a61dab9e1be3 100644 --- a/lld/ELF/Arch/EVM.cpp +++ b/lld/ELF/Arch/EVM.cpp @@ -60,9 +60,7 @@ RelExpr EVM::getRelExpr(RelType type, const Symbol &s, void EVM::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { switch (rel.type) { case R_EVM_DATA: { - if (val > std::numeric_limits::max()) - llvm_unreachable("R_EVM_DATA: to big relocation value"); - write32be(loc, val); + write32be(loc, static_cast(val)); break; } default: diff --git a/lld/unittests/EVM/LLDTest.cpp b/lld/unittests/EVM/LLDTest.cpp index fca988429a26..c70442297bdd 100644 --- a/lld/unittests/EVM/LLDTest.cpp +++ b/lld/unittests/EVM/LLDTest.cpp @@ -136,7 +136,8 @@ define i256 @foo() { \n\ const char *LinkerSymbol[2] = {"library_id", "library_id2"}; const char LinkerSymbolVal[2][20] = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, - {7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}; + {'\x9f', 0x1E, '\xBB', '\xF1', 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}}; StringRef SymVal1(LinkerSymbolVal[0], 20); StringRef SymVal2(LinkerSymbolVal[1], 20);