From 9050d1ee4893453233a9ba3135885ae133860400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 10 Aug 2004 12:46:19 +0000 Subject: [PATCH] Changed the way the kernel libroot objects are built; we are no longer reusing the standard libroot objects, but build them all again to make sure they are compiled with the proper flags (i.e. -fno-pic). That saves a lot of headaches: as a side effect, the kernel runs fine again, and even the node monitor test works nicely now. Go figure. Only the string functions remain separate, but that should be changed as well one day (it's not problematic, right now). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8545 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/Jamfile | 176 ++++++++---------------- src/kernel/libroot/Jamfile | 64 ++++++++- src/kernel/libroot/posix/Jamfile | 14 +- src/kernel/libroot/posix/locale/Jamfile | 7 +- src/kernel/libroot/posix/stdio/Jamfile | 10 +- src/kernel/libroot/posix/stdlib/Jamfile | 18 +-- src/kernel/libroot/posix/sys/Jamfile | 11 +- src/kernel/libroot/posix/time/Jamfile | 7 +- src/kernel/libroot/posix/unistd/Jamfile | 25 +--- 9 files changed, 127 insertions(+), 205 deletions(-) diff --git a/src/kernel/Jamfile b/src/kernel/Jamfile index 94459ddd6b..0d3b94d3b9 100644 --- a/src/kernel/Jamfile +++ b/src/kernel/Jamfile @@ -11,8 +11,8 @@ KernelLd boot_loader : # libroot functions needed by the stage2 boot loader <$(SOURCE_GRIST)!libroot!os!arch!$(OBOS_ARCH)>byteorder.o - <$(SOURCE_GRIST)!libroot!posix!locale>ctype.o - <$(SOURCE_GRIST)!libroot!posix!stdio>kernel_vsprintf.o + <$(SOURCE_GRIST)!libroot>ctype.o + <$(SOURCE_GRIST)!libroot>kernel_vsprintf.o <$(SOURCE_GRIST)!libroot!posix!string>memset.o <$(SOURCE_GRIST)!libroot!posix!string>memcmp.o <$(SOURCE_GRIST)!libroot!posix!string>memcpy.o @@ -27,7 +27,7 @@ KernelLd boot_loader : <$(SOURCE_GRIST)!libroot!posix!string>strlcpy.o <$(SOURCE_GRIST)!libroot!posix!string>strchr.o <$(SOURCE_GRIST)!libroot!posix!string>strrchr.o - <$(SOURCE_GRIST)!libroot!posix!stdlib>qsort.o + <$(SOURCE_GRIST)!libroot>qsort.o : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/boot_loader.ld : -Bstatic ; @@ -36,18 +36,15 @@ KernelLd stage2 : boot_arch_stage2.o # posix functions needed by the stage2 boot loader - <$(SOURCE_GRIST)!libroot!posix!locale>ctype.o - <$(SOURCE_GRIST)!libroot!posix!stdio>kernel_vsprintf.o + <$(SOURCE_GRIST)!libroot>ctype.o + <$(SOURCE_GRIST)!libroot>kernel_vsprintf.o <$(SOURCE_GRIST)!libroot!posix!string>memset.o <$(SOURCE_GRIST)!libroot!posix!string>memcpy.o <$(SOURCE_GRIST)!libroot!posix!string>strnlen.o + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/stage2.ld + : -dN : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/stage2.ld - : - -dN - : - : - bootstrap + : bootstrap ; KernelLd kernel : @@ -67,22 +64,13 @@ KernelLd kernel : # kernel libroot parts kernel_os_main.o kernel_os_arch_$(OBOS_ARCH).o - - kernel_posix_locale.o - kernel_posix_main.o - kernel_posix_stdio.o - kernel_posix_stdlib.o - kernel_posix_sys.o - kernel_posix_time.o - kernel_posix_unistd.o + kernel_posix.o posix_string.o + + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/kernel.ld + : -Bdynamic -export-dynamic -dynamic-linker /foo/bar : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/kernel.ld - : - -Bdynamic -export-dynamic -dynamic-linker /foo/bar - : - : - kernel + : kernel ; KernelLd kernel.so : @@ -104,29 +92,19 @@ KernelLd kernel.so : # kernel libroot parts kernel_os_main.o kernel_os_arch_$(OBOS_ARCH).o - - kernel_posix_locale.o - kernel_posix_main.o - kernel_posix_stdio.o - kernel_posix_stdlib.o - kernel_posix_sys.o - kernel_posix_time.o - kernel_posix_unistd.o + kernel_posix.o posix_string.o - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/kernel.ld - : - -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar + + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/kernel.ld + : -Bdynamic -shared -export-dynamic -dynamic-linker /foo/bar ; KernelLd libglue.o : # libglue.o is used for dynamic libraries <$(SOURCE_GRIST)!glue>crt0.o <$(SOURCE_GRIST)!glue>init_term_dyn.o : - : - -r - : - no_gcc + : -r + : no_gcc ; UnarchiveObjects $(LIBGCC_OBJECTS) : $(LIBGCC_DIR)/libgcc.a ; @@ -169,22 +147,18 @@ KernelLd libglue2.o : # libglue2.o is used for executables <$(SOURCE_GRIST)!glue>init_term_dyn.o <$(SOURCE_GRIST)!glue>start_dyn.o : - : - -r - : - no_gcc + : -r + : no_gcc ; KernelLd init : libglue2.o <$(SOURCE_GRIST)!apps>init.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/init + : beos/bin/init ; KernelStaticLibraryObjects librld.a : @@ -196,7 +170,7 @@ KernelStaticLibraryObjects librld.a : <$(SOURCE_GRIST)!libroot!posix>errno.o <$(SOURCE_GRIST)!libroot!posix!locale>ctype.o - <$(SOURCE_GRIST)!libroot!posix!stdio>kernel_vsprintf.o + <$(SOURCE_GRIST)!libroot>kernel_vsprintf.o <$(SOURCE_GRIST)!libroot!posix!unistd>open.o <$(SOURCE_GRIST)!libroot!posix!string>memchr.o @@ -236,84 +210,70 @@ KernelLd rld.so : <$(SOURCE_GRIST)!apps!rld>rldheap.o <$(SOURCE_GRIST)!apps!rld>rldaux.o librld.a - : - $(SUBDIR)/apps/rld/arch/$(OBOS_ARCH)/rld.ld + : $(SUBDIR)/apps/rld/arch/$(OBOS_ARCH)/rld.ld : : - : - beos/system/lib/rld.so + : beos/system/lib/rld.so ; KernelLd false : libglue2.o <$(SOURCE_GRIST)!apps>false_main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/false + : beos/bin/false ; KernelLd true : libglue2.o <$(SOURCE_GRIST)!apps>true_main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/true + : beos/bin/true ; KernelLd fibo : libglue2.o <$(SOURCE_GRIST)!apps>fibo_main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/fibo + : beos/bin/fibo ; KernelLd sig_test : libglue2.o <$(SOURCE_GRIST)!apps>sig_test.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/sig_test + : beos/bin/sig_test ; KernelLd monitor_test : libglue2.o <$(SOURCE_GRIST)!apps>monitor_test.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/monitor_test + : beos/bin/monitor_test ; KernelLd fortune : libglue2.o <$(SOURCE_GRIST)!apps!fortune>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/fortune + : beos/bin/fortune ; KernelConfigSection beos/etc/fortunes : data : $(SUBDIR)/apps/fortune/fortunes ; @@ -322,24 +282,20 @@ KernelLd kernel_ls : libglue2.o <$(SOURCE_GRIST)!apps!ls>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/ls + : beos/bin/ls ; KernelLd symlink : libglue2.o <$(SOURCE_GRIST)!apps!symlink>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/symlink + : beos/bin/symlink ; # Note: shell is a built in target, thus we need the grist. @@ -355,60 +311,50 @@ KernelLd obos_shell : <$(SOURCE_GRIST)!apps!shell>statements.o <$(SOURCE_GRIST)!apps!shell>shell_history.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/shell + : beos/bin/shell ; KernelLd testapp : libglue2.o <$(SOURCE_GRIST)!apps!testapp>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/testapp + : beos/bin/testapp ; KernelLd tls_test : libglue2.o <$(SOURCE_GRIST)!apps>tls_test.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/tls_test + : beos/bin/tls_test ; KernelLd pipe_test : libglue2.o <$(SOURCE_GRIST)!apps>pipe_test.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/pipe_test + : beos/bin/pipe_test ; KernelLd envtest : libglue2.o <$(SOURCE_GRIST)!apps!envtest>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/envtest + : beos/bin/envtest ; #if $(OS) = "BEOS" @@ -432,36 +378,30 @@ KernelLd ps : libglue2.o <$(SOURCE_GRIST)!apps!ps>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/ps + : beos/bin/ps ; KernelLd echo : libglue2.o <$(SOURCE_GRIST)!apps!echo>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/echo + : beos/bin/echo ; KernelLd uname : libglue2.o <$(SOURCE_GRIST)!apps!uname>main.o libroot.so - : - $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld + : $(SUBDIR)/ldscripts/$(OBOS_ARCH)/app.ld : : - : - beos/bin/uname + : beos/bin/uname ; WriteKernelConfig $(OBOS_KERNEL_CONFIG) ; diff --git a/src/kernel/libroot/Jamfile b/src/kernel/libroot/Jamfile index c774735e4d..f1fbe3c675 100755 --- a/src/kernel/libroot/Jamfile +++ b/src/kernel/libroot/Jamfile @@ -2,8 +2,68 @@ SubDir OBOS_TOP src kernel libroot ; KernelObjects <$(SOURCE_GRIST)>libroot_init.c - : - -fPIC -DPIC + : -fPIC -DPIC + ; + +# kernel libroot posix files + +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix locale ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix stdio ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix stdlib ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix sys ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix time ] ; +SEARCH_SOURCE += [ FDirName $(SUBDIR) posix unistd ] ; + +KernelMergeObject kernel_posix.o : + # main + <$(SOURCE_GRIST)>kerrno.c + <$(SOURCE_GRIST)>poll.c + <$(SOURCE_GRIST)>utime.c + # locale + <$(SOURCE_GRIST)>ctype.c + # stdio + <$(SOURCE_GRIST)>kernel_vsprintf.c + # stdlib + <$(SOURCE_GRIST)>abs.c + <$(SOURCE_GRIST)>atoi.c + <$(SOURCE_GRIST)>bsearch.c + <$(SOURCE_GRIST)>merge.c + <$(SOURCE_GRIST)>qsort.c + <$(SOURCE_GRIST)>rand.c + <$(SOURCE_GRIST)>random.c + <$(SOURCE_GRIST)>strtol.c + <$(SOURCE_GRIST)>strtoll.c + <$(SOURCE_GRIST)>strtoul.c + <$(SOURCE_GRIST)>strtoull.c + # sys + <$(SOURCE_GRIST)>chmod.c + <$(SOURCE_GRIST)>stat.c + <$(SOURCE_GRIST)>mkdir.c + <$(SOURCE_GRIST)>select.c + <$(SOURCE_GRIST)>gettimeofday.c + # time + <$(SOURCE_GRIST)>time.c + # unistd + <$(SOURCE_GRIST)>access.c + <$(SOURCE_GRIST)>chown.c + <$(SOURCE_GRIST)>close.c + <$(SOURCE_GRIST)>conf.c + <$(SOURCE_GRIST)>directory.c + <$(SOURCE_GRIST)>dup.c + <$(SOURCE_GRIST)>fcntl.c + <$(SOURCE_GRIST)>hostname.c + <$(SOURCE_GRIST)>ioctl.c + <$(SOURCE_GRIST)>link.c + <$(SOURCE_GRIST)>lseek.c + <$(SOURCE_GRIST)>mount.c + <$(SOURCE_GRIST)>open.c + <$(SOURCE_GRIST)>read.c + <$(SOURCE_GRIST)>truncate.c + <$(SOURCE_GRIST)>usergroup.c + <$(SOURCE_GRIST)>write.c + + : -fno-pic ; SubInclude OBOS_TOP src kernel libroot os ; diff --git a/src/kernel/libroot/posix/Jamfile b/src/kernel/libroot/posix/Jamfile index 09a3dca0cf..aa48c8ee9a 100644 --- a/src/kernel/libroot/posix/Jamfile +++ b/src/kernel/libroot/posix/Jamfile @@ -13,19 +13,7 @@ KernelMergeObject posix_main.o : <$(SOURCE_GRIST)>rlimit.c <$(SOURCE_GRIST)>syslog.cpp <$(SOURCE_GRIST)>utime.c - : - -fPIC -DPIC - ; - -# extra kernel objects needed -KernelObjects - <$(SOURCE_GRIST)>kerrno.c - ; - -MergeObjectFromObjects kernel_posix_main.o : - <$(SOURCE_GRIST)>kerrno.o - <$(SOURCE_GRIST)>poll.o - <$(SOURCE_GRIST)>utime.o + : -fPIC -DPIC ; SubInclude OBOS_TOP src kernel libroot posix locale ; diff --git a/src/kernel/libroot/posix/locale/Jamfile b/src/kernel/libroot/posix/locale/Jamfile index 94e70da176..3944676954 100644 --- a/src/kernel/libroot/posix/locale/Jamfile +++ b/src/kernel/libroot/posix/locale/Jamfile @@ -3,10 +3,5 @@ SubDir OBOS_TOP src kernel libroot posix locale ; KernelMergeObject posix_locale.o : <$(SOURCE_GRIST)>ctype.c <$(SOURCE_GRIST)>localeconv.c - : - -fPIC -DPIC - ; - -MergeObjectFromObjects kernel_posix_locale.o : - <$(SOURCE_GRIST)>ctype.o + : -fPIC -DPIC ; diff --git a/src/kernel/libroot/posix/stdio/Jamfile b/src/kernel/libroot/posix/stdio/Jamfile index a6237dcce8..ed4022c9c7 100644 --- a/src/kernel/libroot/posix/stdio/Jamfile +++ b/src/kernel/libroot/posix/stdio/Jamfile @@ -48,13 +48,5 @@ KernelMergeObject posix_stdio.o : # <$(SOURCE_GRIST)>vsprintf.c # <$(SOURCE_GRIST)>wbuf.c # <$(SOURCE_GRIST)>wsetup.c - : - -fPIC -DPIC + : -fPIC -DPIC ; - -KernelMergeObject kernel_posix_stdio.o : - <$(SOURCE_GRIST)>kernel_vsprintf.c - : - -fPIC -DPIC - ; - diff --git a/src/kernel/libroot/posix/stdlib/Jamfile b/src/kernel/libroot/posix/stdlib/Jamfile index 662f12b9cf..2b843c6063 100644 --- a/src/kernel/libroot/posix/stdlib/Jamfile +++ b/src/kernel/libroot/posix/stdlib/Jamfile @@ -21,21 +21,5 @@ KernelMergeObject posix_stdlib.o : <$(SOURCE_GRIST)>strtoll.c <$(SOURCE_GRIST)>strtoul.c <$(SOURCE_GRIST)>strtoull.c - : - -fPIC -DPIC + : -fPIC -DPIC ; - -MergeObjectFromObjects kernel_posix_stdlib.o : - <$(SOURCE_GRIST)>abs.o - <$(SOURCE_GRIST)>atoi.o - <$(SOURCE_GRIST)>bsearch.o - <$(SOURCE_GRIST)>merge.o - <$(SOURCE_GRIST)>qsort.o - <$(SOURCE_GRIST)>rand.o - <$(SOURCE_GRIST)>random.o - <$(SOURCE_GRIST)>strtol.o - <$(SOURCE_GRIST)>strtoll.o - <$(SOURCE_GRIST)>strtoul.o - <$(SOURCE_GRIST)>strtoull.o - ; - diff --git a/src/kernel/libroot/posix/sys/Jamfile b/src/kernel/libroot/posix/sys/Jamfile index 65d7e4882f..a33d5272ec 100644 --- a/src/kernel/libroot/posix/sys/Jamfile +++ b/src/kernel/libroot/posix/sys/Jamfile @@ -8,14 +8,5 @@ KernelMergeObject posix_sys.o : <$(SOURCE_GRIST)>sysctl.c <$(SOURCE_GRIST)>gettimeofday.c <$(SOURCE_GRIST)>wait.c - : - -fPIC -DPIC - ; - -MergeObjectFromObjects kernel_posix_sys.o : - <$(SOURCE_GRIST)>chmod.o - <$(SOURCE_GRIST)>stat.o - <$(SOURCE_GRIST)>mkdir.o - <$(SOURCE_GRIST)>select.o - <$(SOURCE_GRIST)>gettimeofday.o + : -fPIC -DPIC ; diff --git a/src/kernel/libroot/posix/time/Jamfile b/src/kernel/libroot/posix/time/Jamfile index 9277bf358b..97c93e870e 100644 --- a/src/kernel/libroot/posix/time/Jamfile +++ b/src/kernel/libroot/posix/time/Jamfile @@ -8,10 +8,5 @@ KernelMergeObject posix_time.o : <$(SOURCE_GRIST)>mktime.c <$(SOURCE_GRIST)>strftime.cpp <$(SOURCE_GRIST)>time.c - : - -fPIC -DPIC - ; - -MergeObjectFromObjects kernel_posix_time.o : - <$(SOURCE_GRIST)>time.o + : -fPIC -DPIC ; diff --git a/src/kernel/libroot/posix/unistd/Jamfile b/src/kernel/libroot/posix/unistd/Jamfile index fe482500ea..9929dec2c2 100644 --- a/src/kernel/libroot/posix/unistd/Jamfile +++ b/src/kernel/libroot/posix/unistd/Jamfile @@ -29,28 +29,5 @@ KernelMergeObject posix_unistd.o : <$(SOURCE_GRIST)>usergroup.c <$(SOURCE_GRIST)>usleep.c <$(SOURCE_GRIST)>write.c - : - -fPIC -DPIC - ; - -MergeObjectFromObjects kernel_posix_unistd.o : - <$(SOURCE_GRIST)>access.o - <$(SOURCE_GRIST)>chown.o - <$(SOURCE_GRIST)>close.o - <$(SOURCE_GRIST)>conf.o - <$(SOURCE_GRIST)>directory.o - <$(SOURCE_GRIST)>dup.o - <$(SOURCE_GRIST)>fcntl.o - <$(SOURCE_GRIST)>hostname.o - <$(SOURCE_GRIST)>ioctl.o - <$(SOURCE_GRIST)>link.o - <$(SOURCE_GRIST)>lseek.o - <$(SOURCE_GRIST)>mount.o - <$(SOURCE_GRIST)>open.o - <$(SOURCE_GRIST)>read.o -# <$(SOURCE_GRIST)>sleep.o - <$(SOURCE_GRIST)>truncate.o - <$(SOURCE_GRIST)>usergroup.o -# <$(SOURCE_GRIST)>usleep.o - <$(SOURCE_GRIST)>write.o + : -fPIC -DPIC ;