diff --git a/linker.js b/linker.js index b4f169ab..8b5a0781 100644 --- a/linker.js +++ b/linker.js @@ -70,16 +70,22 @@ var findLinkReferences = function (bytecode) { // trim trailing underscores // NOTE: this has no way of knowing if the trailing underscore was part of the name var libraryName = found[1].replace(/_+$/gm, ''); + var fileName = libraryName; + var nameExtraction = /(.*):(.*)/.exec(libraryName); + if (nameExtraction) { + fileName = nameExtraction[1]; + libraryName = nameExtraction[2]; + } - if (!linkReferences[libraryName]) { - linkReferences[libraryName] = []; + if (!linkReferences[fileName]) { + linkReferences[fileName] = {}; } - linkReferences[libraryName].push({ + linkReferences[fileName][libraryName] = { // offsets are in bytes in binary representation (and not hex) start: (offset + start) / 2, length: 20 - }); + }; offset += start + 20;