Updated systems/t_android to only recognize the "bionic" libc as valid libc.

Fix uninitialized defdynlinker variable when compiling i386-android causing garbage in the linker script.

git-svn-id: branches/targetandroid@22044 -
This commit is contained in:
tom_at_work 2012-08-09 08:00:16 +00:00
parent 4150f0a2fb
commit fe87b547ea

View File

@ -42,7 +42,7 @@ interface
tlinkerandroid=class(texternallinker) tlinkerandroid=class(texternallinker)
private private
libctype:(libc5,glibc2,glibc21,uclibc); libctype:(bionic);
cprtobj, cprtobj,
gprtobj, gprtobj,
prtobj : string[80]; prtobj : string[80];
@ -139,36 +139,20 @@ begin
ExtDbgCmd[2]:='objcopy --add-gnu-debuglink=$DBG $EXE'; ExtDbgCmd[2]:='objcopy --add-gnu-debuglink=$DBG $EXE';
ExtDbgCmd[3]:='strip --strip-unneeded $EXE'; ExtDbgCmd[3]:='strip --strip-unneeded $EXE';
{$ifdef arm}
defdynlinker:='/system/bin/linker'; defdynlinker:='/system/bin/linker';
{$endif arm}
{ {
Search order: There is only one C library on android, the bionic libc
glibc 2.1+
uclibc
glibc 2.0
If none is found (e.g. when cross compiling) glibc21 is assumed
} }
libctype:=bionic;
if fileexists(sysrootpath+defdynlinker,false) then if fileexists(sysrootpath+defdynlinker,false) then
begin begin
DynamicLinker:=defdynlinker; DynamicLinker:=defdynlinker;
libctype:=glibc2;
end
else if fileexists(sysrootpath+'/lib/ld-uClibc.so.0',false) then
begin
dynamiclinker:='/lib/ld-uClibc.so.0';
libctype:=uclibc;
end end
else else
begin begin
{ when no dyn. linker is found, we are probably { when no dyn. linker is found, we are probably
cross compiling, so use the default dyn. linker } cross compiling, so use the default dyn. linker }
DynamicLinker:=defdynlinker; DynamicLinker:=defdynlinker;
{
the default c startup script is gcrt0.as on all platforms
except i386
}
libctype:=glibc2;
end; end;
end; end;
end; end;
@ -216,25 +200,15 @@ begin
prtobj:='prt0'; prtobj:='prt0';
sysinitunit:='prc'; sysinitunit:='prc';
case libctype of case libctype of
glibc21: bionic:
begin begin
cprtobj:='cprt21';
gprtobj:='gprt21';
csysinitunit:='c21';
gsysinitunit:='c21g';
end;
uclibc:
begin
cprtobj:='ucprt0';
gprtobj:='ugprt0';
csysinitunit:='uc';
gsysinitunit:='ucg';
end
else
cprtobj:='cprt0'; cprtobj:='cprt0';
gprtobj:='gprt0'; gprtobj:='gprt0';
csysinitunit:='c'; csysinitunit:='c';
gsysinitunit:='g'; gsysinitunit:='g';
end
else
runerror(2012080901);
end; end;
end; end;
if cs_profile in current_settings.moduleswitches then if cs_profile in current_settings.moduleswitches then
@ -268,8 +242,6 @@ begin
{ set special options for some targets } { set special options for some targets }
if cs_profile in current_settings.moduleswitches then if cs_profile in current_settings.moduleswitches then
begin begin
if not(libctype in [glibc2,glibc21]) then
AddSharedLibrary('gmon');
AddSharedLibrary('c'); AddSharedLibrary('c');
end; end;
@ -319,7 +291,7 @@ begin
if not (target_info.system in systems_internal_sysinit) and (prtobj<>'') then if not (target_info.system in systems_internal_sysinit) and (prtobj<>'') then
AddFileName(maybequoted(FindObjectFile(prtobj,'',false))); AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
{ try to add crti and crtbegin if linking to C } { try to add crti and crtbegin if linking to C }
if linklibc and (libctype<>uclibc) then if linklibc then
begin begin
{ crti.o must come first } { crti.o must come first }
if librarysearchpath.FindFile('crti.o',false,s) then if librarysearchpath.FindFile('crti.o',false,s) then
@ -419,7 +391,7 @@ begin
end; end;
{ objects which must be at the end } { objects which must be at the end }
if linklibc and (libctype<>uclibc) then if linklibc then
begin begin
if cs_create_pic in current_settings.moduleswitches then if cs_create_pic in current_settings.moduleswitches then
found1:=librarysearchpath.FindFile('crtendS.o',false,s1) found1:=librarysearchpath.FindFile('crtendS.o',false,s1)