File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
test/tools/yulInterpreter Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -534,7 +534,8 @@ u256 EVMInstructionInterpreter::evalBuiltin(
534534 return u256 (keccak256 (arg)) & 0xfff ;
535535 }
536536 }
537- else if (fun == " datacopy" )
537+
538+ if (fun == " datacopy" )
538539 {
539540 // This is identical to codecopy.
540541 if (
@@ -550,11 +551,21 @@ u256 EVMInstructionInterpreter::evalBuiltin(
550551 );
551552 return 0 ;
552553 }
553- else if (fun == " memoryguard" )
554+
555+ if (fun == " memoryguard" )
554556 return _evaluatedArguments.at (0 );
555- else
556- yulAssert (false , " Unknown builtin: " + fun);
557- return 0 ;
557+
558+ if (fun == " linkersymbol" )
559+ {
560+ yulAssert (_arguments.size () == 1 );
561+ yulAssert (std::holds_alternative<Literal>(_arguments[0 ]));
562+ std::string const placeholder = formatLiteral (std::get<Literal>(_arguments[0 ]));
563+ h256 const identifier (keccak256 (placeholder));
564+ m_linkerSymbols.emplace (identifier, placeholder);
565+ return 0 ;
566+ }
567+
568+ yulAssert (false , " Unknown builtin: " + fun);
558569}
559570
560571
Original file line number Diff line number Diff line change @@ -168,6 +168,10 @@ class EVMInstructionInterpreter
168168 InterpreterState& m_state;
169169 // / Flag to disable trace of instructions that write to memory.
170170 bool m_disableMemoryWriteInstructions;
171+ // / mapping from linker identifier (hash of literal) to original string representation, populated by linkersymbol
172+ // / calls
173+ std::map<util::h256, std::string> m_linkerSymbols;
174+
171175public:
172176 // / Maximum length for range-based memory access operations.
173177 static constexpr unsigned s_maxRangeSize = 0xffff ;
You can’t perform that action at this time.
0 commit comments