|
@@ -12,11 +12,12 @@ uses
|
|
wasmtoolutils;
|
|
wasmtoolutils;
|
|
|
|
|
|
const
|
|
const
|
|
- ACT_EXPORTRENAME = 'exportrename';
|
|
|
|
- ACT_SYMBOLFLAG = 'symbolflag';
|
|
|
|
- ACT_SYMBOLAUTO = 'symbolauto';
|
|
|
|
|
|
+ ACT_EXPORTRENAME = 'exportrename';
|
|
|
|
+ ACT_SYMBOLFLAG = 'symbolflag';
|
|
|
|
+ ACT_SYMBOLAUTO = 'symbolauto';
|
|
|
|
+ ACT_WEAK = 'weak';
|
|
|
|
|
|
- VERSION = '1.0';
|
|
|
|
|
|
+ VERSION = '1.1';
|
|
|
|
|
|
procedure PrintHelp;
|
|
procedure PrintHelp;
|
|
begin
|
|
begin
|
|
@@ -27,14 +28,19 @@ begin
|
|
writeln('options:');
|
|
writeln('options:');
|
|
writeln(' --exportrename @inputfile - renaming export names');
|
|
writeln(' --exportrename @inputfile - renaming export names');
|
|
writeln(' --symbolflag @inputfile - update symbol flags as specified in input');
|
|
writeln(' --symbolflag @inputfile - update symbol flags as specified in input');
|
|
- writeln(' --symbolauto - update symbol by the use');
|
|
|
|
- writeln(' --verbose - enabling verbose mode');
|
|
|
|
|
|
+ writeln(' --symbolauto - update symbol by the use ');
|
|
|
|
+ writeln(' --weak %name% - specify symbol names for global variables to be marked weak reference');
|
|
end;
|
|
end;
|
|
|
|
|
|
type
|
|
type
|
|
|
|
|
|
{ TToolActions }
|
|
{ TToolActions }
|
|
|
|
|
|
|
|
+ // it's assumed that the wasmtool will be instructed
|
|
|
|
+ // to take mulitple actions on the same file.
|
|
|
|
+ // thus every action is recorded as TToolActions
|
|
|
|
+ // Those are created during the parameters parsing
|
|
|
|
+
|
|
TToolActions = class(TObject)
|
|
TToolActions = class(TObject)
|
|
action : string; // action to take place
|
|
action : string; // action to take place
|
|
paramsFn : string; // input file name
|
|
paramsFn : string; // input file name
|
|
@@ -53,7 +59,9 @@ end;
|
|
procedure ProcessParams(acts: TList; const inputFn: string; doVerbose: Boolean);
|
|
procedure ProcessParams(acts: TList; const inputFn: string; doVerbose: Boolean);
|
|
var
|
|
var
|
|
i : integer;
|
|
i : integer;
|
|
|
|
+ j : integer;
|
|
ta : TToolActions;
|
|
ta : TToolActions;
|
|
|
|
+ wk : TStringList;
|
|
begin
|
|
begin
|
|
for i:=0 to acts.Count-1 do begin
|
|
for i:=0 to acts.Count-1 do begin
|
|
ta := TToolActions(acts[i]);
|
|
ta := TToolActions(acts[i]);
|
|
@@ -66,8 +74,14 @@ begin
|
|
ExportRename(inputFn, ta.paramsFn, doVerbose);
|
|
ExportRename(inputFn, ta.paramsFn, doVerbose);
|
|
end else if ta.action = ACT_SYMBOLFLAG then begin
|
|
end else if ta.action = ACT_SYMBOLFLAG then begin
|
|
ChangeSymbolFlag(inputFn, ta.paramsFn);
|
|
ChangeSymbolFlag(inputFn, ta.paramsFn);
|
|
- end else if ta.action = ACT_SYMBOLAUTO then begin
|
|
|
|
- PredictSymbolsFromLink(inputFn, doVerbose);
|
|
|
|
|
|
+ end else if (ta.action = ACT_SYMBOLAUTO) then begin
|
|
|
|
+ wk := TStringList.Create;
|
|
|
|
+ for j:=0 to acts.Count-1 do begin
|
|
|
|
+ if TToolActions(acts[j]).action = ACT_WEAK then
|
|
|
|
+ wk.Add( TToolActions(acts[j]).paramsFn );
|
|
|
|
+ end;
|
|
|
|
+ PredictSymbolsFromLink(inputFn, wk, doVerbose);
|
|
|
|
+ wk.free;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|