From 38156af0a450aced8a15bcc783484da96cd00be0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 16 Jun 2011 22:28:39 +0200 Subject: [PATCH 1/7] Added .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..f853046791 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +generated* +build/jam/UserBuildConfig + From 6d367d369ea4063461dd31565f21a4f3cb6e7ca3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 20 Jun 2011 02:01:36 +0200 Subject: [PATCH 2/7] Ignore build/user_config_headers --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f853046791..0770a5253b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ generated* build/jam/UserBuildConfig +build/user_config_headers From 1c2d7d3a86c79828aff76b35b2dd4085c72bfb2f Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 16 Jun 2011 19:58:24 +0200 Subject: [PATCH 3/7] Fixed x86_64 handling by the build system. * Map build variables HOST_CPU and HOST_ARCH to x86_64, if it they are * x86 and 64 bit and define the __x86_64__ C macro instead of __INTEL__ in that case. * : Also handle __x86_64__. --- build/jam/BuildSetup | 11 +++++++++-- headers/os/kernel/OS.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 34dfcb947d..87092982cf 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -599,6 +599,11 @@ if $(HOST_PLATFORM) = cygwin { HOST_CPU ?= $(OSPLAT:L) ; +# Jam doesn't know x86_64, so override HOST_CPU, if 64 bit. +if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) { + HOST_CPU = x86_64 ; +} + HOST_ARCH ?= $(HOST_CPU) ; HOST_ARCH_MACRO_DEFINE = ARCH_$(HOST_CPU) ; @@ -699,7 +704,7 @@ for level in $(HAIKU_DEBUG_LEVELS[2-]) { } # ld flags -if $(HOST_ARCH) = x86 && $(HAIKU_HOST_USE_32BIT) = 1 { +if $(HOST_ARCH) = x86_64 && $(HAIKU_HOST_USE_32BIT) = 1 { HOST_LDFLAGS += -melf_i386 ; } @@ -784,7 +789,7 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { HOST_LIBSUPC++ = gcc_s.1 stdc++ ; HOST_LIBSTDC++ = ; } else if $(HOST_PLATFORM) = freebsd { - if $(HOST_CPU) = x86 && $(HOST_PLATFORM_IS_64_BIT) = 1 { + if $(HOST_CPU) = x86_64 { # amd64 FreeBSD 8 doesn't come without a shared libsupc++, and the # static one prevents us from building shared libraries. So we have # to work around by using the shared libstdc++. @@ -806,6 +811,8 @@ if $(HOST_PLATFORM_BEOS_COMPATIBLE) { # build platform we need to make sure, this is also defined. if $(HOST_CPU) = x86 { HOST_DEFINES += __INTEL__ ; + } else if $(HOST_CPU) = x86_64 { + HOST_DEFINES += __x86_64__ ; } else if $(HOST_CPU) = ppc { HOST_DEFINES += __POWERPC__ ; } else if $(HOST_CPU) = m68k { diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index a12deed5cd..383f857e9c 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -414,6 +414,8 @@ extern void ktrace_vprintf(const char *format, va_list args); #if __INTEL__ # define B_MAX_CPU_COUNT 8 +#elif __x86_64__ +# define B_MAX_CPU_COUNT 8 #elif __POWERPC__ # define B_MAX_CPU_COUNT 8 #elif __M68K__ From cd3e09313359bff5c6752a322818f73991a5b5e0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 16 Jun 2011 22:53:44 +0200 Subject: [PATCH 4/7] Fix x86_64 BuildConfig issues * Resolve TODO: HOST_GCC_BASE_FLAGS should not be included in HOST_LDFLAGS. Enable adding "-fno-strict-aliasing -fno-tree-vrp" accordingly. * Fix handling of HOST_PLATFORM_IS_64_BIT and HAIKU_HOST_USE_32BIT: The former does now state whether the platform is effectively treated as 64 bit platform, i.e. it actually is 64 bit and the 32 bit mode is not enforced. HAIKU_HOST_USE_32BIT is now only set when the platform is actually 64 bit, but 32 bit mode is enforced. --- build/jam/BuildSetup | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 87092982cf..3c4b6c801c 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -136,13 +136,10 @@ if $(HAIKU_USE_GCC_PIPE) = 1 { if $(HAIKU_GCC_VERSION[1]) >= 3 { HAIKU_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; } -# TODO: With Haiku as the host platform, this does not appear to be set up -# correctly, at least when compiling the libbe_test target platform. When -# enabling the lines below, these flags suddenly appear as link flags passed -# to ld as well. -#if $(HOST_GCC_VERSION[1]) >= 3 { -# HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; -#} + +if $(HOST_GCC_VERSION[1]) >= 3 { + HOST_GCC_BASE_FLAGS += -fno-strict-aliasing -fno-tree-vrp ; +} # override gcc 2.95.3's header directory -- strictly necessary only when using # the BeOS native compiler (since its headers are incompatible), but it doesn't @@ -545,14 +542,26 @@ HAIKU_BUILD_DESCRIPTION ?= "Unknown Build" ; # analyze the host gcc machine spec to find out about 64-bitness HOST_PLATFORM_IS_64_BIT = ; +switch $(HOST_GCC_MACHINE) { + case amd64-* : HOST_PLATFORM_IS_64_BIT = 1 ; + case i686-apple-darwin10 : HOST_PLATFORM_IS_64_BIT = 1 ; + case x86_64-* : HOST_PLATFORM_IS_64_BIT = 1 ; +} + +# If HAIKU_HOST_USE_32BIT is set, add the required gcc base flag (the LD flag +# is set later), or, if the architecture isn't actually 64 bit, clear +# HAIKU_HOST_USE_32BIT. +# Afterwards HOST_PLATFORM_IS_64_BIT will indicate whether the architecture is +# effectively (i.e. when using the compiler/linker flags) 64 bit and +# HAIKU_HOST_USE_32BIT will be set, iff the architecture is really 64 bit and +# 32 bit mode was requested. if $(HAIKU_HOST_USE_32BIT) = 1 { - # enable GCC -m32 option - HOST_GCC_BASE_FLAGS = -m32 ; -} else { - switch $(HOST_GCC_MACHINE) { - case amd64-* : HOST_PLATFORM_IS_64_BIT = 1 ; - case i686-apple-darwin10 : HOST_PLATFORM_IS_64_BIT = 1 ; - case x86_64-* : HOST_PLATFORM_IS_64_BIT = 1 ; + if $(HOST_PLATFORM_IS_64_BIT) { + # enable GCC -m32 option + HOST_GCC_BASE_FLAGS = -m32 ; + HOST_PLATFORM_IS_64_BIT = ; + } else { + HAIKU_HOST_USE_32BIT = 0 ; } } @@ -566,7 +575,7 @@ HOST_RANLIB ?= $(RANLIB) ; HOST_CPPFLAGS ?= $(CPPFLAGS) ; HOST_CCFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(CCFLAGS) ; HOST_C++FLAGS ?= $(HOST_GCC_BASE_FLAGS) $(C++FLAGS) ; -HOST_LDFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LDFLAGS) ; +HOST_LDFLAGS ?= $(LDFLAGS) ; HOST_LINKFLAGS ?= $(HOST_GCC_BASE_FLAGS) $(LINKFLAGS) ; HOST_DEFINES ?= $(DEFINES) ; HOST_HDRS ?= $(HDRS) ; @@ -704,7 +713,7 @@ for level in $(HAIKU_DEBUG_LEVELS[2-]) { } # ld flags -if $(HOST_ARCH) = x86_64 && $(HAIKU_HOST_USE_32BIT) = 1 { +if $(HAIKU_HOST_USE_32BIT) = 1 { HOST_LDFLAGS += -melf_i386 ; } From e89f127b9eeccb4d1fc468e57a6e1cda2ab636ad Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 19 Jun 2011 13:43:24 +0200 Subject: [PATCH 5/7] KernelLd rule: opt-out linking against libsupc++ Introduced HAIKU_NO_LIBSUPC++ variable on target to prevent linking against libsupc++. --- build/jam/KernelRules | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/jam/KernelRules b/build/jam/KernelRules index f0dba32319..25b2260bf1 100644 --- a/build/jam/KernelRules +++ b/build/jam/KernelRules @@ -44,8 +44,13 @@ rule KernelLd LINKFLAGS on $(1) = $(4) ; if $(3) { LINKFLAGS on $(1) += --script=$(3) ; } - # Remove any preset LINKLIBS, but link against libgcc.a - LINKLIBS on $(1) = $(TARGET_STATIC_LIBSUPC++) $(TARGET_GCC_LIBGCC) ; + # Remove any preset LINKLIBS, but link against libgcc.a. Linking against + # libsupc++ is opt-out. + local libs ; + if ! [ on $(1) return HAIKU_NO_LIBSUPC++ ] { + libs += $(TARGET_STATIC_LIBSUPC++) ; + } + LINKLIBS on $(1) = $(libs) $(TARGET_GCC_LIBGCC) ; # TODO: Do we really want to invoke SetupKernel here? The objects should # have been compiled with KernelObjects anyway, so we're doing that twice. From a235c39ee40de135bc695bca257ba271b65c1e2c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Thu, 16 Jun 2011 18:56:46 +0200 Subject: [PATCH 6/7] Added BuildPlatformStaticLibraryPIC rule. It works like BuildPlatformStaticLibrary, but generates position independent code. --- build/jam/MainBuildRules | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/jam/MainBuildRules b/build/jam/MainBuildRules index 69d6597d3d..4284ae7720 100644 --- a/build/jam/MainBuildRules +++ b/build/jam/MainBuildRules @@ -724,3 +724,12 @@ rule BuildPlatformStaticLibrary lib : sources : otherObjects StaticLibrary $(lib) : $(sources) : $(otherObjects) ; } +rule BuildPlatformStaticLibraryPIC target : sources : otherObjects +{ + # Like BuildPlatformStaticLibrary, but producing position independent code. + + ObjectCcFlags $(sources) : $(HOST_PIC_CCFLAGS) ; + ObjectC++Flags $(sources) : $(HOST_PIC_C++FLAGS) ; + + BuildPlatformStaticLibrary $(target) : $(sources) : $(otherObjects) ; +} From 9e5b2c347a5b9623f4a1b56ae887da6c96bb59a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 12 Nov 2011 17:35:02 +0100 Subject: [PATCH 7/7] Fix typo. --- src/system/boot/platform/u-boot/mmu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/boot/platform/u-boot/mmu.cpp b/src/system/boot/platform/u-boot/mmu.cpp index f2a7e9bacf..27b53693b7 100644 --- a/src/system/boot/platform/u-boot/mmu.cpp +++ b/src/system/boot/platform/u-boot/mmu.cpp @@ -66,7 +66,7 @@ TODO: *defines a block in memory */ struct memblock { - const char name[16]; // the name will be used for debugging etc later perhapse... + const char name[16]; // the name will be used for debugging etc later perhaps... addr_t start; // start of the block addr_t end; // end of the block uint32 flags; // which flags should be applied (device/normal etc..)