From: kosmirror <kos...@us...> - 2025-08-05 16:49:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 584c550e134979fc69b86e0efb63546764146d4e (commit) via 0899526b0a9e358228149f933f3f06c03ea2074e (commit) from c71cc6e505324e35235208c574c04b3a872c2fba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 584c550e134979fc69b86e0efb63546764146d4e Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 11:21:31 2025 -0500 Fixed building "library" example with LTO. ...by disabling LTO within its specific Makefiles to still work with globally enabled LTO using fat objects. commit 0899526b0a9e358228149f933f3f06c03ea2074e Author: Falco Girgis <gyr...@gm...> Date: Tue Aug 5 11:18:26 2025 -0500 Updated environ.sh.sample. 1) New defaults for using builtins and no position-independent code. 2) New option for LTO, which automatically uses fat objects for compatibility. 3) New optional flags for various optimizations such as -fipa-pta. ----------------------------------------------------------------------- Summary of changes: doc/environ.sh.sample | 49 +++++++++++++++------- .../dreamcast/library/loadable-dependence/Makefile | 2 +- .../dreamcast/library/loadable-dependent/Makefile | 2 +- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/doc/environ.sh.sample b/doc/environ.sh.sample index e23238c7..e9cf952d 100644 --- a/doc/environ.sh.sample +++ b/doc/environ.sh.sample @@ -138,23 +138,42 @@ export DC_ARM_LDFLAGS="" # Controls the baseline optimization level to use when building. # Typically this is -Og (debugging), -O0, -O1, -O2, or -O3. # NOTE: For our target, -O4 is a valid optimization level that has -# been seen to have some performance impact as well. +# been seen to have some performance impact as well. # export KOS_CFLAGS="${KOS_CFLAGS} -O2" +# Link-Time Optimization +# +# Uncomment this to enable LTO, which can substantially improve performance +# of the generated code by enabling the linker to perform inlining, at the +# cost of longer build times and fatter object files. +# NOTE: Certain ports and examples require fat LTO objects to work with LTO, +# and LTO itself is known to cause issues in code with undefined behavior. +# +#export KOS_CFLAGS="${KOS_CFLAGS} -flto=auto -ffat-lto-objects" + # Additional Optimizations # -# Uncomment this to enable what has been found empirically to be -# the optimal set of additional flags for release build performance -# on the current stable toolchain. NOTE: Certain KOS-ports and examples -# do not work properly with "-flto=auto"! +# Uncomment these to enable what have been found empirically to be a decent +# set of additional flags for optimal release build performance with the +# current stable toolchain. +# +#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple" +#export KOS_CFLAGS="${KOS_CFLAGS} -fipa-pta" + +# Position-Independent Code +# +# Comment this line out to enable position-dependent code. Codegen is slightly +# slower, and you lose a register, but it's required when building dynamically +# linked libraries or code whose symbols aren't resolved until runtime. # -#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto" +export KOS_CFLAGS="${KOS_CFLAGS} -fno-PIC -fno-PIE" # Frame Pointers # -# Controls whether frame pointers are emitted or not. Disabled by -# default. Enable them if you plan to use GDB for debugging. +# Controls whether frame pointers are emitted or not. Disabled by default, as +# they use an extra register. Enable them if you plan to use GDB for debugging +# or need additional stack trace # export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer" #export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS" @@ -172,13 +191,12 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer" # GCC Builtin Functions # -# Comment out this line to enable GCC to use its own builtin implementations of -# certain standard library functions. Under certain conditions, this can allow -# compiler-optimized implementations to replace standard function invocations. -# The downside of this is that it COULD interfere with Newlib or KOS implementations -# of these functions, and it has not been tested thoroughly to ensure compatibility. +# Uncomment this line to prevent GCC from using its own builtin implementations of +# certain standard library functions. Under certain conditions, using builtins +# allows for compiler-optimized routines to replace function calls to the C standard +# library which are backed by Newlib or KOS. # -export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" +#export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # Fast Math Instructions # @@ -186,7 +204,8 @@ export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin" # FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots. # These can result in substantial performance gains for these kinds of operations; # however, they do so at the price of accuracy and are not IEEE compliant. -# NOTE: Enabling this option will also override -fno-builtin! +# NOTE: If these cause issues when enabled globally, it's advised to try to enable +# them on individual files in the critical path to still gain performance. # #export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast" diff --git a/examples/dreamcast/library/loadable-dependence/Makefile b/examples/dreamcast/library/loadable-dependence/Makefile index 4037085e..73a52088 100644 --- a/examples/dreamcast/library/loadable-dependence/Makefile +++ b/examples/dreamcast/library/loadable-dependence/Makefile @@ -10,7 +10,7 @@ TARGET_LIB = lib$(TARGET_NAME).a OBJS = $(TARGET_NAME).o # For exporting kos_md5 -LIBS = -lkosutils +LIBS = -lkosutils -fno-lto # library-test exported stub for link test DBG_LIBS = -llibrary-test diff --git a/examples/dreamcast/library/loadable-dependent/Makefile b/examples/dreamcast/library/loadable-dependent/Makefile index 772a00a4..a11990e1 100644 --- a/examples/dreamcast/library/loadable-dependent/Makefile +++ b/examples/dreamcast/library/loadable-dependent/Makefile @@ -13,6 +13,6 @@ DBG_LIBS = -llibrary-dependence -llibrary-test KOS_LIB_PATHS += -L../loadable-dependence -L../ # Dependence include -KOS_CFLAGS += -I../loadable-dependence +KOS_CFLAGS += -fno-lto -I../loadable-dependence include $(KOS_BASE)/loadable/Makefile.prefab hooks/post-receive -- A pseudo Operating System for the Dreamcast. |