|
@@ -34,9 +34,10 @@ interface
|
|
private
|
|
private
|
|
Function WriteResponseFile : Boolean;
|
|
Function WriteResponseFile : Boolean;
|
|
public
|
|
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;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -65,12 +66,23 @@ procedure TLinkerPalmOS.SetDefaultInfo;
|
|
begin
|
|
begin
|
|
with Info do
|
|
with Info do
|
|
begin
|
|
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;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
+procedure TLinkerPalmOS.InitSysInitUnitName;
|
|
|
|
+begin
|
|
|
|
+ sysinitunit:='si_prc';
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+
|
|
Function TLinkerPalmOS.WriteResponseFile : Boolean;
|
|
Function TLinkerPalmOS.WriteResponseFile : Boolean;
|
|
Var
|
|
Var
|
|
linkres : TLinkRes;
|
|
linkres : TLinkRes;
|
|
@@ -94,13 +106,18 @@ begin
|
|
HPath:=TCmdStrListItem(LibrarySearchPath.First);
|
|
HPath:=TCmdStrListItem(LibrarySearchPath.First);
|
|
while assigned(HPath) do
|
|
while assigned(HPath) do
|
|
begin
|
|
begin
|
|
- LinkRes.Add('-L'+HPath.Str);
|
|
|
|
|
|
+ LinkRes.Add('SEARCH_DIR('+HPath.Str+')');
|
|
HPath:=TCmdStrListItem(HPath.Next);
|
|
HPath:=TCmdStrListItem(HPath.Next);
|
|
end;
|
|
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 }
|
|
{ main objectfiles }
|
|
while not ObjectFiles.Empty do
|
|
while not ObjectFiles.Empty do
|
|
@@ -109,21 +126,22 @@ begin
|
|
if s<>'' then
|
|
if s<>'' then
|
|
LinkRes.AddFileName(s);
|
|
LinkRes.AddFileName(s);
|
|
end;
|
|
end;
|
|
|
|
+ LinkRes.Add(')');
|
|
|
|
|
|
{ Write staticlibraries }
|
|
{ Write staticlibraries }
|
|
if not StaticLibFiles.Empty then
|
|
if not StaticLibFiles.Empty then
|
|
begin
|
|
begin
|
|
- LinkRes.Add('-(');
|
|
|
|
|
|
+ LinkRes.Add('GROUP(');
|
|
While not StaticLibFiles.Empty do
|
|
While not StaticLibFiles.Empty do
|
|
begin
|
|
begin
|
|
S:=StaticLibFiles.GetFirst;
|
|
S:=StaticLibFiles.GetFirst;
|
|
LinkRes.AddFileName(s)
|
|
LinkRes.AddFileName(s)
|
|
end;
|
|
end;
|
|
- LinkRes.Add('-)');
|
|
|
|
|
|
+ LinkRes.Add(')');
|
|
end;
|
|
end;
|
|
|
|
|
|
{ currently the PalmOS target must be linked always against the C lib }
|
|
{ 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
|
|
{ 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) }
|
|
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
|
|
for i:=1 to 2 do
|
|
begin
|
|
begin
|
|
SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr);
|
|
SplitBinCmd(Info.ExeCmd[i],binstr,cmdstr);
|
|
|
|
+ binstr:=FindUtil(utilsprefix+BinStr);
|
|
if binstr<>'' then
|
|
if binstr<>'' then
|
|
begin
|
|
begin
|
|
Replace(cmdstr,'$EXE',MaybeQuoted(current_module.exefilename));
|
|
Replace(cmdstr,'$EXE',MaybeQuoted(current_module.exefilename));
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
Replace(cmdstr,'$RES',MaybeQuoted(outputexedir+Info.ResName));
|
|
Replace(cmdstr,'$RES',MaybeQuoted(outputexedir+Info.ResName));
|
|
Replace(cmdstr,'$STRIP',StripStr);
|
|
Replace(cmdstr,'$STRIP',StripStr);
|
|
- Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld'));
|
|
|
|
|
|
+// Replace(cmdstr,'$SCRIPT',FindUtil('palm.ld'));
|
|
Replace(cmdstr,'$APPNAME',palmos_applicationname);
|
|
Replace(cmdstr,'$APPNAME',palmos_applicationname);
|
|
Replace(cmdstr,'$APPID',palmos_applicationid);
|
|
Replace(cmdstr,'$APPID',palmos_applicationid);
|
|
- success:=DoExec(FindUtil(binstr),cmdstr,(i=1),false);
|
|
|
|
|
|
+
|
|
|
|
+ success:=DoExec(binstr,cmdstr,(i=1),false);
|
|
if not success then
|
|
if not success then
|
|
break;
|
|
break;
|
|
end;
|
|
end;
|