summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-06-14 22:20:51 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-06-14 22:20:51 +0000
commitc4004469901c7e2dff694cd9815f143e047643a3 (patch)
tree2ba375ce9c111ddd50da9e5a08b0802dc959ddf0
parent9f8447981adaada15c46843c6dbe6077c8ed4d62 (diff)
downloadfpc-c4004469901c7e2dff694cd9815f143e047643a3.tar.gz
+ implement TInternalLinkerWin16.DefaultLinkScript by copying the MS-DOS
implementation (not correct, but a good starting point) git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@42228 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--compiler/systems/t_win16.pas72
1 files changed, 71 insertions, 1 deletions
diff --git a/compiler/systems/t_win16.pas b/compiler/systems/t_win16.pas
index 46392ad040..b687e6ee8e 100644
--- a/compiler/systems/t_win16.pas
+++ b/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;