diff options
author | karoly <karoly@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2017-09-16 21:34:55 +0000 |
---|---|---|
committer | karoly <karoly@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2017-09-16 21:34:55 +0000 |
commit | 02b9bd67e4f46bc349546af34380e713f56a6734 (patch) | |
tree | c8a9039fdcd09fcf3ce420a96ce6047571f4ae24 | |
parent | b7e9b7757774e7792e9cff5bde16d48b909e29a6 (diff) | |
download | fpc-02b9bd67e4f46bc349546af34380e713f56a6734.tar.gz |
m68k-palmos: internal sysinit, and patch target support so it works prc-tools-remix on a modern system
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@37230 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/systems.pas | 6 | ||||
-rw-r--r-- | compiler/systems/i_palmos.pas | 6 | ||||
-rw-r--r-- | compiler/systems/t_palmos.pas | 48 |
3 files changed, 41 insertions, 19 deletions
diff --git a/compiler/systems.pas b/compiler/systems.pas index ef6cddbc33..f4970e51e8 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -330,8 +330,10 @@ interface { all systems for which weak linking has been tested/is supported } systems_weak_linking = systems_darwin + systems_solaris + systems_linux + systems_android; - systems_internal_sysinit = [system_i386_linux,system_i386_win32,system_x86_64_win64, - system_powerpc64_linux,system_m68k_atari,system_sparc64_linux]+systems_darwin+systems_amigalike; + systems_internal_sysinit = [system_i386_win32,system_x86_64_win64, + system_i386_linux,system_powerpc64_linux,system_sparc64_linux, + system_m68k_atari,system_m68k_palmos + ]+systems_darwin+systems_amigalike; { all systems that use garbage collection for reference-counted types } systems_garbage_collected_managed_types = [ diff --git a/compiler/systems/i_palmos.pas b/compiler/systems/i_palmos.pas index c7182fea1c..998b9f771b 100644 --- a/compiler/systems/i_palmos.pas +++ b/compiler/systems/i_palmos.pas @@ -34,7 +34,7 @@ unit i_palmos; system : system_m68k_PalmOS; name : 'PalmOS'; shortname : 'PalmOS'; - flags : [tf_under_development,tf_code_small,tf_static_reg_based,tf_smartlink_sections]; + flags : [tf_under_development,tf_code_small,tf_static_reg_based,tf_smartlink_library,tf_requires_proper_alignment]; cpu : cpu_m68k; unit_env : 'PALMUNITS'; extradefines : ''; @@ -61,8 +61,8 @@ unit i_palmos; Cprefix : '_'; newline : #10; dirsep : '/'; - assem : as_gas; - assemextern : as_gas; + assem : as_m68k_as_aout; + assemextern : as_m68k_as_aout; link : ld_none; linkextern : ld_palmos; ar : ar_gnu_ar; diff --git a/compiler/systems/t_palmos.pas b/compiler/systems/t_palmos.pas index ac7e80ff4e..41c03a46a1 100644 --- a/compiler/systems/t_palmos.pas +++ b/compiler/systems/t_palmos.pas @@ -34,9 +34,10 @@ interface private Function WriteResponseFile : Boolean; public - constructor Create;override; - procedure SetDefaultInfo;override; - function MakeExecutable:boolean;override; + constructor Create; override; + procedure SetDefaultInfo; override; + procedure InitSysInitUnitName; override; + function MakeExecutable:boolean; override; end; @@ -65,12 +66,23 @@ procedure TLinkerPalmOS.SetDefaultInfo; begin with Info do begin - ExeCmd[1]:='ldpalm $OPT $STRIP -N -dy -T $SCRIPT -o $EXE @$RES'; - ExeCmd[2]:='build-prc $EXE.prc "$APPNAME" $APPID $EXE *.bin'; + //ExeCmd[1]:='ldpalm $OPT $STRIP -N -dy -T $SCRIPT -o $EXE @$RES'; + + { This is based on my successful experiment with prc-tools remix. + Anyone who has more insight into this Palm magic, feel free to fix. (KB) } + ExeCmd[1]:='ld $OPT $STRIP --no-check-sections -N -dy -o $EXE $RES'; + ExeCmd[2]:='obj-res $EXE'; + ExeCmd[3]:='build-prc $EXE.prc "$APPNAME" $APPID $EXE *.$EXE.grc'; end; end; +procedure TLinkerPalmOS.InitSysInitUnitName; +begin + sysinitunit:='si_prc'; +end; + + Function TLinkerPalmOS.WriteResponseFile : Boolean; Var linkres : TLinkRes; @@ -94,13 +106,18 @@ begin HPath:=TCmdStrListItem(LibrarySearchPath.First); while assigned(HPath) do begin - LinkRes.Add('-L'+HPath.Str); + LinkRes.Add('SEARCH_DIR('+HPath.Str+')'); HPath:=TCmdStrListItem(HPath.Next); end; - { add objectfiles, start with crt0 always } - { using crt0, we should stick C compatible } - LinkRes.AddFileName(FindObjectFile('crt0','',false)); + LinkRes.Add('INPUT ('); + { add objectfiles, start with prt0 always } + if not (target_info.system in systems_internal_sysinit) then + begin + { add objectfiles, start with crt0 always } + { using crt0, we should stick C compatible } + LinkRes.AddFileName(FindObjectFile('crt0','',false)); + end; { main objectfiles } while not ObjectFiles.Empty do @@ -109,21 +126,22 @@ begin if s<>'' then LinkRes.AddFileName(s); end; + LinkRes.Add(')'); { Write staticlibraries } if not StaticLibFiles.Empty then begin - LinkRes.Add('-('); + LinkRes.Add('GROUP('); While not StaticLibFiles.Empty do begin S:=StaticLibFiles.GetFirst; LinkRes.AddFileName(s) end; - LinkRes.Add('-)'); + LinkRes.Add(')'); end; { currently the PalmOS target must be linked always against the C lib } - LinkRes.Add('-lcrt'); + {LinkRes.Add('-lcrt');} { Write sharedlibraries like -l<lib>, also add the needed dynamic linker here to be sure that it gets linked this is needed for glibc2 systems (PFV) } @@ -180,16 +198,18 @@ begin for i:=1 to 2 do begin SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr); + binstr:=FindUtil(utilsprefix+BinStr); if binstr<>'' then begin Replace(cmdstr,'$EXE',MaybeQuoted(current_module.exefilename)); Replace(cmdstr,'$OPT',Info.ExtraOptions); Replace(cmdstr,'$RES',MaybeQuoted(outputexedir+Info.ResName)); Replace(cmdstr,'$STRIP',StripStr); - Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld')); +// Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld')); Replace(cmdstr,'$APPNAME',palmos_applicationname); Replace(cmdstr,'$APPID',palmos_applicationid); - success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false); + + success:=DoExec(binstr,cmdstr,(i=1),false); if not success then break; end; |