@@ -224,7 +224,7 @@ createEraVMExeLinkerScript(uint64_t metadataSize,
224224 std::to_string (alignedMDSize), std::to_string (metadataSize))
225225 .str ();
226226
227- Twine scriptPart1 = Twine ( " \
227+ std::string scriptPart1 = " \
228228ENTRY(0); \n \
229229SECTIONS { \n \
230230 .code : SUBALIGN(1) { \n \
@@ -241,9 +241,9 @@ SECTIONS { \n\
241241 \n \
242242 ASSERT(. % 32 == 0, \" size isn't multiple of 32\" ); \n \
243243 \n \
244- /* Add padding before the metadata */\n " ) ;
244+ /* Add padding before the metadata */\n " ;
245245
246- Twine scriptPart2 = Twine ( " \
246+ std::string scriptPart2 = " \
247247 *(.eravm-metadata) \n \
248248 \n \
249249 ASSERT(. % 64 == 32, \" size isn't odd number of words\" ); \n \
@@ -256,9 +256,9 @@ SECTIONS { \n\
256256 is not needed. */ \n \
257257 /DISCARD/ : { \n \
258258 *(.data) \n \
259- }}" ) ;
259+ }}" ;
260260
261- return ( linkerSymbolNamesStr + scriptPart1 + padding + scriptPart2). str () ;
261+ return linkerSymbolNamesStr + scriptPart1 + padding + scriptPart2;
262262}
263263
264264// / Performs linkage of the ELF object file passed in \p inBuffer, as
@@ -499,9 +499,11 @@ static std::string creteEVMLinkerScript(ArrayRef<LLVMMemoryBufferRef> memBufs,
499499 // __dataoffset_D_105_deployed = .;
500500 // D_105_deployed(.text);
501501 // __datasize_D_105_deployed = . - __dataoffset_D_105_deployed;
502- Twine topLevel = topName + " (.text);\n " + dataOffsetPrefix + deployed +
503- " = .;\n " + deployed + " (.text);\n " + dataSizePrefix +
504- deployed + " = . - " + dataOffsetPrefix + deployed + " ;\n " ;
502+ std::string topLevel =
503+ (topName + " (.text);\n " + dataOffsetPrefix + deployed + " = .;\n " +
504+ deployed + " (.text);\n " + dataSizePrefix + deployed + " = . - " +
505+ dataOffsetPrefix + deployed + " ;\n " )
506+ .str ();
505507
506508 // Contains symbols whose values are the sizes of the dependent contracts.
507509 // For the example above, this contains:
@@ -541,9 +543,10 @@ static std::string creteEVMLinkerScript(ArrayRef<LLVMMemoryBufferRef> memBufs,
541543 // Emit size of the deploy code offset as the 4-byte unsigned integer.
542544 // This is needed to determine which offset the deployed code starts at
543545 // in the linked binary.
544- Twine deploySize = " LONG(" + dataOffsetPrefix + deployed + " );\n " ;
546+ std::string deploySize =
547+ (" LONG(" + dataOffsetPrefix + deployed + " );\n " ).str ();
545548
546- Twine script = formatv (" {0}\n \
549+ std::string script = formatv (" {0}\n \
547550ENTRY(0);\n \
548551SECTIONS {\n \
549552 . = 0;\n \
@@ -555,10 +558,10 @@ SECTIONS {\n\
555558 }\n \
556559}\n \
557560" ,
558- symDatasizeDeps, topLevel, symDataOffsetDeps,
559- symDatasizeTop, deploySize);
561+ symDatasizeDeps, topLevel, symDataOffsetDeps,
562+ symDatasizeTop, deploySize);
560563
561- return script. str () ;
564+ return script;
562565}
563566
564567LLVMBool LLVMLinkEVM (LLVMMemoryBufferRef inBuffers[],
@@ -588,11 +591,11 @@ LLVMBool LLVMLinkEVM(LLVMMemoryBufferRef inBuffers[],
588591
589592 // Use remapping of file names (a linker feature) to replace file names with
590593 // indexes in the array of memory buffers.
591- Twine remapStr (" --remap-inputs=" );
592- std::string remapDeployStr = ( remapStr + inBuffersIDs[0 ] + " =0" ). str () ;
594+ const std::string remapStr (" --remap-inputs=" );
595+ std::string remapDeployStr = remapStr + inBuffersIDs[0 ] + " =0" ;
593596 lldArgs.push_back (remapDeployStr.c_str ());
594597
595- std::string remapDeployedStr = ( remapStr + inBuffersIDs[1 ] + " =1" ). str () ;
598+ std::string remapDeployedStr = remapStr + inBuffersIDs[1 ] + " =1" ;
596599 lldArgs.push_back (remapDeployedStr.c_str ());
597600
598601 lldArgs.push_back (" --remap-inputs=script.x=2" );
0 commit comments