mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #10297 from ethereum/linker-fix-spurious-errors-on-underscores
[linker] Avoid spurious errors on stray underscores in --link input
This commit is contained in:
		
						commit
						f9f9f6251d
					
				| @ -55,6 +55,7 @@ | ||||
| #include <libsolutil/CommonIO.h> | ||||
| #include <libsolutil/JSON.h> | ||||
| 
 | ||||
| #include <algorithm> | ||||
| #include <memory> | ||||
| 
 | ||||
| #include <boost/filesystem.hpp> | ||||
| @ -1780,20 +1781,26 @@ bool CommandLineInterface::link() | ||||
| 		{ | ||||
| 			while (it != end && *it != '_') ++it; | ||||
| 			if (it == end) break; | ||||
| 			if (end - it < placeholderSize) | ||||
| 			if ( | ||||
| 				end - it < placeholderSize || | ||||
| 				*(it + 1) != '_' || | ||||
| 				*(it + placeholderSize - 2) != '_' || | ||||
| 				*(it + placeholderSize - 1) != '_' | ||||
| 			) | ||||
| 			{ | ||||
| 				serr() << "Error in binary object file " << src.first << " at position " << (end - src.second.begin()) << endl; | ||||
| 				serr() << "Error in binary object file " << src.first << " at position " << (it - src.second.begin()) << endl; | ||||
| 				serr() << '"' << string(it, it + min(placeholderSize, static_cast<int>(end - it))) << "\" is not a valid link reference." << endl; | ||||
| 				return false; | ||||
| 			} | ||||
| 
 | ||||
| 			string name(it, it + placeholderSize); | ||||
| 			if (librariesReplacements.count(name)) | ||||
| 			string foundPlaceholder(it, it + placeholderSize); | ||||
| 			if (librariesReplacements.count(foundPlaceholder)) | ||||
| 			{ | ||||
| 				string hexStr(toHex(librariesReplacements.at(name).asBytes())); | ||||
| 				string hexStr(toHex(librariesReplacements.at(foundPlaceholder).asBytes())); | ||||
| 				copy(hexStr.begin(), hexStr.end(), it); | ||||
| 			} | ||||
| 			else | ||||
| 				serr() << "Reference \"" << name << "\" in file \"" << src.first << "\" still unresolved." << endl; | ||||
| 				serr() << "Reference \"" << foundPlaceholder << "\" in file \"" << src.first << "\" still unresolved." << endl; | ||||
| 			it += placeholderSize; | ||||
| 		} | ||||
| 		// Remove hints for resolved libraries.
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user