Skip to content

Commit

Permalink
[EVM][LLD] relocate: remove wrong numeric limit
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelKopyl authored and akiramenai committed Jan 28, 2025
1 parent a83a0fd commit 8a28c66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lld/ELF/Arch/EVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>::max())
llvm_unreachable("R_EVM_DATA: to big relocation value");
write32be(loc, val);
write32be(loc, static_cast<uint32_t>(val));
break;
}
default:
Expand Down
3 changes: 2 additions & 1 deletion lld/unittests/EVM/LLDTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8a28c66

Please sign in to comment.