Skip to content

Commit

Permalink
fbc: allow '-nolib fbrt0.o' and '-nolib fbrt0pic.o'
Browse files Browse the repository at this point in the history
- '-nolib fbrt0.o' and '-nolib fbrt0pic.o' can be used
  to omit fb's startup files from the link.
- Implied by '-nodeflibs'
  • Loading branch information
jayrm committed Feb 24, 2024
1 parent e46614b commit 74a9856
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Expand Up @@ -37,6 +37,7 @@ Version 1.20.0
- makefile: option FBFORKID="name", or by adding to config.mk, to set the internal constant FB_BUILD_FORK_ID. Intended to identify experimental variants of fbc
- fbc: __FB_BUILD_FORK_ID__ intrinsic define. By default is an empty string. Can be customized by makefile
- fbc: '-print fork-id' command line option to report the fork-id version of fbc
- fbc: '-nolib fbrt0.o' and '-nolib fbrt0pic.o' can be used to omit fb's startup files from the link. Implied by '-nodeflibs'.

[fixed]
- github #410: give consistent floating point comparisons results involving NaNs.
Expand Down
11 changes: 9 additions & 2 deletions src/compiler/fbc.bas
Expand Up @@ -104,6 +104,7 @@ type FBCCTX
sysroot as zstring * FB_MAXPATHLEN+1
xbe_title as zstring * FB_MAXNAMELEN+1 '' For the '-title <title>' xbox option
nodeflibs as integer
nofbrt0 as integer '' If we should exclude fbrt0.o or fbrt0pic.o (implied by nodeflibs, and optional by -nolib fbrt0.o,fbrt0pic.o)
staticlink as integer
stripsymbols as integer

Expand Down Expand Up @@ -1214,7 +1215,7 @@ private function hLinkFiles( ) as integer

end select

if( fbc.nodeflibs = FALSE ) then
if( fbc.nofbrt0 = FALSE ) then
'' don't add the fbrt0 if compiling for javascript, because global constructors and destructors are not supported by emscripten
if( fbGetOption( FB_COMPOPT_TARGET ) <> FB_COMPTARGET_JS ) then
ldcline += " """ + fbc.libpath + FB_HOST_PATHDIV
Expand Down Expand Up @@ -2242,6 +2243,7 @@ private sub handleOpt _

case OPT_NODEFLIBS
fbc.nodeflibs = TRUE
fbc.nofbrt0 = TRUE

case OPT_NOERRLINE
fbSetOption( FB_COMPOPT_SHOWERROR, FALSE )
Expand Down Expand Up @@ -4376,7 +4378,12 @@ private sub hExcludeLibsFromLink( )
'' Remove any excluded libs from fbc.finallibs list
dim as TSTRSETITEM ptr i = listGetHead(@fbc.excludedlibs.list)
while i
strsetDel(@fbc.finallibs, i->s)
select case i->s
case "fbrt0.o", "fbrt0pic.o"
fbc.nofbrt0 = TRUE
case else
strsetDel(@fbc.finallibs, i->s)
end select
i = listGetNext(i)
wend
end sub
Expand Down

0 comments on commit 74a9856

Please sign in to comment.