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 Nov 5, 2019
1 parent 1d95d3f commit be49dd5
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 @@ -66,16 +66,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 be49dd5

Please sign in to comment.