|
@@ -216,8 +216,8 @@ procedure TLinkerBeOS.SetDefaultInfo;
|
|
|
begin
|
|
|
with Info do
|
|
|
begin
|
|
|
- ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE cat `$RES`';
|
|
|
- DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES';
|
|
|
+ ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE `cat $RES`';
|
|
|
+ DllCmd[1]:='ld $OPT $INIT $FINI $SONAME -shared -L. -o $EXE `cat $RES`';
|
|
|
DllCmd[2]:='strip --strip-unneeded $EXE';
|
|
|
{
|
|
|
ExeCmd[1]:='sh $RES $EXE $OPT $STATIC $STRIP -L.';
|
|
@@ -272,19 +272,19 @@ begin
|
|
|
else
|
|
|
LinkRes.Add('ld -o $1 -e 0 $2 $3 $4 $5 $6 $7 $8 $9\');
|
|
|
}
|
|
|
- LinkRes.Add('-m elf_i386_be -shared -Bsymbolic \');
|
|
|
+ LinkRes.Add('-m elf_i386_be -shared -Bsymbolic');
|
|
|
|
|
|
{ Write path to search libraries }
|
|
|
HPath:=TStringListItem(current_module.locallibrarysearchpath.First);
|
|
|
while assigned(HPath) do
|
|
|
begin
|
|
|
- LinkRes.Add('-L'+HPath.Str+' \');
|
|
|
+ LinkRes.Add('-L'+HPath.Str);
|
|
|
HPath:=TStringListItem(HPath.Next);
|
|
|
end;
|
|
|
HPath:=TStringListItem(LibrarySearchPath.First);
|
|
|
while assigned(HPath) do
|
|
|
begin
|
|
|
- LinkRes.Add('-L'+HPath.Str+' \');
|
|
|
+ LinkRes.Add('-L'+HPath.Str);
|
|
|
HPath:=TStringListItem(HPath.Next);
|
|
|
end;
|
|
|
|
|
@@ -292,25 +292,25 @@ begin
|
|
|
if linklibc then
|
|
|
begin
|
|
|
if librarysearchpath.FindFile('crti.o',s) then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
if librarysearchpath.FindFile('crtbegin.o',s) then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
{ s:=librarysearchpath.FindFile('start_dyn.o',found)+'start_dyn.o';
|
|
|
if found then LinkRes.AddFileName(s+' \');}
|
|
|
|
|
|
if prtobj<>'' then
|
|
|
- LinkRes.AddFileName(FindObjectFile(prtobj,'',false)+' \');
|
|
|
+ LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
|
|
|
|
|
|
if isdll then
|
|
|
- LinkRes.AddFileName(FindObjectFile('func.o','',false)+' \');
|
|
|
+ LinkRes.AddFileName(FindObjectFile('func.o','',false));
|
|
|
|
|
|
if librarysearchpath.FindFile('init_term_dyn.o',s) then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if prtobj<>'' then
|
|
|
- LinkRes.AddFileName(FindObjectFile(prtobj,'',false)+' \');
|
|
|
+ LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
|
|
|
end;
|
|
|
|
|
|
{ main objectfiles }
|
|
@@ -318,7 +318,7 @@ begin
|
|
|
begin
|
|
|
s:=ObjectFiles.GetFirst;
|
|
|
if s<>'' then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
end;
|
|
|
|
|
|
{ LinkRes.Add('-lroot \');
|
|
@@ -331,7 +331,7 @@ begin
|
|
|
While not StaticLibFiles.Empty do
|
|
|
begin
|
|
|
S:=StaticLibFiles.GetFirst;
|
|
|
- LinkRes.AddFileName(s+' \')
|
|
|
+ LinkRes.AddFileName(s)
|
|
|
end;
|
|
|
end;
|
|
|
|
|
@@ -346,7 +346,7 @@ begin
|
|
|
i:=Pos(target_info.sharedlibext,S);
|
|
|
if i>0 then
|
|
|
Delete(S,i,255);
|
|
|
- LinkRes.Add('-l'+s+' \');
|
|
|
+ LinkRes.Add('-l'+s);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
@@ -360,15 +360,15 @@ begin
|
|
|
LinkRes.AddFileName(Info.DynamicLinker);}
|
|
|
end;
|
|
|
if isdll then
|
|
|
- LinkRes.Add('-lroot \');
|
|
|
+ LinkRes.Add('-lroot');
|
|
|
|
|
|
{ objects which must be at the end }
|
|
|
if linklibc then
|
|
|
begin
|
|
|
if librarysearchpath.FindFile('crtend.o',s) then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
if librarysearchpath.FindFile('crtn.o',s) then
|
|
|
- LinkRes.AddFileName(s+' \');
|
|
|
+ LinkRes.AddFileName(s);
|
|
|
end;
|
|
|
|
|
|
{ Write and Close response }
|
|
@@ -385,7 +385,7 @@ var
|
|
|
binstr,
|
|
|
cmdstr : string;
|
|
|
success : boolean;
|
|
|
-{ DynLinkStr : string[60];}
|
|
|
+ DynLinkStr : string[60];
|
|
|
StaticStr,
|
|
|
StripStr : string[40];
|
|
|
begin
|
|
@@ -395,14 +395,20 @@ begin
|
|
|
{ Create some replacements }
|
|
|
StaticStr:='';
|
|
|
StripStr:='';
|
|
|
-{ DynLinkStr:='';}
|
|
|
+ DynLinkStr:='';
|
|
|
if (cs_link_staticflag in aktglobalswitches) then
|
|
|
StaticStr:='-static';
|
|
|
if (cs_link_strip in aktglobalswitches) then
|
|
|
StripStr:='-s';
|
|
|
-{ If (cs_profile in aktmoduleswitches) or
|
|
|
+ If (cs_profile in aktmoduleswitches) or
|
|
|
((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
|
|
|
- DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;}
|
|
|
+ begin
|
|
|
+ DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
|
|
|
+ if cshared Then
|
|
|
+ DynLinkStr:='--shared ' + DynLinkStr;
|
|
|
+ if rlinkpath<>'' Then
|
|
|
+ DynLinkStr:='--rpath-link '+rlinkpath + ' '+ DynLinkStr;
|
|
|
+ End;
|
|
|
|
|
|
{ Write used files and libraries }
|
|
|
WriteResponseFile(false,false);
|
|
@@ -414,8 +420,8 @@ begin
|
|
|
Replace(cmdstr,'$RES',outputexedir+Info.ResName);
|
|
|
Replace(cmdstr,'$STATIC',StaticStr);
|
|
|
Replace(cmdstr,'$STRIP',StripStr);
|
|
|
-{ Replace(cmdstr,'$DYNLINK',DynLinkStr);}
|
|
|
- success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,false);
|
|
|
+ Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
|
|
+ success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,true);
|
|
|
|
|
|
{ Remove ReponseFile }
|
|
|
if (success) and not(cs_link_extern in aktglobalswitches) then
|
|
@@ -430,20 +436,44 @@ var
|
|
|
binstr,
|
|
|
cmdstr : string;
|
|
|
success : boolean;
|
|
|
-begin
|
|
|
+ DynLinkStr : string[60];
|
|
|
+ StaticStr,
|
|
|
+ StripStr : string[40];
|
|
|
+
|
|
|
+ begin
|
|
|
MakeSharedLibrary:=false;
|
|
|
if not(cs_link_extern in aktglobalswitches) then
|
|
|
Message1(exec_i_linking,current_module.sharedlibfilename^);
|
|
|
|
|
|
+{ Create some replacements }
|
|
|
+ StaticStr:='';
|
|
|
+ StripStr:='';
|
|
|
+ DynLinkStr:='';
|
|
|
+ if (cs_link_staticflag in aktglobalswitches) then
|
|
|
+ StaticStr:='-static';
|
|
|
+ if (cs_link_strip in aktglobalswitches) then
|
|
|
+ StripStr:='-s';
|
|
|
+ If (cs_profile in aktmoduleswitches) or
|
|
|
+ ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
|
|
|
+ begin
|
|
|
+ DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
|
|
|
+ if cshared Then
|
|
|
+ DynLinkStr:='--shared ' + DynLinkStr;
|
|
|
+ if rlinkpath<>'' Then
|
|
|
+ DynLinkStr:='--rpath-link '+rlinkpath + ' '+ DynLinkStr;
|
|
|
+ End;
|
|
|
{ Write used files and libraries }
|
|
|
WriteResponseFile(true,true);
|
|
|
|
|
|
{ Call linker }
|
|
|
SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
|
|
|
- Replace(cmdstr,'$EXE',current_module.sharedlibfilename^);
|
|
|
+ Replace(cmdstr,'$EXE',current_module.exefilename^);
|
|
|
Replace(cmdstr,'$OPT',Info.ExtraOptions);
|
|
|
Replace(cmdstr,'$RES',outputexedir+Info.ResName);
|
|
|
- success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
|
|
|
+ Replace(cmdstr,'$STATIC',StaticStr);
|
|
|
+ Replace(cmdstr,'$STRIP',StripStr);
|
|
|
+ Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
|
|
+ success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,true);
|
|
|
|
|
|
{ Strip the library ? }
|
|
|
if success and (cs_link_strip in aktglobalswitches) then
|
|
@@ -475,7 +505,10 @@ initialization
|
|
|
end.
|
|
|
{
|
|
|
$Log$
|
|
|
- Revision 1.7 2004-01-29 22:50:53 florian
|
|
|
+ Revision 1.8 2004-01-29 23:57:15 florian
|
|
|
+ * fixed linker response file handling
|
|
|
+
|
|
|
+ Revision 1.7 2004/01/29 22:50:53 florian
|
|
|
* tried to fix BeOS linking
|
|
|
|
|
|
Revision 1.6 2003/10/03 14:16:48 marco
|