* 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:='';
{$else}
prtobj:='prt0';
{$endif}
cprtobj:='cprt0';
if linklibc then
prtobj:=cprtobj;
{$endif}
{ Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
@ -132,6 +132,9 @@ begin
LinkRes.AddFileName(s);
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 }
if linklibc then
begin
@ -140,6 +143,7 @@ begin
if librarysearchpath.FindFile('crti.o',false,s) then
LinkRes.AddFileName(s);
end;
end;
while not ObjectFiles.Empty do
begin
@ -165,8 +169,9 @@ begin
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
here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
linklibc:=false;
@ -192,7 +197,13 @@ begin
LinkRes.Add('-lc');
LinkRes.Add('-lgcc');
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 }
if linklibc then
begin
@ -208,6 +219,7 @@ begin
LinkRes.Add(')');
end;
end;
end;
{$ifdef ARM}
with embedded_controllers[current_settings.controllertype] do