kernel & addons: Build with the non-legacy GCC even on x86_gcc2h.
Only one code change: for some reason, GCC chokes on the cr3 functions as macros (throwing errors about invalid registers.) The BSDs have them as inline functions instead, so they are converted to that here. Tested and working. There seems to be about a 10% decrease in CPU time on some compilation benchmarks that I briefly tried. Change-Id: I31666297394d7619f83fca6ff5f933ddd6f07420 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4515 Tested-by: Commit checker robot <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
407f08de29
commit
7aa5574713
@@ -341,7 +341,7 @@ rule KernelArchitectureSetup architecture
|
||||
;
|
||||
|
||||
# C/C++ flags
|
||||
local ccBaseFlags = -finline -fno-builtin ;
|
||||
local ccBaseFlags = -finline -fno-builtin -Wno-main ;
|
||||
|
||||
if $(HAIKU_CC_IS_LEGACY_GCC_$(architecture)) != 1 {
|
||||
if $(HAIKU_CC_IS_CLANG_$(architecture)) != 1 {
|
||||
@@ -468,6 +468,11 @@ rule KernelArchitectureSetup architecture
|
||||
}
|
||||
|
||||
# bootloader-centric flags
|
||||
HAIKU_BOOT_CCFLAGS
|
||||
+= -DBOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
||||
HAIKU_BOOT_C++FLAGS
|
||||
+= -DBOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
||||
|
||||
local bootTarget ;
|
||||
for bootTarget in $(HAIKU_BOOT_TARGETS) {
|
||||
switch $(bootTarget) {
|
||||
@@ -557,11 +562,6 @@ rule KernelArchitectureSetup architecture
|
||||
# defines
|
||||
HAIKU_KERNEL_DEFINES += _KERNEL_MODE ;
|
||||
|
||||
HAIKU_DEFINES_$(architecture)
|
||||
+= BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ;
|
||||
# TODO: That doesn't need to be a general define. It's just needed for
|
||||
# compiling (part of) the boot loader.
|
||||
|
||||
# kernel add-on glue code
|
||||
HAIKU_KERNEL_ADDON_BEGIN_GLUE_CODE = <$(architecture)>crtbeginS.o
|
||||
<src!system!glue!$(architecture)>haiku_version_glue.o ;
|
||||
|
||||
+12
-10
@@ -76,9 +76,9 @@ rule SetupBoot
|
||||
SourceSysHdrs $(sources) : $(TARGET_PRIVATE_KERNEL_HEADERS) ;
|
||||
}
|
||||
|
||||
if $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_PACKAGING_ARCH)) {
|
||||
if $(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_KERNEL_ARCH)) {
|
||||
SourceSysHdrs $(sources) :
|
||||
$(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_PACKAGING_ARCH)) ;
|
||||
$(HAIKU_BOOT_C++_HEADERS_DIR_$(TARGET_KERNEL_ARCH)) ;
|
||||
}
|
||||
|
||||
# MultiBootSubDirSetup sets the target boot platform on the target object,
|
||||
@@ -90,6 +90,8 @@ rule SetupBoot
|
||||
local platform = $(TARGET_BOOT_PLATFORM:U) ;
|
||||
local object ;
|
||||
for object in $(objects) {
|
||||
TARGET_PACKAGING_ARCH on $(object) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
# add boot flags for the object
|
||||
ObjectCcFlags $(object) : $(HAIKU_BOOT_CCFLAGS) $(HAIKU_BOOT_$(platform)_CCFLAGS) $(2) ;
|
||||
ObjectC++Flags $(object) : $(HAIKU_BOOT_C++FLAGS) $(HAIKU_BOOT_$(platform)_C++FLAGS) $(2) ;
|
||||
@@ -97,13 +99,13 @@ rule SetupBoot
|
||||
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) = ;
|
||||
TARGET_CCFLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
||||
TARGET_C++FLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
||||
|
||||
# override warning flags
|
||||
TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
|
||||
TARGET_WARNING_CCFLAGS_$(TARGET_KERNEL_ARCH) on $(object)
|
||||
= $(TARGET_KERNEL_WARNING_CCFLAGS) ;
|
||||
TARGET_WARNING_C++FLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
|
||||
TARGET_WARNING_C++FLAGS_$(TARGET_KERNEL_ARCH) on $(object)
|
||||
= $(TARGET_KERNEL_WARNING_C++FLAGS) ;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +120,7 @@ rule BootLd
|
||||
{
|
||||
# BootLd <name> : <objs> : <linkerscript> : <args> ;
|
||||
|
||||
LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
|
||||
LINK on $(1) = $(TARGET_LD_$(TARGET_KERNEL_ARCH)) ;
|
||||
|
||||
LINKFLAGS on $(1) = $(HAIKU_BOOT_$(TARGET_BOOT_PLATFORM:U)_LDFLAGS) $(4) ;
|
||||
if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
|
||||
@@ -130,8 +132,8 @@ rule BootLd
|
||||
libs += [ TargetBootLibsupc++ true ] ;
|
||||
Depends $(1) : [ TargetBootLibsupc++ ] ;
|
||||
}
|
||||
LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc true ] ;
|
||||
Depends $(1) : [ TargetBootLibgcc ] ;
|
||||
LINKLIBS on $(1) = $(libs) [ TargetBootLibgcc $(TARGET_KERNEL_ARCH) : true ] ;
|
||||
Depends $(1) : [ TargetBootLibgcc $(TARGET_KERNEL_ARCH) ] ;
|
||||
|
||||
# TODO: Do we really want to invoke SetupBoot here? The objects should
|
||||
# have been compiled with BootObjects anyway, so we're doing that twice.
|
||||
@@ -205,7 +207,7 @@ actions BootStaticLibraryObjects
|
||||
# Force recreation of the archive to avoid build errors caused by
|
||||
# stale dependencies after renaming or deleting object files.
|
||||
$(RM) "$(1)"
|
||||
$(HAIKU_AR_$(TARGET_PACKAGING_ARCH)) -r "$(1)" "$(2)" ;
|
||||
$(HAIKU_AR_$(TARGET_KERNEL_ARCH)) -r "$(1)" "$(2)" ;
|
||||
}
|
||||
|
||||
rule BuildMBR binary : source
|
||||
|
||||
@@ -5,6 +5,11 @@ rule FQualifiedBuildFeatureName features
|
||||
# Prepends the name of the current target packaging architecture to the
|
||||
# given feature names.
|
||||
|
||||
if $(features[1]) = "QUALIFIED" {
|
||||
# We have been pre-supplied a qualified name.
|
||||
return $(features[2]) ;
|
||||
}
|
||||
|
||||
return $(TARGET_PACKAGING_ARCH):$(features) ;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,12 @@ for architecture in $(HAIKU_PACKAGING_ARCHS) {
|
||||
}
|
||||
|
||||
if $(HAIKU_PACKAGING_ARCH) {
|
||||
KernelArchitectureSetup $(HAIKU_PACKAGING_ARCH) ;
|
||||
local kernelArch = $(HAIKU_PACKAGING_ARCH) ;
|
||||
# Always use the non-legacy GCC for the kernel.
|
||||
if $(kernelArch) = x86_gcc2 {
|
||||
kernelArch = x86 ;
|
||||
}
|
||||
KernelArchitectureSetup $(kernelArch) ;
|
||||
}
|
||||
|
||||
# define primary packaging architecture macro
|
||||
|
||||
+15
-5
@@ -16,14 +16,16 @@ rule SetupKernel
|
||||
|
||||
local object ;
|
||||
for object in $(objects) {
|
||||
TARGET_PACKAGING_ARCH on $(object) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
# add kernel flags for the object
|
||||
ObjectCcFlags $(object) : $(TARGET_KERNEL_CCFLAGS) $(2) ;
|
||||
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) = ;
|
||||
TARGET_CCFLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
||||
TARGET_C++FLAGS_$(TARGET_KERNEL_ARCH) on $(object) = ;
|
||||
|
||||
# override warning flags
|
||||
TARGET_WARNING_CCFLAGS_$(TARGET_PACKAGING_ARCH) on $(object)
|
||||
@@ -43,7 +45,7 @@ rule KernelLd
|
||||
{
|
||||
# KernelLd <name> : <objs> : <linkerscript> : <args> ;
|
||||
|
||||
LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
|
||||
LINK on $(1) = $(TARGET_LD_$(HAIKU_KERNEL_ARCH)) ;
|
||||
|
||||
LINKFLAGS on $(1) = $(4) ;
|
||||
if $(3) {
|
||||
@@ -103,7 +105,7 @@ actions KernelSo1
|
||||
export $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR)
|
||||
|
||||
$(2[1]) --data $(2[2]) $(1) &&
|
||||
$(HAIKU_ELFEDIT_$(TARGET_PACKAGING_ARCH)) --output-type dyn $(1)
|
||||
$(HAIKU_ELFEDIT_$(HAIKU_KERNEL_ARCH)) --output-type dyn $(1)
|
||||
}
|
||||
|
||||
rule KernelAddon
|
||||
@@ -115,6 +117,8 @@ rule KernelAddon
|
||||
local libs = $(3) ;
|
||||
AddResources $(1) : $(4) ;
|
||||
|
||||
TARGET_PACKAGING_ARCH on $(target) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
local kernel ;
|
||||
local beginGlue ;
|
||||
local endGlue ;
|
||||
@@ -164,6 +168,8 @@ rule KernelMergeObject
|
||||
# will be added.
|
||||
#
|
||||
|
||||
TARGET_PACKAGING_ARCH on $(1) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
SetupKernel $(2) : $(3) ;
|
||||
Objects $(2) ;
|
||||
MergeObjectFromObjects $(1) : $(2:S=$(SUFOBJ)) : $(4) ;
|
||||
@@ -175,6 +181,8 @@ rule KernelStaticLibrary
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a static library.
|
||||
|
||||
TARGET_PACKAGING_ARCH on $(1) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
SetupKernel $(2) : $(3) : false ;
|
||||
Library $(1) : $(2) ;
|
||||
}
|
||||
@@ -185,6 +193,8 @@ rule KernelStaticLibraryObjects
|
||||
# This is designed to take a set of sources and libraries and create
|
||||
# a file called <name>
|
||||
|
||||
TARGET_PACKAGING_ARCH on $(1) = $(TARGET_KERNEL_ARCH) ;
|
||||
|
||||
# Show that we depend on the libraries we need
|
||||
SetupKernel $(2) ;
|
||||
LocalClean clean : $(1) ;
|
||||
@@ -199,5 +209,5 @@ actions KernelStaticLibraryObjects
|
||||
# Force recreation of the archive to avoid build errors caused by
|
||||
# stale dependencies after renaming or deleting object files.
|
||||
$(RM) "$(1)"
|
||||
$(HAIKU_AR_$(TARGET_PACKAGING_ARCH)) -r "$(1)" "$(2)" ;
|
||||
$(HAIKU_AR_$(HAIKU_KERNEL_ARCH)) -r "$(1)" "$(2)" ;
|
||||
}
|
||||
|
||||
@@ -258,15 +258,17 @@ actions Ld
|
||||
$(LINK) $(LINKFLAGS) -o "$(1)" "$(2)" "$(NEEDLIBS)" $(LINKLIBS)
|
||||
}
|
||||
|
||||
rule CreateAsmStructOffsetsHeader header : source
|
||||
rule CreateAsmStructOffsetsHeader header : source : architecture
|
||||
{
|
||||
# CreateAsmStructOffsetsHeader header : source
|
||||
# CreateAsmStructOffsetsHeader header : source : architecture
|
||||
#
|
||||
# Grist will be added to both header and source.
|
||||
|
||||
header = [ FGristFiles $(header) ] ;
|
||||
source = [ FGristFiles $(source) ] ;
|
||||
|
||||
TARGET_PACKAGING_ARCH on $(header) = $(architecture) ;
|
||||
|
||||
# find out which headers, defines, etc. to use
|
||||
local headers ;
|
||||
local sysHeaders ;
|
||||
@@ -367,7 +369,8 @@ rule CreateAsmStructOffsetsHeader header : source
|
||||
|
||||
Depends $(header) : $(source) $(PLATFORM) ;
|
||||
SEARCH on $(source) += $(SEARCH_SOURCE) ;
|
||||
MakeLocateArch $(header) ;
|
||||
MakeLocate $(header) : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(architecture))
|
||||
system kernel ] ;
|
||||
LocalClean clean : $(header) ;
|
||||
|
||||
HDRRULE on $(source) = HdrRule ;
|
||||
|
||||
@@ -6,12 +6,13 @@ rule Link
|
||||
{
|
||||
# Note: RESFILES must be set before invocation.
|
||||
|
||||
local architecture = [ on $(1) return $(TARGET_PACKAGING_ARCH) ] ;
|
||||
if [ on $(1) return $(PLATFORM) ] = host {
|
||||
LINK on $(1) = $(HOST_LINK) ;
|
||||
LINKFLAGS on $(1) = $(HOST_LINKFLAGS) [ on $(1) return $(LINKFLAGS) ] ;
|
||||
} else {
|
||||
LINK on $(1) = $(TARGET_LINK_$(TARGET_PACKAGING_ARCH)) ;
|
||||
LINKFLAGS on $(1) = $(TARGET_LINKFLAGS_$(TARGET_PACKAGING_ARCH))
|
||||
LINK on $(1) = $(TARGET_LINK_$(architecture)) ;
|
||||
LINKFLAGS on $(1) = $(TARGET_LINKFLAGS_$(architecture))
|
||||
[ on $(1) return $(LINKFLAGS) ] ;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ rule TargetKernelLibsupc++ asPath
|
||||
flags += path ;
|
||||
}
|
||||
return [
|
||||
BuildFeatureAttribute gcc_syslibs_devel
|
||||
BuildFeatureAttribute QUALIFIED $(TARGET_KERNEL_ARCH):gcc_syslibs_devel
|
||||
: libsupc++-kernel.a : $(flags)
|
||||
] ;
|
||||
} else {
|
||||
@@ -215,7 +215,7 @@ rule TargetKernelLibgcc asPath
|
||||
flags += path ;
|
||||
}
|
||||
return [
|
||||
BuildFeatureAttribute gcc_syslibs_devel
|
||||
BuildFeatureAttribute QUALIFIED $(TARGET_KERNEL_ARCH):gcc_syslibs_devel
|
||||
: libgcc-kernel.a : $(flags)
|
||||
] ;
|
||||
} else {
|
||||
@@ -224,15 +224,15 @@ rule TargetKernelLibgcc asPath
|
||||
}
|
||||
|
||||
|
||||
rule TargetBootLibgcc asPath
|
||||
rule TargetBootLibgcc architecture : asPath
|
||||
{
|
||||
# TargetBootLibgcc [ <asPath> ]
|
||||
# TargetBootLibgcc [ architecture ] : [ <asPath> ]
|
||||
#
|
||||
# Returns the static bootloader libgcc for the target.
|
||||
# Invoking with <asPath> = true will return the full library path.
|
||||
|
||||
if $(TARGET_PLATFORM) = haiku {
|
||||
if $(TARGET_PACKAGING_ARCH) = x86_64 {
|
||||
if $(architecture) = x86_64 {
|
||||
# we need to use the 32-bit libgcc.a built by the cross-compiler
|
||||
return $(TARGET_BOOT_LIBGCC) ;
|
||||
|
||||
@@ -247,7 +247,7 @@ rule TargetBootLibgcc asPath
|
||||
flags += path ;
|
||||
}
|
||||
return [
|
||||
BuildFeatureAttribute gcc_syslibs_devel
|
||||
BuildFeatureAttribute QUALIFIED $(architecture):gcc_syslibs_devel
|
||||
: libgcc-kernel.a : $(flags)
|
||||
] ;
|
||||
} else {
|
||||
@@ -292,7 +292,7 @@ rule TargetKernelLibgcceh asPath
|
||||
flags += path ;
|
||||
}
|
||||
return [
|
||||
BuildFeatureAttribute gcc_syslibs_devel
|
||||
BuildFeatureAttribute QUALIFIED $(TARGET_KERNEL_ARCH):gcc_syslibs_devel
|
||||
: libgcc_eh-kernel.a : $(flags)
|
||||
] ;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user