* -Xt option to link staticly against c libs

This commit is contained in:
peter 2000-02-09 10:35:48 +00:00
parent 48e7eb291c
commit 1612077d8d
3 changed files with 24 additions and 6 deletions

View File

@ -105,7 +105,7 @@ interface
cs_asm_regalloc,cs_asm_tempalloc,
{ linking }
cs_link_extern,cs_link_static,cs_link_smart,cs_link_shared,cs_link_deffile,
cs_link_strip,cs_link_toc
cs_link_strip,cs_link_toc,cs_link_staticflag
);
tglobalswitches = set of tglobalswitch;
@ -180,7 +180,10 @@ begin
end.
{
$Log$
Revision 1.26 2000-02-06 17:20:52 peter
Revision 1.27 2000-02-09 10:35:48 peter
* -Xt option to link staticly against c libs
Revision 1.26 2000/02/06 17:20:52 peter
* -gl switch for auto lineinfo including
Revision 1.25 2000/01/07 01:14:27 peter

View File

@ -796,6 +796,7 @@ begin
case More[j] of
'c' : initglobalswitches:=initglobalswitches+[cs_link_toc];
's' : initglobalswitches:=initglobalswitches+[cs_link_strip];
't' : initglobalswitches:=initglobalswitches+[cs_link_staticflag];
'D' : begin
def_symbol('FPC_LINK_DYNAMIC');
undef_symbol('FPC_LINK_SMART');
@ -1428,7 +1429,10 @@ end;
end.
{
$Log$
Revision 1.57 2000-02-06 17:20:52 peter
Revision 1.58 2000-02-09 10:35:48 peter
* -Xt option to link staticly against c libs
Revision 1.57 2000/02/06 17:20:52 peter
* -gl switch for auto lineinfo including
Revision 1.56 2000/01/31 15:55:42 peter

View File

@ -208,7 +208,7 @@ begin
Glibc21:=false;
with Info do
begin
ExeCmd[1]:='ld $OPT $DYNLINK $STRIP -L. -o $EXE $RES';
ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $STRIP -L. -o $EXE $RES';
DllCmd[1]:='ld $OPT -shared -L. -o $EXE $RES';
DllCmd[2]:='strip --strip-unneeded $EXE';
{ first try glibc2 }
@ -348,6 +348,9 @@ begin
{ be sure that libc is the last lib }
if linklibc then
LinkRes.Add('-lc');
{ when we have -static for the linker the we also need libgcc }
if (cs_link_staticflag in aktglobalswitches) then
LinkRes.Add('-lgcc');
if linkdynamic and (Info.DynamicLinker<>'') then
LinkRes.AddFileName(Info.DynamicLinker);
LinkRes.Add(')');
@ -366,14 +369,18 @@ var
cmdstr : string;
success : boolean;
DynLinkStr : string[60];
StaticStr,
StripStr : string[40];
begin
if not(cs_link_extern in aktglobalswitches) then
Message1(exec_i_linking,current_module^.exefilename^);
{ 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
@ -388,6 +395,7 @@ begin
Replace(cmdstr,'$EXE',current_module^.exefilename^);
Replace(cmdstr,'$OPT',Info.ExtraOptions);
Replace(cmdstr,'$RES',outputexedir+Info.ResName);
Replace(cmdstr,'$STATIC',StaticStr);
Replace(cmdstr,'$STRIP',StripStr);
Replace(cmdstr,'$DYNLINK',DynLinkStr);
success:=DoExec(FindUtil(BinStr),CmdStr,true,false);
@ -439,7 +447,10 @@ end;
end.
{
$Log$
Revision 1.8 2000-01-11 09:52:07 peter
Revision 1.9 2000-02-09 10:35:48 peter
* -Xt option to link staticly against c libs
Revision 1.8 2000/01/11 09:52:07 peter
* fixed placing of .sl directories
* use -b again for base-file selection
* fixed group writing for linux with smartlinking
@ -468,4 +479,4 @@ end.
* redesigned linker object
+ library support for linux (only procedures can be exported)
}
}