浏览代码

* support -k for additional nlmvonv headeroptions, -m i386nw for win32, support -sh

armin 22 年之前
父节点
当前提交
4e96d34515
共有 1 个文件被更改,包括 52 次插入9 次删除
  1. 52 9
      compiler/systems/t_nwm.pas

+ 52 - 9
compiler/systems/t_nwm.pas

@@ -34,6 +34,10 @@
     Displaying copyright does not work with nlmconv from gnu bunutils
     Displaying copyright does not work with nlmconv from gnu bunutils
     version less that 2.13
     version less that 2.13
 
 
+    Additional parameters for the nlmvonv-inputfile can be passed with
+    -k, i.e. -kREENTRANT will add the option REENTRANT to the nlmconv
+    inputfile. A ; will be converted into a newline
+
     Exports will be handled like in win32:
     Exports will be handled like in win32:
     procedure bla;
     procedure bla;
     begin
     begin
@@ -266,7 +270,11 @@ begin
   with Info do
   with Info do
    begin
    begin
      ExeCmd[1]:= 'ld -Ur -T $RES $STRIP -o $TMPOBJ';
      ExeCmd[1]:= 'ld -Ur -T $RES $STRIP -o $TMPOBJ';
+     {$ifdef win32}
+     ExeCmd[2]:='nlmconv -m i386nw -T$RES';
+     {$else}
      ExeCmd[2]:='nlmconv -T$RES';
      ExeCmd[2]:='nlmconv -T$RES';
+     {$endif}
    end;
    end;
 end;
 end;
 
 
@@ -290,8 +298,8 @@ begin
   NlmNam := ProgNam + target_info.exeext;
   NlmNam := ProgNam + target_info.exeext;
 
 
   { Open link.res file }
   { Open link.res file }
-  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);         {for ld}
-  NLMConvLinkFile:=TLinkRes.Create(outputexedir+Info.ResName); {for nlmconv, written in CreateExeFile}
+  LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);             {for ld}
+  NLMConvLinkFile:=TLinkRes.Create(outputexedir+'n'+Info.ResName); {for nlmconv, written in CreateExeFile}
 
 
   p := Pos ('"', Description);
   p := Pos ('"', Description);
   while (p > 0) do
   while (p > 0) do
@@ -336,14 +344,20 @@ begin
 
 
   { add objectfiles, start with nwpre always }
   { add objectfiles, start with nwpre always }
   LinkRes.Add ('INPUT (');
   LinkRes.Add ('INPUT (');
-  LinkRes.Add (FindObjectFile('nwpre',''));
+  s2 := FindObjectFile('nwpre','');
+  Comment (V_Debug,'adding Object File '+s2);
+  LinkRes.Add (s2);
 
 
   { main objectfiles, add to linker input }
   { main objectfiles, add to linker input }
   while not ObjectFiles.Empty do
   while not ObjectFiles.Empty do
   begin
   begin
     s:=ObjectFiles.GetFirst;
     s:=ObjectFiles.GetFirst;
     if s<>'' then
     if s<>'' then
-      LinkRes.Add (FindObjectFile (s,''));
+    begin
+      s2 := FindObjectFile (s,'');
+      Comment (V_Debug,'adding Object File '+s2);
+      LinkRes.Add (s2);
+    end;  
   end;
   end;
 
 
   { output file (nlm), add to nlmconv }
   { output file (nlm), add to nlmconv }
@@ -375,7 +389,7 @@ begin
          begin
          begin
 	   S2 := FindObjectFile(s,'');
 	   S2 := FindObjectFile(s,'');
            LinkRes.Add (S2);
            LinkRes.Add (S2);
-	   Comment(V_Debug,'INPUT '+S2);
+	   Comment(V_Debug,'adding Object File (StaticLibFiles) '+S2);
          end else
          end else
          begin
          begin
            i:=Pos(target_info.staticlibext,S);
            i:=Pos(target_info.staticlibext,S);
@@ -438,6 +452,32 @@ begin
   linkres.writetodisk;
   linkres.writetodisk;
   LinkRes.Free;
   LinkRes.Free;
 
 
+{ pass options from -k to nlmconv, ; is interpreted as newline }
+  s := ParaLinkOptions;
+  while(Length(s) > 0) and (s[1] = ' ') do
+    delete (s,1,1);
+  p := pos ('"',s);
+  while p > 0 do
+  begin
+    delete (s,p,1);
+    p := pos ('"',s);
+  end;
+
+  p := pos (';',s);
+  while p > 0 do
+  begin
+    s2 := copy(s,1,p-1);
+    comment (V_Debug,'adding "'+s2+'" to nlmvonv input');
+    NLMConvLinkFile.Add(s2);
+    delete (s,1,p);
+    p := pos (';',s);
+  end;
+  if s <> '' then
+  begin
+    comment (V_Debug,'adding "'+s+'" to nlmvonv input');
+    NLMConvLinkFile.Add(s);
+  end;
+
   WriteResponseFile:=True;
   WriteResponseFile:=True;
 end;
 end;
 
 
@@ -482,11 +522,11 @@ begin
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.writetodisk;
     NLMConvLinkFile.Free;
     NLMConvLinkFile.Free;
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
     SplitBinCmd(Info.ExeCmd[2],binstr,cmdstr);
-    Replace(cmdstr,'$RES',outputexedir+Info.ResName);
+    Replace(cmdstr,'$RES',outputexedir+'n'+Info.ResName);
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     Comment (v_debug,'Executing '+BinStr+' '+cmdstr);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
     success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
-    if success then
-      RemoveFile(outputexedir+Info.ResName);
+    if (success) and not(cs_link_extern in aktglobalswitches) then
+      RemoveFile(outputexedir+'n'+Info.ResName);
     {always remove the temp object file}
     {always remove the temp object file}
     RemoveFile(outputexedir+tmpLinkFileName);
     RemoveFile(outputexedir+tmpLinkFileName);
   end;
   end;
@@ -508,7 +548,10 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-03-21 22:36:42  armin
+  Revision 1.6  2003-03-22 14:51:27  armin
+  * support -k for additional nlmvonv headeroptions, -m i386nw for win32, support -sh
+
+  Revision 1.5  2003/03/21 22:36:42  armin
   * changed linking: now we will link all objects to a single one and call nlmconv with that one object file. This makes it possible to create nlms without debug info.
   * changed linking: now we will link all objects to a single one and call nlmconv with that one object file. This makes it possible to create nlms without debug info.
 
 
   Revision 1.4  2003/03/21 19:19:51  armin
   Revision 1.4  2003/03/21 19:19:51  armin