Skip to content

Commit e1cda77

Browse files
committed
fbc: freebsd - try to find ld.bfd
- if LD environment variable is set, use that, otherwise When host is freebsd and backend is gas or gas64 then, - if 'ld' wasn't found at the expected location, try finding 'ld.bfd' - if 'ld.bfd' wasn't found, then rely on system path to find 'ld.bfd' - fbc depends on many gnu-isms. If really do want 'ld' system linker then call '$ LD=ld fbc'
1 parent 21471bf commit e1cda77

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/compiler/fbc.bas

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -438,20 +438,32 @@ private sub fbcFindBin _
438438
if( (fbctoolTB(tool).flags and FBCTOOLFLAG_CAN_USE_ENVIRON) <> 0 ) then
439439
path = environ( ucase( fbctoolTB(tool).name ) )
440440
end if
441+
441442
if( len( path ) = 0 ) then
442443
'' b) Try bin/ directory
443444
path = fbc.binpath + fbctoolTB(tool).name + FB_HOST_EXEEXT
444445

445446
#ifndef ENABLE_STANDALONE
446-
if( (hFileExists( path ) = FALSE) and _
447-
(fbGetOption( FB_COMPOPT_BACKEND ) = FB_BACKEND_GCC)) then
448-
'' c) Ask GCC where it is, if applicable (GCC might have its
449-
'' own copy which we must use instead of the system one)
450-
if( tool = FBCTOOL_AS ) then
451-
path = fbcQueryGcc( " -print-prog-name=as" )
452-
elseif( tool = FBCTOOL_LD ) then
453-
path = fbcQueryGcc( " -print-prog-name=ld" )
454-
end if
447+
if( hFileExists( path ) = FALSE ) then
448+
select case fbGetOption( FB_COMPOPT_BACKEND )
449+
case FB_BACKEND_GCC
450+
'' c) Ask GCC where it is, if applicable (GCC might have its
451+
'' own copy which we must use instead of the system one)
452+
if( tool = FBCTOOL_AS ) then
453+
path = fbcQueryGcc( " -print-prog-name=as" )
454+
elseif( tool = FBCTOOL_LD ) then
455+
path = fbcQueryGcc( " -print-prog-name=ld" )
456+
end if
457+
case FB_BACKEND_GAS, FB_BACKEND_GAS64
458+
#if defined( __FB_FREEBSD__ )
459+
'' gas backend? and we are looking for the linker? and we're hosted freebsd?
460+
'' switch to ld.bfd instead...
461+
if( tool = FBCTOOL_LD ) then
462+
fbctoolTB(tool).name = "ld.bfd"
463+
path = fbc.binpath + fbctoolTB(tool).name + FB_HOST_EXEEXT
464+
end if
465+
#endif
466+
end select
455467
end if
456468

457469
if( hFileExists( path ) = FALSE ) then

0 commit comments

Comments
 (0)