Просмотр исходного кода

+ implement TInternalLinkerWin16.DefaultLinkScript by copying the MS-DOS
implementation (not correct, but a good starting point)

git-svn-id: trunk@42228 -

nickysn 6 лет назад
Родитель
Сommit
9eaa46f791
1 измененных файлов с 71 добавлено и 1 удалено
  1. 71 1
      compiler/systems/t_win16.pas

+ 71 - 1
compiler/systems/t_win16.pas

@@ -326,8 +326,78 @@ end;
 ****************************************************************************}
 
 procedure TInternalLinkerWin16.DefaultLinkScript;
+var
+  s: TCmdStr;
 begin
-  {todo}
+  { add objectfiles, start with prt0 always }
+  case current_settings.x86memorymodel of
+    mm_tiny:    LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0t','',false)));
+    mm_small:   LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0s','',false)));
+    mm_medium:  LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0m','',false)));
+    mm_compact: LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0c','',false)));
+    mm_large:   LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0l','',false)));
+    mm_huge:    LinkScript.Concat('READOBJECT ' + maybequoted(FindObjectFile('prt0h','',false)));
+  end;
+  while not ObjectFiles.Empty do
+  begin
+    s:=ObjectFiles.GetFirst;
+    if s<>'' then
+      LinkScript.Concat('READOBJECT ' + maybequoted(s));
+  end;
+  LinkScript.Concat('GROUP');
+  while not StaticLibFiles.Empty do
+  begin
+    s:=StaticLibFiles.GetFirst;
+    if s<>'' then
+      LinkScript.Concat('READSTATICLIBRARY '+MaybeQuoted(s));
+  end;
+  LinkScript.Concat('ENDGROUP');
+
+  LinkScript.Concat('EXESECTION .MZ_flat_content');
+  if current_settings.x86memorymodel=mm_tiny then
+    begin
+      LinkScript.Concat('  OBJSECTION _TEXT||CODE');
+      LinkScript.Concat('  OBJSECTION *||CODE');
+      LinkScript.Concat('  OBJSECTION *||DATA');
+      LinkScript.Concat('  SYMBOL _edata');
+      LinkScript.Concat('  OBJSECTION *||BSS');
+      LinkScript.Concat('  SYMBOL _end');
+    end
+  else
+    begin
+      LinkScript.Concat('  OBJSECTION _TEXT||CODE');
+      LinkScript.Concat('  OBJSECTION *||CODE');
+      LinkScript.Concat('  OBJSECTION *||FAR_DATA');
+      LinkScript.Concat('  OBJSECTION _NULL||BEGDATA');
+      LinkScript.Concat('  OBJSECTION _AFTERNULL||BEGDATA');
+      LinkScript.Concat('  OBJSECTION *||BEGDATA');
+      LinkScript.Concat('  OBJSECTION *||DATA');
+      LinkScript.Concat('  SYMBOL _edata');
+      LinkScript.Concat('  OBJSECTION *||BSS');
+      LinkScript.Concat('  SYMBOL _end');
+      LinkScript.Concat('  OBJSECTION *||STACK');
+      LinkScript.Concat('  OBJSECTION *||HEAP');
+    end;
+  LinkScript.Concat('ENDEXESECTION');
+
+  if (cs_debuginfo in current_settings.moduleswitches) and
+     (target_dbg.id in [dbg_dwarf2,dbg_dwarf3,dbg_dwarf4]) then
+    begin
+      LinkScript.Concat('EXESECTION .debug_info');
+      LinkScript.Concat('  OBJSECTION .DEBUG_INFO||DWARF');
+      LinkScript.Concat('ENDEXESECTION');
+      LinkScript.Concat('EXESECTION .debug_abbrev');
+      LinkScript.Concat('  OBJSECTION .DEBUG_ABBREV||DWARF');
+      LinkScript.Concat('ENDEXESECTION');
+      LinkScript.Concat('EXESECTION .debug_line');
+      LinkScript.Concat('  OBJSECTION .DEBUG_LINE||DWARF');
+      LinkScript.Concat('ENDEXESECTION');
+      LinkScript.Concat('EXESECTION .debug_aranges');
+      LinkScript.Concat('  OBJSECTION .DEBUG_ARANGES||DWARF');
+      LinkScript.Concat('ENDEXESECTION');
+    end;
+
+  LinkScript.Concat('ENTRYNAME ..start');
 end;
 
 constructor TInternalLinkerWin16.create;