mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:29:28 +02:00
* change convention for searching sysroot library paths to be the same as the
one used by GNU ld: only search for library paths in the sysroot if they are built into the compiler or start with "=". Previously, all user-provided library paths were also searched in the sysroot (mantis #36198) git-svn-id: trunk@43279 -
This commit is contained in:
parent
e3c6ef21d1
commit
78fb35525f
@ -99,7 +99,7 @@ interface
|
||||
|
||||
TSearchPathList = class(TCmdStrList)
|
||||
procedure AddPath(s:TCmdStr;addfirst:boolean);overload;
|
||||
procedure AddPath(SrcPath,s:TCmdStr;addfirst:boolean);overload;
|
||||
procedure AddPath(const sysroot: TCmdStr; s:TCmdStr;addfirst:boolean);overload;
|
||||
procedure AddList(list:TSearchPathList;addfirst:boolean);
|
||||
function FindFile(const f : TCmdStr;allowcache:boolean;var foundfile:TCmdStr):boolean;
|
||||
end;
|
||||
@ -999,7 +999,7 @@ end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TSearchPathList.AddPath(SrcPath,s:TCmdStr;addfirst:boolean);
|
||||
procedure TSearchPathList.AddPath(const sysroot: TCmdStr; s:TCmdStr;addfirst:boolean);
|
||||
var
|
||||
staridx,
|
||||
i,j : longint;
|
||||
@ -1074,7 +1074,10 @@ end;
|
||||
|
||||
{ fix pathname }
|
||||
DePascalQuote(currPath);
|
||||
currPath:=SrcPath+FixPath(currPath,false);
|
||||
{ GNU LD convention: if library search path starts with '=', it's relative to the
|
||||
sysroot; otherwise, interpret it as a regular path }
|
||||
if currPath[1]='=' then
|
||||
currPath:=sysroot+FixPath(copy(currPath,2,length(currPath)-1),false);
|
||||
if currPath='' then
|
||||
currPath:= CurDirRelPath(source_info)
|
||||
else
|
||||
|
@ -1678,16 +1678,10 @@ begin
|
||||
Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
|
||||
'l' :
|
||||
begin
|
||||
if path_absolute(More) then
|
||||
if ispara then
|
||||
ParaLibraryPath.AddPath(sysrootpath,More,false)
|
||||
else
|
||||
LibrarySearchPath.AddPath(sysrootpath,More,true)
|
||||
if ispara then
|
||||
ParaLibraryPath.AddPath(sysrootpath,More,false)
|
||||
else
|
||||
if ispara then
|
||||
ParaLibraryPath.AddPath('',More,false)
|
||||
else
|
||||
LibrarySearchPath.AddPath('',More,true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,More,true)
|
||||
end;
|
||||
'L' :
|
||||
begin
|
||||
|
@ -153,11 +153,11 @@ begin
|
||||
if not Dontlinkstdlibpath Then
|
||||
if target_info.system in systems_darwin then
|
||||
{ Mac OS X doesn't have a /lib }
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib',true)
|
||||
else if target_info.system in systems_openbsd then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;$OPENBSD_X11BASE/lib;$OPENBSD_LOCALBASE/lib',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib;=$OPENBSD_X11BASE/lib;=$OPENBSD_LOCALBASE/lib',true)
|
||||
else
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib;=/usr/lib;=/usr/X11R6/lib',true);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -128,28 +128,28 @@ begin
|
||||
{$ifdef x86_64}
|
||||
{ some linuxes might not have the lib64 variants (Arch, LFS }
|
||||
if PathExists('/usr/X11R6/lib64',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/X11R6/lib64',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/X11R6/lib64',true)
|
||||
else if PathExists('/usr/X11R6/lib',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/X11R6/lib',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/X11R6/lib',true);
|
||||
|
||||
if PathExists('/usr/lib64',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib64',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib64',true)
|
||||
else if PathExists('/usr/lib',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib',true);
|
||||
|
||||
{ /lib64 should be the really first, so add it before everything else }
|
||||
if PathExists('/lib64',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib64',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib64',true)
|
||||
else if PathExists('/lib',true) then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib',true);
|
||||
{$else}
|
||||
{$ifdef powerpc64}
|
||||
if target_info.abi<>abi_powerpc_elfv2 then
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib64;/usr/lib64;/usr/X11R6/lib64',true)
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib64;=/usr/lib64;=/usr/X11R6/lib64',true)
|
||||
else
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib64;/usr/lib/powerpc64le-linux-gnu;/usr/X11R6/powerpc64le-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib64;=/usr/lib/powerpc64le-linux-gnu;=/usr/X11R6/powerpc64le-linux-gnu',true);
|
||||
{$else powerpc64}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/lib;=/usr/lib;=/usr/X11R6/lib',true);
|
||||
{$endif powerpc64}
|
||||
{$endif x86_64}
|
||||
|
||||
@ -157,41 +157,41 @@ begin
|
||||
{ some newer Debian have the crt*.o files at uncommon locations,
|
||||
for other arm flavours, this cannot hurt }
|
||||
{$ifdef FPC_ARMHF}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/arm-linux-gnueabihf',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/arm-linux-gnueabihf',true);
|
||||
{$endif FPC_ARMHF}
|
||||
{$ifdef FPC_ARMEL}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/arm-linux-gnueabi',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/arm-linux-gnueabi',true);
|
||||
{$endif}
|
||||
{$endif arm}
|
||||
{$ifdef x86_64}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/x86_64-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/x86_64-linux-gnu',true);
|
||||
{$endif x86_64}
|
||||
{$ifdef i386}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/i386-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/i386-linux-gnu',true);
|
||||
{$endif i386}
|
||||
{$ifdef aarch64}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/aarch64-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/aarch64-linux-gnu',true);
|
||||
{$endif aarch64}
|
||||
{$ifdef powerpc}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/powerpc-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/powerpc-linux-gnu',true);
|
||||
{$endif powerpc}
|
||||
{$ifdef m68k}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/m68k-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/m68k-linux-gnu',true);
|
||||
{$endif m68k}
|
||||
{$ifdef mipsel}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/mipsel-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/mipsel-linux-gnu',true);
|
||||
{$endif mipsel}
|
||||
{$ifdef mips}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/mips-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/mips-linux-gnu',true);
|
||||
{$endif mips}
|
||||
{$ifdef sparc64}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/sparc64-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/sparc64-linux-gnu',true);
|
||||
{$endif sparc64}
|
||||
{$ifdef riscv32}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/riscv32-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/riscv32-linux-gnu',true);
|
||||
{$endif riscv32}
|
||||
{$ifdef riscv64}
|
||||
LibrarySearchPath.AddPath(sysrootpath,'/usr/lib/riscv64-linux-gnu',true);
|
||||
LibrarySearchPath.AddPath(sysrootpath,'=/usr/lib/riscv64-linux-gnu',true);
|
||||
{$endif riscv64}
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user