* Xtensa-freeRTOS: fix linking against libc

git-svn-id: trunk@46782 -
This commit is contained in:
florian 2020-09-05 20:25:30 +00:00
parent 8ef6372340
commit aea85fcd66

View File

@ -96,10 +96,10 @@ begin
prtobj:=''; prtobj:='';
{$else} {$else}
prtobj:='prt0'; prtobj:='prt0';
{$endif}
cprtobj:='cprt0'; cprtobj:='cprt0';
if linklibc then if linklibc then
prtobj:=cprtobj; prtobj:=cprtobj;
{$endif}
{ Open link.res file } { Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true); LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
@ -132,6 +132,9 @@ begin
LinkRes.AddFileName(s); LinkRes.AddFileName(s);
end; end;
{ xtensa FreeRTOS links always against libc, the runtime needs it }
if not(target_info.system in [system_xtensa_freertos]) then
begin
{ try to add crti and crtbegin if linking to C } { try to add crti and crtbegin if linking to C }
if linklibc then if linklibc then
begin begin
@ -140,6 +143,7 @@ begin
if librarysearchpath.FindFile('crti.o',false,s) then if librarysearchpath.FindFile('crti.o',false,s) then
LinkRes.AddFileName(s); LinkRes.AddFileName(s);
end; end;
end;
while not ObjectFiles.Empty do while not ObjectFiles.Empty do
begin begin
@ -165,8 +169,9 @@ begin
end; end;
end; end;
LinkRes.Add(')'); { xtensa FreeRTOS links always against libc, the runtime needs it }
if not(target_info.system in [system_xtensa_freertos]) then
begin
{ 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) }
linklibc:=false; linklibc:=false;
@ -192,7 +197,13 @@ begin
LinkRes.Add('-lc'); LinkRes.Add('-lc');
LinkRes.Add('-lgcc'); LinkRes.Add('-lgcc');
end; end;
end;
LinkRes.Add(')');
{ xtensa FreeRTOS links always against libc }
if not(target_info.system in [system_xtensa_freertos]) then
begin
{ objects which must be at the end } { objects which must be at the end }
if linklibc then if linklibc then
begin begin
@ -208,6 +219,7 @@ begin
LinkRes.Add(')'); LinkRes.Add(')');
end; end;
end; end;
end;
{$ifdef ARM} {$ifdef ARM}
with embedded_controllers[current_settings.controllertype] do with embedded_controllers[current_settings.controllertype] do