ArchitectureRules: Cleanups to base flags.

* Trim down comment about fno-delete-null-pointer-checks.

 * Remove -fno-builtin-fork -fno-builtin-vfork, they don't seem
   to be needed with GCC 13.

 * Remove legacy-GCC settings from kernel flags, as we don't use
   legacy-GCC there anymore. Also drop fno-builtin as ffreestanding
   implies this.
This commit is contained in:
Augustin Cavalier 2024-09-24 13:51:22 -04:00
parent 79d79dd592
commit c289d46cf1

View File

@ -21,17 +21,10 @@ rule ArchitectureSetup architecture
ccBaseFlags += -fno-strict-aliasing ;
# Without this flag, GCC deletes many null-pointer checks that are
# technically undefined behavior (e.g. passing NULL to strdup, among
# others), which breaks both the kernel and various applications. See:
# - https://freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
# - https://dev.haiku-os.org/ticket/13285#comment:8 (& subsequent comments)
# - https://dev.haiku-os.org/ticket/10803#comment:4 (& subsequent comments)
# Note that the Linux also does the same:
# - https://github.com/torvalds/linux/commit/a3ca86aea507904
# technically undefined behavior (e.g. checking for NULL in strdup, or
# for `this` in member functions), which breaks the kernel and various
# applications. (Linux does the same.)
ccBaseFlags += -fno-delete-null-pointer-checks ;
# disable some builtins that are incompatible with our definitions
ccBaseFlags += -fno-builtin-fork -fno-builtin-vfork ;
}
# default architecture tuning
@ -343,21 +336,16 @@ rule KernelArchitectureSetup architecture
;
# C/C++ flags
local ccBaseFlags = -finline -fno-builtin -Wno-main ;
local ccBaseFlags = -ffreestanding -finline -fno-semantic-interposition ;
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
ccBaseFlags += -ffreestanding -fno-semantic-interposition ;
# Since GCC 13, autovectorization generates code which causes problems
# in various virtual machines (bare metal is apparently unaffected.)
# Until this can be resolved, disable for the kernel. (See #18593.)
ccBaseFlags += -fno-tree-vectorize ;
}
# Since GCC 13, autovectorization generates code which causes problems
# in various virtual machines (bare metal is apparently unaffected.)
# Until this can be resolved, disable for the kernel. (See #18593.)
ccBaseFlags += -fno-tree-vectorize ;
local c++BaseFlags = $(ccBaseFlags) -fno-exceptions ;
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1
&& $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
c++BaseFlags += -fno-use-cxa-atexit ;
}