* Introduced new build system variables

{HAIKU,HOST,TARGET}_KERNEL_PIC_{CC,LINK}FLAGS which define the
  compiler/linker flags specifying the kind of position independence
  the kernel shall have. For x86 we had and still have -fno-pic, but the
  PPC kernel has -fPIE (position independent executable) now, as we
  need to relocate it.
* The boot loader relocates the kernel now. Mostly copied the relocation
  code from the kernel ELF loader. Almost completely rewrote the PPC
  specific relocation code, though. It's more correct and more complete now
  (some things are still missing though).
* Added boot platform awareness to the kernel. Moved the generic
  Open Firmware code (openfirmware.c/h) from the boot loader to the kernel.
* The kernel PPC serial debug output is sent to the console for the time
  being.
* The PPC boot loader counts the CPUs now and allocates the kernel stacks
  (made OF device iteration a bit more flexible on the way -- the search
  can be restricted to subtree). Furthermore we really enter the kernel...
  (Yay! :-) ... and crash in the first dprintf() (in the atomic_set()
  called by acquire_spinlock()). kprintf() works, though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2005-12-30 21:20:07 +00:00
parent 456d0d082b
commit 957a1b17eb
49 changed files with 1085 additions and 63 deletions
+21
View File
@@ -122,6 +122,16 @@ if $(HAIKU_GCC_VERSION[1]) >= 3 {
HAIKU_KERNEL_C++FLAGS += -fno-use-cxa-atexit ;
}
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
HAIKU_KERNEL_PIC_LINKFLAGS = ;
if $(HAIKU_ARCH) = ppc {
# Build a position independent PPC kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HAIKU_KERNEL_PIC_CCFLAGS = -fPIE ;
HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
}
# If the environment variable DEBUG_PRINTF is defined we define an equally
# named macro to the variable value. Some components use the macro to allow
# another function than printf() to print the debug output. The variable should
@@ -322,6 +332,16 @@ HOST_KERNEL_CCFLAGS += -finline -fno-builtin
HOST_KERNEL_C++FLAGS += -finline -fno-builtin -fno-exceptions
-DBOCHS_DEBUG_HACK=$(BOCHS_DEBUG_HACK) -D_KERNEL_MODE ;
HOST_KERNEL_PIC_CCFLAGS = -fno-pic ;
HOST_KERNEL_PIC_LINKFLAGS = ;
if $(HOST_ARCH) = ppc {
# Build a position independent PPC kernel. We need to be able to relocate
# the kernel, since the virtual address space layout at boot time is not
# fixed.
HOST_KERNEL_PIC_CCFLAGS = -fPIE ;
HOST_KERNEL_PIC_LINKFLAGS = -shared -fPIE ;
}
# warning flags
HOST_WARNING_CCFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wcast-align
-Wsign-compare ;
@@ -486,6 +506,7 @@ local buildVars =
ARFLAGS UNARFLAGS
KERNEL_CCFLAGS KERNEL_C++FLAGS
KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS
WARNING_CCFLAGS WARNING_C++FLAGS
KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
+1 -1
View File
@@ -95,7 +95,7 @@ rule KernelAddon
Depends $(target) : $(beginGlue) $(endGlue) ;
# compile and link
SetupKernel $(sources) : -fno-pic ;
SetupKernel $(sources) : $(TARGET_KERNEL_PIC_FLAGS) ;
local linkFlags = -nostdlib -Xlinker -soname=\"$(target)\" ;
LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ] $(linkFlags) ;
Main $(target) : $(sources) ;