Skip to content

Commit

Permalink
Update linker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 authored and axic committed Dec 12, 2018
1 parent e1a7416 commit ab0d777
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions linker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ab0d777

Please sign in to comment.