[haiku-commits] haiku: hrev52579 - build/jam

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 23 Nov 2018 00:14:03 -0500 (EST)

hrev52579 adds 5 changesets to branch 'master'
old head: 44fc903a8f226e0c3cdc43ffad05a859ec3aaa53
new head: cb101bdad6181fa8217180a81fb3a6f31f5c6c91
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=cb101bdad618+%5E44fc903a8f22

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

58b7901304cd: ArchitectureRules: Bootloader rules cleanup.
  
   * Move -fPIC to ccBaseFlags, as we don't want it in ASFLAGS.
   * Remove -fPIC from BOOT_CCFLAGS, as we never want it in there.
   * Move EFI flags to the actual EFI setup location.

df34a27137b9: build: Do not use regular TARGET_*FLAGS in kernel and bootloader.
  
  The generic CCFLAGS are already appended to the HAIKU_KERNEL_*FLAGS
  and HAIKU_BOOT_*FLAGS, so these were just duplicates. And now that
  we strip certain flags out of the base ones, this was incorrect
  (and causes Clang to error in some circumstances.)

c371f18d7e7e: OverriddenJamRules: Remove TODO.
  
  All relevant flags have been added to ASFLAGS where necessary.

2b69731ab3b1: Jamfile: Remove doc_files.
  
  Unused.

cb101bdad618: BootRules: Fix BuildMBR under Clang.
  
  We need to force -m32 here, and we also need to tell Clang that we
  want to allow relocations in .text.
  
  Clang builds now get to kernel entry, but the bootloader fails to
  load the early-boot modules with strange remapping errors, and so
  panics with "get boot partitions failed!"

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

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

5 files changed, 37 insertions(+), 18 deletions(-)
Jamfile                      |  3 ---
build/jam/ArchitectureRules  | 39 ++++++++++++++++++++++++++++-----------
build/jam/BootRules          |  6 +++++-
build/jam/KernelRules        |  4 ++++
build/jam/OverriddenJamRules |  3 ---

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

Commit:      58b7901304cd9b3a4577c71fed5dc7931c727455
URL:         https://git.haiku-os.org/haiku/commit/?id=58b7901304cd
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Nov 22 18:15:16 2018 UTC

ArchitectureRules: Bootloader rules cleanup.

 * Move -fPIC to ccBaseFlags, as we don't want it in ASFLAGS.
 * Remove -fPIC from BOOT_CCFLAGS, as we never want it in there.
 * Move EFI flags to the actual EFI setup location.

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

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 24da31e225..7ac2276521 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -53,7 +53,7 @@ rule ArchitectureSetup architecture
        }
        if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {
                # TODO: These should be included in Clang's compiler specs.
-               archFlags += -fPIC ;
+               ccBaseFlags += -fPIC ;
                HAIKU_LINKFLAGS_$(architecture) += -shared ;
        }
        ccBaseFlags += $(archFlags) ;
@@ -395,6 +395,25 @@ rule KernelArchitectureSetup architecture
        HAIKU_BOOT_LINKFLAGS = ;
        HAIKU_BOOT_LDFLAGS = -Bstatic ;
 
+       # Remove -fPIC and other unwanted options from the BOOT flags (they are 
sometimes
+       # added to force PIC in general.)
+       local fixedBootCCFlags ;
+       local fixedBootC++Flags ;
+       for flag in $(HAIKU_BOOT_CCFLAGS) {
+               if $(flag) = "-fpic" || $(flag) = "-fPIC" {
+                       continue ;
+               }
+               fixedBootCCFlags += $(flag) ;
+       }
+       for flag in $(HAIKU_BOOT_C++FLAGS) {
+               if $(flag) = "-fpic" || $(flag) = "-fPIC" {
+                       continue ;
+               }
+               fixedBootC++Flags += $(flag) ;
+       }
+       HAIKU_BOOT_CCFLAGS = $(fixedBootCCFlags) ;
+       HAIKU_BOOT_C++FLAGS = $(fixedBootC++Flags) ;
+
        # Any special kernel base addresses
        if $(HAIKU_BOOT_LOADER_BASE) {
                HAIKU_BOOT_LDFLAGS +=
@@ -439,14 +458,6 @@ rule KernelArchitectureSetup architecture
                        HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
                        HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 
;
 
-                       # Just slip these in here as well for EFI (if used)
-                       HAIKU_BOOT_EFI_CCFLAGS += -mno-red-zone ;
-                       HAIKU_BOOT_EFI_C++FLAGS += -mno-red-zone ;
-                       if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
-                               HAIKU_BOOT_EFI_CCFLAGS += 
-maccumulate-outgoing-args ;
-                               HAIKU_BOOT_EFI_C++FLAGS += 
-maccumulate-outgoing-args ;
-                       }
-
                        if x86 in $(HAIKU_ARCHS[2-]) || x86_gcc2 in 
$(HAIKU_ARCHS[2-]) {
                                Echo "Enable kernel ia32 compatibility" ;
                                HAIKU_KERNEL_DEFINES += _COMPAT_MODE ;
@@ -461,9 +472,15 @@ rule KernelArchitectureSetup architecture
                        case efi :
                                # efi bootloader is PIC
                                HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += -fpic 
-fno-stack-protector
-                                       -fPIC -fshort-wchar 
-Wno-error=unused-variable -Wno-error=main ;
+                                       -fPIC -fshort-wchar 
-Wno-error=unused-variable -Wno-error=main
+                                       -mno-red-zone ;
                                HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += -fpic 
-fno-stack-protector
-                                       -fPIC -fshort-wchar 
-Wno-error=unused-variable -Wno-error=main ;
+                                       -fPIC -fshort-wchar 
-Wno-error=unused-variable -Wno-error=main
+                                       -mno-red-zone ;
+                               if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
+                                       HAIKU_BOOT_$(bootTarget:U)_CCFLAGS += 
-maccumulate-outgoing-args ;
+                                       HAIKU_BOOT_$(bootTarget:U)_C++FLAGS += 
-maccumulate-outgoing-args ;
+                               }
                                HAIKU_BOOT_$(bootTarget:U)_LDFLAGS = -Bstatic 
-Bsymbolic
                                        -nostdlib -znocombreloc -no-undefined ;
                        case bios_ia32 :

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

Commit:      df34a27137b927c9f7cd25be1bda68d6a086a9f6
URL:         https://git.haiku-os.org/haiku/commit/?id=df34a27137b9
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Nov 22 18:16:32 2018 UTC

build: Do not use regular TARGET_*FLAGS in kernel and bootloader.

The generic CCFLAGS are already appended to the HAIKU_KERNEL_*FLAGS
and HAIKU_BOOT_*FLAGS, so these were just duplicates. And now that
we strip certain flags out of the base ones, this was incorrect
(and causes Clang to error in some circumstances.)

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

diff --git a/build/jam/BootRules b/build/jam/BootRules
index 404efdb8ca..2e18934804 100644
--- a/build/jam/BootRules
+++ b/build/jam/BootRules
@@ -96,6 +96,10 @@ rule SetupBoot
                ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
                ASFLAGS on $(object) = $(HAIKU_BOOT_CCFLAGS) 
$(HAIKU_BOOT_$(platform)_CCFLAGS) ;
 
+               # override regular CCFLAGS/C++FLAGS, as we don't want them
+               TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = ;
+               TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = ;
+
                # override warning flags
                TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
                        = $(TARGET_KERNEL_WARNING_CCFLAGS) ;
diff --git a/build/jam/KernelRules b/build/jam/KernelRules
index ce110183f4..e1077c25ed 100644
--- a/build/jam/KernelRules
+++ b/build/jam/KernelRules
@@ -21,6 +21,10 @@ rule SetupKernel
                ObjectC++Flags $(object) : $(TARGET_KERNEL_C++FLAGS) $(2) ;
                ObjectDefines $(object) : $(TARGET_KERNEL_DEFINES) ;
 
+               # override regular CCFLAGS/C++FLAGS, as we don't want them
+               TARGET_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = ;
+               TARGET_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object) = ;
+
                # override warning flags
                TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
                        = $(TARGET_KERNEL_WARNING_CCFLAGS) ;

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

Commit:      c371f18d7e7ea7245535a8405b593c36e80ef4e1
URL:         https://git.haiku-os.org/haiku/commit/?id=c371f18d7e7e
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Nov 22 18:17:06 2018 UTC

OverriddenJamRules: Remove TODO.

All relevant flags have been added to ASFLAGS where necessary.

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

diff --git a/build/jam/OverriddenJamRules b/build/jam/OverriddenJamRules
index d887932c64..599ba2003d 100644
--- a/build/jam/OverriddenJamRules
+++ b/build/jam/OverriddenJamRules
@@ -206,8 +206,6 @@ rule As
        ASDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;
 }
 
-# TODO: The KERNEL_CCFLAGS were used here before. Check whether we need any
-# flags we don't have now.
 actions As
 {
        $(CC) -c "$(2)" -O2 $(ASFLAGS) -D_ASSEMBLER $(ASDEFS) $(ASHDRS) -o 
"$(1)" ;
@@ -289,7 +287,6 @@ rule Cc
                        includesSeparator = $(HOST_INCLUDES_SEPARATOR) ;
                        localIncludesOption = $(HOST_LOCAL_INCLUDES_OPTION) ;
                        systemIncludesOption = $(HOST_SYSTEM_INCLUDES_OPTION) ;
-
                } else {
                        # warning flags
                        if $(WARNINGS) != 0 {

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

Commit:      2b69731ab3b1580d771cfd4aa8bc66485c74066e
URL:         https://git.haiku-os.org/haiku/commit/?id=2b69731ab3b1
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Nov 22 18:17:21 2018 UTC

Jamfile: Remove doc_files.

Unused.

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

diff --git a/Jamfile b/Jamfile
index 092c533f8a..dbc835c580 100644
--- a/Jamfile
+++ b/Jamfile
@@ -1,8 +1,5 @@
 SubDir HAIKU_TOP ;
 
-NotFile doc_files ;
-Depends files : doc_files ;
-
 # Prepare the optional build features before parsing the Jamfile tree.
 local architectureObject ;
 for architectureObject in [ MultiArchSubDirSetup ] {

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

Revision:    hrev52579
Commit:      cb101bdad6181fa8217180a81fb3a6f31f5c6c91
URL:         https://git.haiku-os.org/haiku/commit/?id=cb101bdad618
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Fri Nov 23 05:03:51 2018 UTC

BootRules: Fix BuildMBR under Clang.

We need to force -m32 here, and we also need to tell Clang that we
want to allow relocations in .text.

Clang builds now get to kernel entry, but the bootloader fails to
load the early-boot modules with strange remapping errors, and so
panics with "get boot partitions failed!"

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

diff --git a/build/jam/BootRules b/build/jam/BootRules
index 2e18934804..6095e9d21b 100644
--- a/build/jam/BootRules
+++ b/build/jam/BootRules
@@ -221,6 +221,6 @@ actions BuildMBR
 {
        $(RM) $(1)
        $(HAIKU_CC_$(HAIKU_PACKAGING_ARCH)) 
$(HAIKU_LINKFLAGS_$(HAIKU_PACKAGING_ARCH)) \
-               $(2) -o $(1) $(MBRFLAGS) -nostdlib -Xlinker --oformat=binary \
+               $(2) -o $(1) $(MBRFLAGS) -nostdlib -m32 -Wl,--oformat,binary 
-Wl,-z,notext \
                -Xlinker -S -Xlinker -N -Xlinker --entry=start -Xlinker 
-Ttext=0x600
 }


Other related posts:

  • » [haiku-commits] haiku: hrev52579 - build/jam - waddlesplash