[haiku-commits] haiku: hrev52208 - build/jam src/system/libroot/os

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 11 Aug 2018 15:36:47 -0400 (EDT)

hrev52208 adds 6 changesets to branch 'master'
old head: eef7e3f1f85d9ac4104b11256064c938a1ba9cc1
new head: b8a38e2bc1a6acae1b9a91dc082aafafe4af0911
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=b8a38e2bc1a6+%5Eeef7e3f1f85d

----------------------------------------------------------------------------

cf10fee2c12e: ArchitectureRules: Pass -march / -mcpu flags to the assembler 
also.
  
  Fixes #14317.

47a96c099e73: MainBuildRules: Fix CreateAsmStructOffsetsHeader on recent Clang.
  
  It seems that at on some platforms at least, Clang uses @define instead
  of #define, but with functionally identical syntax, so use sed to
  process it as such.

376472a816f4: libroot: Some fixes for Clang ARM builds.

d0bfb2c04424: ArchitectureRules: Append Clang flags before potential early-exit.
  
  Gets the Clang-ARM build a bit further into libroot.

e823d3f06fc3: BeOSRules: Pass CCFLAGS through to the compiler during ResComp.
  
  Otherwise, Clang warns that we haven't set an architecture on ARM,
  which is set in CCFLAGS. Since these might also contain other flags
  that affect the preprocessor, there isn't any good reason to not
  pass it through, so do that.

b8a38e2bc1a6: ArchitectureRules: Move Clang warning flags to appropriate 
location.
  
  Also tweak the no-delete-null-pointer-checks comment so it's slightly
  less offending of the 80-chars rule.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 31 insertions(+), 28 deletions(-)
build/jam/ArchitectureRules             | 42 +++++++++++++----------------
build/jam/BeOSRules                     |  7 ++++-
build/jam/MainBuildRules                |  6 ++---
src/system/libroot/os/arch/arm/thread.c |  2 ++
src/system/libroot/os/atomic.c          |  2 +-

############################################################################

Commit:      cf10fee2c12e130b5aec53a65b0cb898e7d77cdf
URL:         https://git.haiku-os.org/haiku/commit/?id=cf10fee2c12e
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:18:36 2018 UTC

Ticket:      https://dev.haiku-os.org/ticket/14317

ArchitectureRules: Pass -march / -mcpu flags to the assembler also.

Fixes #14317.

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 38ff33e53a..1f863f3ac9 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -50,12 +50,14 @@ rule ArchitectureSetup architecture
        }
 
        # default architecture tuning
-       # TODO: Do we want x86_gcc2 -march=pentium here?
        local cpu = $(HAIKU_CPU_$(architecture)) ;
+       local archFlags ;
        switch $(cpu) {
-               case arm :
-                       ccBaseFlags += -march=armv7-a -mfloat-abi=hard ;
+               case ppc : archFlags += -mcpu=440fp ;
+               case arm : archFlags += -march=armv7-a -mfloat-abi=hard ;
+               case x86 : archFlags += -march=pentium ;
        }
+       ccBaseFlags += $(archFlags) ;
 
        if $(cpu) = arm {
                if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
@@ -78,6 +80,7 @@ rule ArchitectureSetup architecture
 
        HAIKU_CCFLAGS_$(architecture) += $(ccBaseFlags) -nostdinc ;
        HAIKU_C++FLAGS_$(architecture) += $(ccBaseFlags) -nostdinc ;
+       HAIKU_ASFLAGS_$(architecture) += $(archFlags) -nostdinc ;
 
        # strip is required
        if ! $(HAIKU_STRIP_$(architecture)) {
@@ -111,9 +114,6 @@ rule ArchitectureSetup architecture
        # set variables for gcc header options
        SetIncludePropertiesVariables HAIKU : _$(architecture) ;
 
-       # assembler flags
-       HAIKU_ASFLAGS_$(architecture) = ;
-
        # C/C++ flags
        if $(gccVersion[1]) >= 4 {
                HAIKU_C++FLAGS_$(architecture) += -Wno-deprecated ;
@@ -373,9 +373,6 @@ rule KernelArchitectureSetup architecture
                        HAIKU_KERNEL_C++FLAGS += -mtune=68020-60 ;
 
                case x86 :
-                       HAIKU_KERNEL_CCFLAGS += -march=pentium ;
-                       HAIKU_KERNEL_C++FLAGS += -march=pentium ;
-
                        # EFI Bootloader
                        if $(HAIKU_BOOT_PLATFORM) = efi {
                                HAIKU_BOOT_CCFLAGS += -mno-red-zone 
-maccumulate-outgoing-args ;

############################################################################

Commit:      47a96c099e739f46184dd9e0ad1de0615074f61b
URL:         https://git.haiku-os.org/haiku/commit/?id=47a96c099e73
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:20:30 2018 UTC

MainBuildRules: Fix CreateAsmStructOffsetsHeader on recent Clang.

It seems that at on some platforms at least, Clang uses @define instead
of #define, but with functionally identical syntax, so use sed to
process it as such.

----------------------------------------------------------------------------

diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules
index fbb70e08ce..b33ad8c9e8 100644
--- a/build/jam/MainBuildRules
+++ b/build/jam/MainBuildRules
@@ -267,6 +267,7 @@ rule CreateAsmStructOffsetsHeader header : source
 
        on $(header) { # use on $(1) variable values
                if ! $(PLATFORM) in $(SUPPORTED_PLATFORMS) {
+                       Echo $(PLATFORM) is not in SUPPORTED_PLATFORMS, cannot 
make struct-offsets header! ;
                        return ;
                }
 
@@ -283,7 +284,6 @@ rule CreateAsmStructOffsetsHeader header : source
                        if $(USES_BE_API) {
                                sysHeaders += $(HOST_BE_API_HEADERS) ;
                        }
-
                } else {
                        sysHeaders += [ FStandardHeaders 
$(TARGET_PACKAGING_ARCH) ]
                                $(TARGET_HDRS_$(TARGET_PACKAGING_ARCH)) ;
@@ -320,7 +320,6 @@ rule CreateAsmStructOffsetsHeader header : source
                        includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
                        localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
                        systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
-
                } else {
                        # warning flags
                        if $(WARNINGS) != 0 {
@@ -377,7 +376,8 @@ rule CreateAsmStructOffsetsHeader header : source
 actions CreateAsmStructOffsetsHeader1
 {
        $(C++) -S "$(2)" $(C++FLAGS) $(CCDEFS) $(CCHDRS) -o - \
-               | grep "#define" | $(SED) -e 's/[\$\#]\([0-9]\)/\1/' > "$(1)"
+               | $(SED) 's/@define/#define/g' | grep "#define" \
+               | $(SED) -e 's/[\$\#]\([0-9]\)/\1/' > "$(1)"
 }
 
 rule MergeObjectFromObjects

############################################################################

Commit:      376472a816f4e4dd3d77331286fa0be12145d674
URL:         https://git.haiku-os.org/haiku/commit/?id=376472a816f4
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:26:08 2018 UTC

libroot: Some fixes for Clang ARM builds.

----------------------------------------------------------------------------

diff --git a/src/system/libroot/os/arch/arm/thread.c 
b/src/system/libroot/os/arch/arm/thread.c
index e922970bca..b635ac2831 100644
--- a/src/system/libroot/os/arch/arm/thread.c
+++ b/src/system/libroot/os/arch/arm/thread.c
@@ -21,6 +21,7 @@ find_thread(const char *name)
 }
 
 
+#if !defined(__clang__)
 /*
  * Fill out gcc __sync_synchronize built-in for ARM
  */
@@ -29,3 +30,4 @@ __sync_synchronize(void)
 {
        dmb();
 }
+#endif
diff --git a/src/system/libroot/os/atomic.c b/src/system/libroot/os/atomic.c
index a64fb67bb4..345e356a3c 100644
--- a/src/system/libroot/os/atomic.c
+++ b/src/system/libroot/os/atomic.c
@@ -108,7 +108,7 @@ atomic_get64(int64 *value)
 
 #endif /* ATOMIC64_FUNCS_ARE_SYSCALLS */
 
-#if defined(__arm__)
+#if defined(__arm__) && !defined(__clang__)
 
 /* GCC compatibility: libstdc++ needs this one.
  * TODO: Update libstdc++ and drop this.

############################################################################

Commit:      d0bfb2c0442473a82a2034b99e8668ac71dc7783
URL:         https://git.haiku-os.org/haiku/commit/?id=d0bfb2c04424
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:26:54 2018 UTC

ArchitectureRules: Append Clang flags before potential early-exit.

Gets the Clang-ARM build a bit further into libroot.

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 1f863f3ac9..2f9c2b23f3 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -460,6 +460,12 @@ rule ArchitectureSetupWarnings architecture
        # Sets up compiler warnings and error flags for various subdirectories 
for
        # the given packaging architecture.
 
+       if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
+               AppendToConfigVar CCFLAGS :
+                       HAIKU_TOP src system libroot posix glibc :
+                       -fgnu89-inline -fheinous-gnu-extensions : global ;
+       }
+
        local cpu = $(HAIKU_CPU_$(architecture)) ;
        switch $(cpu) {
                case arm :
@@ -494,12 +500,6 @@ rule ArchitectureSetupWarnings architecture
                WARNINGS on $(file) = $(WARNINGS) ;
        }
 
-       if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
-               AppendToConfigVar CCFLAGS :
-                       HAIKU_TOP src system libroot posix glibc :
-                       -fgnu89-inline -fheinous-gnu-extensions : global ;
-       }
-
        EnableWerror src add-ons accelerants ;
        EnableWerror src add-ons bluetooth ;
        EnableWerror src add-ons decorators ;

############################################################################

Commit:      e823d3f06fc3f999a09951442c5120874ed34a9b
URL:         https://git.haiku-os.org/haiku/commit/?id=e823d3f06fc3
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:33:08 2018 UTC

BeOSRules: Pass CCFLAGS through to the compiler during ResComp.

Otherwise, Clang warns that we haven't set an architecture on ARM,
which is set in CCFLAGS. Since these might also contain other flags
that affect the preprocessor, there isn't any good reason to not
pass it through, so do that.

----------------------------------------------------------------------------

diff --git a/build/jam/BeOSRules b/build/jam/BeOSRules
index 17d3715fb7..b12bafa6b9 100644
--- a/build/jam/BeOSRules
+++ b/build/jam/BeOSRules
@@ -222,6 +222,7 @@ rule ResComp
        # get compiler and defines for the platform
        local cc ;
        local defines ;
+       local flags ;
        local localIncludesOption ;
 
        on $(1) { # use on $(1) variable values
@@ -230,11 +231,13 @@ rule ResComp
                if $(PLATFORM) = host {
                        defines += $(HOST_DEFINES) ;
                        cc = $(HOST_CC) ;
+                       flags += $(HOST_CCFLAGS) ;
                        localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
                } else {
                        defines += $(TARGET_DEFINES_$(TARGET_PACKAGING_ARCH))
                                $(TARGET_DEFINES) ;
                        cc = $(TARGET_CC_$(TARGET_PACKAGING_ARCH)) ;
+                       flags += $(TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH)) ;
                        localIncludesOption
                                = 
$(TARGET_LOCAL_INCLUDES_OPTION_$(TARGET_PACKAGING_ARCH)) ;
                }
@@ -242,6 +245,7 @@ rule ResComp
 
        DEFINES on $(1) = $(defines) ;
        CCDEFS on $(1) = [ FDefines $(defines) ] ;
+       CCFLAGS on $(1) = $(flags) ;
        HDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
                : $(localIncludesOption) ] ;
        RCHDRS on $(1) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS)
@@ -261,7 +265,8 @@ rule ResComp
 actions ResComp1
 {
        $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
-       cat "$(2[2-])" | $(CC) -E $(CCDEFS) $(HDRS) - | egrep -v '^#' | $(2[1]) 
$(RCHDRS) --auto-names -o "$(1)" -
+       cat "$(2[2-])" | $(CC) $(CCFLAGS) -E $(CCDEFS) $(HDRS) - \
+               | egrep -v '^#' | $(2[1]) $(RCHDRS) --auto-names -o "$(1)" -
 }
 
 rule ResAttr attributeFile : _resourceFiles : deleteAttributeFile

############################################################################

Revision:    hrev52208
Commit:      b8a38e2bc1a6acae1b9a91dc082aafafe4af0911
URL:         https://git.haiku-os.org/haiku/commit/?id=b8a38e2bc1a6
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Aug 11 19:36:04 2018 UTC

ArchitectureRules: Move Clang warning flags to appropriate location.

Also tweak the no-delete-null-pointer-checks comment so it's slightly
less offending of the 80-chars rule.

----------------------------------------------------------------------------

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 2f9c2b23f3..91a44caa90 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -29,11 +29,11 @@ rule ArchitectureSetup architecture
        # 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://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
+       #  - https://github.com/torvalds/linux/commit/a3ca86aea507904
        if $(gccVersion[1]) >= 3 {
                ccBaseFlags += -fno-delete-null-pointer-checks ;
        }
@@ -43,12 +43,6 @@ rule ArchitectureSetup architecture
                ccBaseFlags += -fno-builtin-fork -fno-builtin-vfork ;
        }
 
-       # disable some Clang warnings that are not very useful
-       if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
-               ccBaseFlags += -Wno-address-of-packed-member 
-Wno-unused-private-field
-                       -Wno-cast-align -Wno-gnu-designator ;
-       }
-
        # default architecture tuning
        local cpu = $(HAIKU_CPU_$(architecture)) ;
        local archFlags ;
@@ -126,6 +120,11 @@ rule ArchitectureSetup architecture
        HAIKU_WARNING_C++FLAGS_$(architecture) = -Wall -Wno-trigraphs
                -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith 
-Wcast-align
                -Wsign-compare -Wno-multichar ;
+       # disable some Clang warnings that are not very useful
+       if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
+               ccBaseFlags += -Wno-address-of-packed-member 
-Wno-unused-private-field
+                       -Wno-cast-align -Wno-gnu-designator ;
+       }
 
        HAIKU_WERROR_FLAGS_$(architecture) = ;
 


Other related posts:

  • » [haiku-commits] haiku: hrev52208 - build/jam src/system/libroot/os - waddlesplash