hrev52024 adds 5 changesets to branch 'master'
old head: b06628148ff5caafcbd5f5dcb910379592702ab5
new head: c12499571324b5f9d9b4cd50cbf2894b1bc1eee1
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=c12499571324+%5Eb06628148ff5
----------------------------------------------------------------------------
29a21a63cbcc: ArchitectureRules: Enable -ftree-vrp, but use
-fno-delete-null-pointer-checks everywhere.
Most of the problems with tree-vrp stemmed from its deletion of null-pointer
checks (see linked commit in the source.) Now, GCC has a flag to control that,
and with it enabled I can boot to the desktop even with tree-vrp enabled.
9ac30627343f: kernel: Small fixes for Clang.
ddf7f6436591: configure: If set, pass the cross-tools-prefix when invoking
Clang.
This lets clang use our linker and other binutils instead of its own.
Now clang builds produce a working bootloader and get all the way
to the "rocket" icon, at which point userland init fails.
6c5fcb4f146c: configure: Move deduplifying targetArchs to where
HAIKU_PACKAGING_ARCHS is built.
If one specifies a cross-tools path instead of --build-cross-tools along
with --use-clang, then the specified architecture winds up in the list twice,
as the first test looks for the arch name where only "unknown" exists
(since in the case of cross-tools paths, we delay fetching the arch.)
So we need to move this check to there instead.
c12499571324: configure: Cleaner grouping of compiler settings.
Now, instead of breaking them up, all settings related to or gleaned
from the compiler are listed first (except for BOOT_CXXFLAGS_...).
No functional change intended.
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
5 files changed, 33 insertions(+), 45 deletions(-)
build/jam/ArchitectureRules | 37 +++++++++--------------
configure | 33 +++++++++-----------
headers/private/kernel/util/kernel_cpp.h | 2 --
src/system/kernel/arch/x86/64/descriptors.cpp | 4 +--
src/system/kernel/util/kernel_cpp.cpp | 2 +-
############################################################################
Commit: 29a21a63cbccef9a15a5639f57516061b4a995ee
URL: https://git.haiku-os.org/haiku/commit/?id=29a21a63cbcc
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Sun Jun 17 18:56:53 2018 UTC
ArchitectureRules: Enable -ftree-vrp, but use -fno-delete-null-pointer-checks
everywhere.
Most of the problems with tree-vrp stemmed from its deletion of null-pointer
checks (see linked commit in the source.) Now, GCC has a flag to control that,
and with it enabled I can boot to the desktop even with tree-vrp enabled.
----------------------------------------------------------------------------
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 6086d232ee..a028f8b928 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -19,30 +19,28 @@ rule ArchitectureSetup architecture
}
# disable strict aliasing on anything newer than gcc 2 as it may lead to
- # unexpected results. also disable the tree-vrp (value range
propagation)
- # optimization for now as with the current gcc4 version we are using
this
- # results in some broken code.
+ # unexpected results.
# TODO: remove the -fno-strict-aliasing option when all code has been
# analyzed/fixed with regard to aliasing.
- # TODO: retest/remove the -fno-tree-vrp option as soon as we have
updated
- # our gcc4 compiler. See this discussion on some issues:
- #
//www.freelists.org/post/haiku-development/hrev45320-Yet-another-nonobvious-effect-of-ftreevrp-optimization
if $(gccVersion[1]) >= 3 {
- gccBaseFlags += -fno-strict-aliasing -fno-builtin-fork ;
- if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
- gccBaseFlags += -fno-tree-vrp ;
- }
+ gccBaseFlags += -fno-strict-aliasing ;
}
- if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
- gccBaseFlags += -fno-builtin-vfork ;
+ # 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://www.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3ca86aea507904148870946d599e07a340b39bf
+ if $(gccVersion[1]) >= 3 && $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
+ gccBaseFlags += -fno-delete-null-pointer-checks ;
}
- # disable array bounds warnings on gcc 4.6 or newer since they trigger
- # too many false positives. Coverity does a better job of this kind of
- # analysis anyways.
- if $(gccVersion[1]) >= 4 {
- gccBaseFlags += -Wno-array-bounds ;
+ # disable some builtins that are incompatible with our definitions
+ if $(gccVersion[1]) >= 3 {
+ gccBaseFlags += -fno-builtin-fork -fno-builtin-vfork ;
}
local cpu = $(HAIKU_CPU_$(architecture)) ;
@@ -331,11 +329,6 @@ rule KernelArchitectureSetup architecture
HAIKU_BOOT_LINKFLAGS = ;
HAIKU_BOOT_LDFLAGS = -Bstatic ;
- if $(gccVersion[1]) >= 6 {
- HAIKU_KERNEL_C++FLAGS += -fno-delete-null-pointer-checks ;
- HAIKU_KERNEL_CCFLAGS += -fno-delete-null-pointer-checks ;
- }
-
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
HAIKU_KERNEL_PIC_LINKFLAGS = ;
HAIKU_KERNEL_ADDON_LINKFLAGS = ;
############################################################################
Commit: 9ac30627343f41f7619010035f7f6ecb16c0c55f
URL: https://git.haiku-os.org/haiku/commit/?id=9ac30627343f
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Mon Jun 18 21:30:25 2018 UTC
kernel: Small fixes for Clang.
----------------------------------------------------------------------------
diff --git a/headers/private/kernel/util/kernel_cpp.h
b/headers/private/kernel/util/kernel_cpp.h
index 0b493c4ab9..d904b16154 100644
--- a/headers/private/kernel/util/kernel_cpp.h
+++ b/headers/private/kernel/util/kernel_cpp.h
@@ -22,7 +22,6 @@ extern const nothrow_t std::nothrow;
typedef struct {} mynothrow_t;
extern const mynothrow_t mynothrow;
-#ifndef __clang__
#if __cplusplus >= 201402L
#define _THROW(x)
#define _NOEXCEPT noexcept
@@ -38,7 +37,6 @@ extern void* operator new(size_t size, const mynothrow_t &)
_NOEXCEPT;
extern void* operator new[](size_t size, const mynothrow_t &) _NOEXCEPT;
extern void operator delete(void *ptr) _NOEXCEPT;
extern void operator delete[](void *ptr) _NOEXCEPT;
-#endif
#if __cplusplus >= 201402L
diff --git a/src/system/kernel/arch/x86/64/descriptors.cpp
b/src/system/kernel/arch/x86/64/descriptors.cpp
index 3e516f0134..fd5d6ce68f 100644
--- a/src/system/kernel/arch/x86/64/descriptors.cpp
+++ b/src/system/kernel/arch/x86/64/descriptors.cpp
@@ -117,7 +117,7 @@ public:
unsigned ist, bool kernelOnly);
constexpr
InterruptDescriptor(uintptr_t isr);
- static constexpr InterruptDescriptor Generate(unsigned
index);
+ static InterruptDescriptor Generate(unsigned index);
private:
uint16_t fBase0;
@@ -331,7 +331,7 @@ InterruptDescriptorTable::Load() const
}
-constexpr InterruptDescriptor
+InterruptDescriptor
InterruptDescriptor::Generate(unsigned index)
{
return index == 3
diff --git a/src/system/kernel/util/kernel_cpp.cpp
b/src/system/kernel/util/kernel_cpp.cpp
index 4a55f693b7..10a5261ac0 100644
--- a/src/system/kernel/util/kernel_cpp.cpp
+++ b/src/system/kernel/util/kernel_cpp.cpp
@@ -31,7 +31,7 @@
// ... it doesn't seem to work with this symbol at least.
#ifndef USING_LIBGCC
-# if __GNUC__ >= 6
+# if __GNUC__ >= 6 || defined(__clang__)
const std::nothrow_t std::nothrow = std::nothrow_t{ };
# elif __GNUC__ >= 3
const std::nothrow_t std::nothrow = {};
############################################################################
Commit: ddf7f6436591e141c219bf8d10ed54624ca89cd0
URL: https://git.haiku-os.org/haiku/commit/?id=ddf7f6436591
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Mon Jun 18 21:45:47 2018 UTC
configure: If set, pass the cross-tools-prefix when invoking Clang.
This lets clang use our linker and other binutils instead of its own.
Now clang builds produce a working bootloader and get all the way
to the "rocket" icon, at which point userland init fails.
----------------------------------------------------------------------------
diff --git a/configure b/configure
index ecc1f218d5..e8fc69ff84 100755
--- a/configure
+++ b/configure
@@ -915,6 +915,9 @@ else
# prepare gcc settings and get the actual target architecture
if [ $useClang = 1 ]; then
gcc="$HAIKU_clang -target ${targetMachine}
-no-integrated-as"
+ if [ ! -z "${crossToolsPrefix}" ]; then
+ gcc="$gcc -B ${crossToolsPrefix}"
+ fi
# Clang's compiler intrinsics are not compatible with
GCC's or even
# across versions of Clang, so we must collect them for
use in the build.
############################################################################
Commit: 6c5fcb4f146c23e83b02628c008c6c4199185b7c
URL: https://git.haiku-os.org/haiku/commit/?id=6c5fcb4f146c
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Mon Jun 18 22:53:47 2018 UTC
configure: Move deduplifying targetArchs to where HAIKU_PACKAGING_ARCHS is
built.
If one specifies a cross-tools path instead of --build-cross-tools along
with --use-clang, then the specified architecture winds up in the list twice,
as the first test looks for the arch name where only "unknown" exists
(since in the case of cross-tools paths, we delay fetching the arch.)
So we need to move this check to there instead.
----------------------------------------------------------------------------
diff --git a/configure b/configure
index e8fc69ff84..0973959f67 100755
--- a/configure
+++ b/configure
@@ -656,14 +656,12 @@ while [ $# -gt 0 ] ; do
esac
set_variable buildCrossToolsMachine_$targetArch
$targetMachine
targetArchs="$targetArchs $targetArch"
- HAIKU_PACKAGING_ARCHS=
;;
--cross-tools-prefix)
assertparam "$1" $#
targetArch=unknown${unknownArchIndex}
set_variable crossToolsPrefix_$targetArch "$2"
targetArchs="$targetArchs $targetArch"
- HAIKU_PACKAGING_ARCHS=
unknownArchIndex=$(($unknownArchIndex + 1))
shift 2
;;
@@ -716,11 +714,7 @@ while [ $# -gt 0 ] ; do
&& [ -z `get_variable
buildCrossToolsMachine_$targetArch` ]; then
set_variable crossToolsPrefix_$targetArch llvm-
fi
- if ! test "${targetArchs#*$targetArch}" !=
"$targetArchs"; then
- # we have not already added this arch to
targetArchs, so add it now
- targetArchs="$targetArchs $targetArch"
- fi
- HAIKU_PACKAGING_ARCHS=
+ targetArchs="$targetArchs $targetArch"
shift 2
;;
--use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;;
@@ -807,11 +801,6 @@ if [ "$HAIKU_HOST_BUILD_ONLY" = 1 ]; then
HAIKU_NASM=$invalidCommand
HAIKU_STRIP=$invalidCommand
else
- if [ -n "$HAIKU_PACKAGING_ARCHS" ]; then
- targetArchs="$HAIKU_PACKAGING_ARCHS"
- fi
- HAIKU_PACKAGING_ARCHS=
-
# On Haiku determine target architectures and tools automatically.
if [ -z "$targetArchs" ]; then
if [ $HOST_PLATFORM != haiku_host ]; then
@@ -869,10 +858,15 @@ else
isPrimaryArch=1
for targetArch in $targetArchs; do
- # Note: targetArch is "unknown<n>" at this point, if a
cross-tools
+ # Note: targetArch is "unknown<n>" at this point if a
cross-tools
# prefix was specified. The standard_gcc_settings call below
will get
# the actual architecture.
+ if test "${HAIKU_PACKAGING_ARCHS#*$targetArch}" !=
"$HAIKU_PACKAGING_ARCHS"; then
+ # somehow we wound up with a duplicate arch; skip this
one
+ continue
+ fi
+
crossToolsPrefix=`get_variable crossToolsPrefix_$targetArch`
# build cross tools from sources
############################################################################
Revision: hrev52024
Commit: c12499571324b5f9d9b4cd50cbf2894b1bc1eee1
URL: https://git.haiku-os.org/haiku/commit/?id=c12499571324
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Mon Jun 18 22:59:55 2018 UTC
configure: Cleaner grouping of compiler settings.
Now, instead of breaking them up, all settings related to or gleaned
from the compiler are listed first (except for BOOT_CXXFLAGS_...).
No functional change intended.
----------------------------------------------------------------------------
diff --git a/configure b/configure
index 0973959f67..bb1c1adfaa 100755
--- a/configure
+++ b/configure
@@ -1016,15 +1016,16 @@ EOF
for targetArch in $HAIKU_PACKAGING_ARCHS; do
variables="
- HAIKU_GCC_RAW_VERSION HAIKU_GCC_RAW_VERSION
+ HAIKU_CC HAIKU_CC
+ HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG
+ HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE
+ HAIKU_CPU HAIKU_CPU
HAIKU_GCC_MACHINE HAIKU_GCC_MACHINE
+ HAIKU_GCC_RAW_VERSION HAIKU_GCC_RAW_VERSION
HAIKU_GCC_LIB_DIR HAIKU_GCC_LIB_DIR
- HAIKU_CPU HAIKU_CPU
HAIKU_BOOT_LIBGCC HAIKU_BOOT_LIBGCC
HAIKU_BOOT_LIBSUPC++ HAIKU_BOOT_LIBSUPCXX
HAIKU_AR HAIKU_AR
- HAIKU_CC HAIKU_CC
- HAIKU_CC_IS_CLANG HAIKU_CC_IS_CLANG
HAIKU_LD HAIKU_LD
HAIKU_OBJCOPY HAIKU_OBJCOPY
HAIKU_RANLIB HAIKU_RANLIB
@@ -1036,7 +1037,6 @@ for targetArch in $HAIKU_PACKAGING_ARCHS; do
HAIKU_LDFLAGS HAIKU_LDFLAGS
HAIKU_ARFLAGS HAIKU_ARFLAGS
HAIKU_UNARFLAGS HAIKU_UNARFLAGS
- HAIKU_USE_GCC_GRAPHITE HAIKU_USE_GCC_GRAPHITE
"
set -- $variables
while [ $# -ge 2 ]; do