diff --git a/changelog.txt b/changelog.txt index 1fce396af..4284f6e00 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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. diff --git a/src/compiler/fbc.bas b/src/compiler/fbc.bas index 6406780e0..e7765e4de 100644 --- a/src/compiler/fbc.bas +++ b/src/compiler/fbc.bas @@ -104,6 +104,7 @@ type FBCCTX sysroot as zstring * FB_MAXPATHLEN+1 xbe_title as zstring * FB_MAXNAMELEN+1 '' For the '-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 @@ -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 @@ -2242,6 +2243,7 @@ private sub handleOpt _ case OPT_NODEFLIBS fbc.nodeflibs = TRUE + fbc.nofbrt0 = TRUE case OPT_NOERRLINE fbSetOption( FB_COMPOPT_SHOWERROR, FALSE ) @@ -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