Sam Ravnborg
2006-Jul-09 21:23 UTC
[klibc] [PATCH/RFC] klibc/kbuild: use separate kbuild files for each klibc subdirectory
This fixes a long standing issue where it was not possible to do "make usr/klibc/arch/x86_64/longjmp.o" in the kernel. The principle is that all .o files to be part of klibc are listed with klib-y. For each directory a klib.list file is made that specify all .o file and the final AR then adds all .o files to create libc.a. This patch introduce the infrastructure and converts x86_64 to use it. And it breaks all other architectures... Signed-off-by: Sam Ravnborg <sam at ravnborg.org> --- This is as more a RFC than a real patch. It changes the kbuild part of klibc to understand subdirectories when building the library. My limited testing so far says that it works and it has solved a few outstanding issues. Now for example touching SYSCALLS.def does indeed cause a rebuild of klibc library _and_ all programs. But it breaks all architectures in the process - but fix should be trivial. Only that I'm too tired in my eyes to do it right away and wanted to see if this gave some feedback from the list. Luc van Oosten suggested the use of MRI scripts for ar but in the end it became simpler to just use a file that listed all .o files. Also MRI scripts was according to 'info ar' only for backward compatibility. Comments? Sam scripts/Kbuild.klibc | 67 ++++++++++++++++++++++++++++++++---- scripts/Makefile.clean | 32 ++++++++--------- usr/klibc/Kbuild | 59 +++++++++++++------------------- usr/klibc/arch/x86_64/Kbuild | 8 ++++ usr/klibc/arch/x86_64/Makefile.inc | 13 ------- usr/klibc/socketcalls/Kbuild | 6 ++- usr/klibc/syscalls/Kbuild | 6 ++- usr/klibc/zlib/Kbuild | 10 +++++ 8 files changed, 123 insertions(+), 78 deletions(-) diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index c2294dc..2d1e262 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -14,14 +14,29 @@ # shared-y := cats # # This will compile a file named cats.c -> the executable 'cats' # # The executable will be linked shared # -# If the userspace program consist of more files do the following: +# If the userspace program consist of composite files do the following: # Kbuild: # -# static-y := ipconfig -# ipconfig-y := main.o netdev.c +# static-y := kinit +# kinit-y := main.o netdev.c # So ipconfig will be linked statically using the two .o files # specified with ipconfig-y. # +# Are part of the program located in a sub-directory do like this: +# kinit-y += ipconfig/ +# +# And in the subdirectory: +# ipconfig/Kbuild: +# lib-y := packet.o dhcp_proto.o +# +##### +# For a klibc libary file do like this +# klibc/Kbuild +# klib-y := error.o pipe.o zlib/ +# +##### +# Handling of compiler/linker options +# # To set directory wide CFLAGS use: # EXTRA_KLIBCCFLAGS := -DDEBUG # To set directory wide AFLAGS use: @@ -146,10 +161,22 @@ kprog-objs := $(patsubst %/, %/lib.a, $( targets += $(static-y) $(shared-y) +##### +# klib-y handling +# .o files to build in this dir +klib-real-objs := $(patsubst %/,,$(klib-y)) +# Directories we need to visit before libs are up-to-date +klib-dirs := $(patsubst %/,%,$(filter %/, $(klib-y))) +# replace all dir/ with dir/klib.list +klib-objs := $(patsubst %/, %/klib.list, $(klib-y)) +# remove all dirs +klib-y := $(filter-out %/, $(klib-y)) + # $(output-dirs) are a list of directories that contain object files output-dirs := $(dir $(kprog-dirs) $(kprog-objs)) output-dirs += $(foreach f, $(hostprogs-y) $(targets), \ $(if $(dir $(f)), $(dir $(f)))) +output-dirs += $(klib-dirs) output-dirs := $(strip $(sort $(filter-out ./,$(output-dirs)))) # prefix so we get full dir @@ -160,9 +187,13 @@ kprog-real-objs := $(addprefix $(obj)/,$ output-dirs := $(addprefix $(obj)/,$(output-dirs)) kprog-dirs := $(addprefix $(obj)/,$(kprog-dirs)) subdir-y := $(addprefix $(obj)/,$(subdir-y)) -lib-y := $(addprefix $(obj)/,$(lib-y)) always := $(addprefix $(obj)/,$(always)) targets := $(addprefix $(obj)/,$(targets)) +lib-y := $(addprefix $(obj)/,$(lib-y)) +klib-y := $(addprefix $(obj)/,$(klib-y)) +klib-objs := $(addprefix $(obj)/,$(klib-objs)) +klib-real-objs := $(addprefix $(obj)/,$(klib-real-objs)) +klib-dirs := $(addprefix $(obj)/,$(klib-dirs)) ##### # Handle options to gcc. Support building with separate output directory @@ -194,7 +225,7 @@ lib-target := $(obj)/lib.a endif __build: $(subdir-y) $(lib-target) $(always) - @: + $(Q): # Compile C sources (.c) # --------------------------------------------------------------------------- @@ -242,6 +273,28 @@ cmd_link_o_target = $(if $(strip $(lib-y targets += $(lib-target) $(lib-y) endif # lib-target +# +# Create klib.list +# +# Do we have to create a klibc library file in this dir? +ifneq ($(strip $(klib-y) $(klib-n) $(klib-)),) +klib-target := $(obj)/klib.list +endif + +ifdef klib-target +# include this in build +__build: $(klib-target) $(klib-dirs) + +# descend if needed +$(sort $(addsuffix /klib.list,$(klib-dirs))): $(klib-dirs) ; + +# create klib.list +quiet_cmd_klib-list = LIST $@ + cmd_klib-list = echo $(klib-y) > $@ +$(klib-target): $(klib-objs) FORCE + $(call if_changed,klib-list) +targets += $(klib-target) $(klib-y) +endif # klib-target ifdef kprogs # Compile klibc-programs for the target @@ -311,8 +364,8 @@ endif # Descending # --------------------------------------------------------------------------- -.PHONY: $(subdir-y) $(kprog-dirs) -$(sort $(subdir-y) $(kprog-dirs)): +.PHONY: $(subdir-y) $(kprog-dirs) $(klib-dirs) +$(sort $(subdir-y) $(kprog-dirs) $(klib-dirs)): $(Q)$(MAKE) $(klibc)=$@ # Add FORCE to the prequisites of a target to force it to be always rebuilt. diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 8974ea5..a588749 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -19,23 +19,18 @@ include $(if $(wildcard $(kbuild-dir)/Kb # Figure out what we need to build from the various variables # ========================================================================= -__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) -subdir-y += $(__subdir-y) -__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) -subdir-m += $(__subdir-m) -__subdir-n := $(patsubst %/,%,$(filter %/, $(obj-n))) -subdir-n += $(__subdir-n) -__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) -subdir- += $(__subdir-) +subdirs := $(subdir-y) $(subdir-m) $(subdir-n) $(subdir-) +subdirs += $(patsubst %/,%,$(filter %/, $(obj-y))) +subdirs += $(patsubst %/,%,$(filter %/, $(obj-m))) +subdirs += $(patsubst %/,%,$(filter %/, $(obj-n))) +subdirs += $(patsubst %/,%,$(filter %/, $(obj-))) -# Subdirectories we need to descend into - -subdir-ym := $(sort $(subdir-y) $(subdir-m)) -subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) +subdirs += $(patsubst %/,%,$(filter %/, $(klib-y))) +subdirs += $(patsubst %/,%,$(filter %/, $(klib-))) -# Add subdir path +# Subdirectories we need to descend into +subdirs := $(addprefix $(obj)/,$(sort $(subdirs))) -subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) # build a list of files to remove, usually releative to the current # directory @@ -43,7 +38,8 @@ # directory __clean-files := $(extra-y) $(EXTRA_TARGETS) $(always) \ $(targets) $(clean-files) \ $(host-progs) \ - $(hostprogs-y) $(hostprogs-m) $(hostprogs-) + $(hostprogs-y) $(hostprogs-m) $(hostprogs-) \ + klib.list # as clean-files is given relative to the current directory, this adds # a $(obj) prefix, except for absolute paths @@ -67,7 +63,7 @@ quiet_cmd_cleandir = CLEAN $(__clean-d cmd_cleandir = rm -rf $(__clean-dirs) -__clean: $(subdir-ymn) +__clean: $(subdirs) ifneq ($(strip $(__clean-files)),) +$(call cmd,clean) endif @@ -87,8 +83,8 @@ # ===================================== # Descending # --------------------------------------------------------------------------- -.PHONY: $(subdir-ymn) -$(subdir-ymn): +.PHONY: $(subdirs) +$(subdirs): $(Q)$(MAKE) $(clean)=$@ # If quiet is set, only print short version of command diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index a1e8763..0f4eadf 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -3,9 +3,9 @@ # Kbuild file for klibc # # Tell that we are building klibc -klibc-build := y +export klibc-build := y -libc-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \ +klib-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \ asprintf.o vasprintf.o \ vsscanf.o sscanf.o ctypes.o \ strntoumax.o strntoimax.o \ @@ -52,19 +52,15 @@ libc-y := vsnprintf.o snprintf.o vsprint ctype/ispunct.o ctype/isspace.o ctype/isupper.o \ ctype/isxdigit.o ctype/tolower.o ctype/toupper.o -libc-$(CONFIG_KLIBC_ERRLIST) += errlist.o +klib-$(CONFIG_KLIBC_ERRLIST) += errlist.o ifeq ($(CONFIG_KLIBC_ERRLIST),y) KLIBCCFLAGS_strerror.o += -DWITH_ERRLIST endif -libc-$(CONFIG_KLIBC_ZLIB) += \ - zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \ - zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \ - zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o - -# zlib specific flag -KLIBCCFLAGS += -DDYNAMIC_CRC_TABLE +klib-$(CONFIG_KLIBC_ZLIB) += zlib/ +# arch specific .o files +klib-y += arch/$(KLIBCARCHDIR)/ ##### # Add any architecture-specific rules @@ -72,14 +68,14 @@ include $(obj)/arch/$(KLIBCARCHDIR)/Make ##### # Shared definitions -LIB := libc.a +LIBC := libc.a SOLIB := libc.so SOHASH := klibc.so CRT0 := arch/$(KLIBCARCHDIR)/crt0.o INTERP_O := interp.o -always := $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O) -LIB := $(call objectify,$(LIB)) +always := $(LIBC) $(SOLIB) $(SOHASH) $(INTERP_O) +LIBC := $(call objectify,$(LIBC)) SOLIB := $(call objectify,$(SOLIB)) SOHASH := $(call objectify,$(SOHASH)) CRT0 := $(call objectify,$(CRT0)) @@ -87,17 +83,10 @@ INTERP_O := $(call objectify,$(INTERP_O) SOLIBHASH = $(shell cat $(SOLIB).hash) -targets += arch/$(KLIBCARCHDIR)/crt0.o -targets += $(libc-y) $(KLIBCARCHOBJS) - # Generate syscall stubs -subdir-y += syscalls +klib-y += syscalls/ # Generate socket calls stubs -subdir-y += socketcalls - -# Tell make to descend before building libs -$(obj)/syscalls/syscalls.list: $(obj)/syscalls -$(obj)/socketcalls/socketcalls.list: $(obj)/socketcalls +klib-y += socketcalls/ ##### # Readable errormessages extracted from src.. @@ -108,20 +97,20 @@ quiet_cmd_errlist = GEN $@ $(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl $(call cmd,errlist) -# full list of dependencies for klibc -libc-deps = $(call objectify, $(libc-y) $(KLIBCARCHOBJS)) \ - $(call objectify, syscalls/syscalls.list socketcalls/socketcalls.list) +# all .o files for all dirs +klib-o-files = $(shell cat $(obj)/klib.list \ + $(addsuffix /klib.list, $(klib-dirs))) ###### # Build static library: libc.a targets += libc.a __static_init.o quiet_cmd_libc = KLIBCAR $@ - cmd_libc = rm -f $@; \ - $(KLIBCAR) cq $@ \ - $(patsubst %.list,`cat %.list`,$(filter-out FORCE,$^)); \ + cmd_libc = rm -f $@; \ + $(KLIBCAR) cq $@ \ + $(call objectify,__static_init.o) $(klib-o-files); \ $(KLIBCRANLIB) $@ -$(LIB): $(call objectify,__static_init.o) $(libc-deps) FORCE +$(LIBC): $(call objectify,__static_init.o) $(obj)/klib.list FORCE $(call if_changed,libc) ###### @@ -130,12 +119,14 @@ targets += libc.so __shared_init.o quiet_cmd_libcso = KLIBCLD $@ cmd_libcso = $(KLIBCLD) $(KLIBCLDFLAGS) $(KLIBCSHAREDFLAGS) -o $@ \ - --start-group \ - $(patsubst %.list,`cat %.list`,$(filter-out FORCE,$^)) \ - $(KLIBCLIBGCC) \ + --start-group \ + $(CRT0) \ + $(call objectify,__shared_init.o) \ + $(klib-o-files) \ + $(KLIBCLIBGCC) \ --end-group -$(SOLIB): $(CRT0) $(call objectify,__shared_init.o) $(libc-deps) FORCE +$(SOLIB): $(call objectify,__shared_init.o) $(obj)/klib.list FORCE $(call if_changed,libcso) @@ -177,7 +168,7 @@ ##### # Install klibc install-rule: @echo " INSTALL klibc to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib" - $(Q)$(foreach f, $(LIB) $(SOLIB) $(CRT0) $(INTERP_O), \ + $(Q)$(foreach f, $(LIBC) $(SOLIB) $(CRT0) $(INTERP_O), \ $(shell $(install-data) $(f) \ $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib)) $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \ diff --git a/usr/klibc/arch/x86_64/Kbuild b/usr/klibc/arch/x86_64/Kbuild new file mode 100644 index 0000000..3f69c5b --- /dev/null +++ b/usr/klibc/arch/x86_64/Kbuild @@ -0,0 +1,8 @@ +# -*- makefile -*- +# +# klibc files for x86_64 + +always := crt0.o +targets := crt0.o + +klib-y := setjmp.o syscall.o sigreturn.o vfork.o diff --git a/usr/klibc/arch/x86_64/Makefile.inc b/usr/klibc/arch/x86_64/Makefile.inc index 4bfe56a..93346a2 100644 --- a/usr/klibc/arch/x86_64/Makefile.inc +++ b/usr/klibc/arch/x86_64/Makefile.inc @@ -1,18 +1,5 @@ -# -*- makefile -*- -# # arch/x86_64/Makefile.inc # # Special rules for this architecture. Note that this is actually # included from the main Makefile, and that pathnames should be # accordingly. -# - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - arch/$(KLIBCARCH)/sigreturn.o \ - arch/$(KLIBCARCH)/vfork.o - -KLIBCARCHSOOBJS = $(patsubst %.o,%.lo,$(KLIBCARCHOBJS)) - -archclean: diff --git a/usr/klibc/socketcalls/Kbuild b/usr/klibc/socketcalls/Kbuild index c106182..f0fc9a8 100644 --- a/usr/klibc/socketcalls/Kbuild +++ b/usr/klibc/socketcalls/Kbuild @@ -9,12 +9,12 @@ ifeq ($(clean),) endif # Listing of all .o files -always := socketcalls.list +always := klib.list ##### # Generate socket calls stubs # Based on input from SOCKETCALLS.def generate socket call stubs -targets := socketcalls.list +targets := klib.list targets += socketcalls.mk targets += SOCKETCALLS.i targets += $(socketcall-objs) @@ -26,7 +26,7 @@ quiet_cmd_makelist = LIST $@ cmd_makelist = echo '$(filter-out FORCE,$^)' > $@ # Create list of all files -$(obj)/socketcalls.list: $(call objectify,$(socketcall-objs)) FORCE +$(obj)/klib.list: $(call objectify,$(socketcall-objs)) FORCE $(call if_changed,makelist) # Generate assembler file (.i) diff --git a/usr/klibc/syscalls/Kbuild b/usr/klibc/syscalls/Kbuild index a1d408d..8a5b94d 100644 --- a/usr/klibc/syscalls/Kbuild +++ b/usr/klibc/syscalls/Kbuild @@ -9,7 +9,7 @@ ifeq ($(clean),) endif # Listing of all .o files -always := syscalls.list +always := klib.list ##### @@ -17,7 +17,7 @@ # Generate syscalls stubs # Based on list in SYSCALLS.def generate stubs for sys calls. Actual arch code # is defined in an arch specific perl file targets += syscalls.mk -targets += syscalls.list +targets += klib.list targets += SYSCALLS.i syscalls.nrs targets += typesize.c typesize.o typesize.bin targets += $(syscall-objs) @@ -34,7 +34,7 @@ quiet_cmd_makelist = LIST $@ cmd_makelist = echo '$(filter-out FORCE,$^)' > $@ # Create list of all files -$(obj)/syscalls.list: $(call objectify,$(syscall-objs)) FORCE +$(obj)/klib.list: $(call objectify,$(syscall-objs)) FORCE $(call if_changed,makelist) # Generate assembler file (.i) diff --git a/usr/klibc/zlib/Kbuild b/usr/klibc/zlib/Kbuild new file mode 100644 index 0000000..a561d42 --- /dev/null +++ b/usr/klibc/zlib/Kbuild @@ -0,0 +1,10 @@ +# zlib + +klib-y := adler32.o compress.o crc32.o gzio.o +klib-y += uncompr.o deflate.o trees.o zutil.o +klib-y += inflate.o infback.o inftrees.o inffast.o + +# zlib specific flag +EXTRA_KLIBCCFLAGS := -DDYNAMIC_CRC_TABLE + + -- 1.4.1.rc2.gfc04
H. Peter Anvin
2006-Jul-09 22:19 UTC
[klibc] [PATCH/RFC] klibc/kbuild: use separate kbuild files for each klibc subdirectory
Sam Ravnborg wrote:> This fixes a long standing issue where it was not possible to > do "make usr/klibc/arch/x86_64/longjmp.o" in the kernel. > > The principle is that all .o files to be part of klibc are listed > with klib-y. For each directory a klib.list file is made that specify > all .o file and the final AR then adds all .o files to create libc.a. > > This patch introduce the infrastructure and converts x86_64 to use it. > And it breaks all other architectures... >This looks like The Right Thing to me, for sure. With two examples (x86_64 and i386) it shouldn't be too hard to fix up the remaining architectures. -hpa
Sam Ravnborg
2006-Jul-10 08:11 UTC
[klibc] [PATCH/RFC] klibc/kbuild: arm, ia64, m32r, m68k, mips, parisc, ppc, sh, sparc64 fixes
Fix several architectures to support new list based klibc build Signed-off-by: Sam Ravnborg <sam at ravnborg.org> --- diff --git a/usr/klibc/arch/arm/Kbuild b/usr/klibc/arch/arm/Kbuild new file mode 100644 index 0000000..f803994 --- /dev/null +++ b/usr/klibc/arch/arm/Kbuild @@ -0,0 +1,15 @@ +# +# klibc files for arm +# + +klib-y := setjmp.o syscall.o vfork.o aeabi_nonsense.o + +klib-y += ../../libgcc/__udivmodsi4.o ../../libgcc/__divdi3.o +klib-y += ../../libgcc/__moddi3.o ../../libgcc/__udivdi3.o +klib-y += ../../libgcc/__umoddi3.o ../../libgcc/__udivmoddi4.o +klib-y += ../../libgcc/__clzsi2.o + +always := crt0.o +targets := crt0.o + + diff --git a/usr/klibc/arch/arm/Makefile.inc b/usr/klibc/arch/arm/Makefile.inc index 62065df..06329b2 100644 --- a/usr/klibc/arch/arm/Makefile.inc +++ b/usr/klibc/arch/arm/Makefile.inc @@ -6,18 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/arm/setjmp.o \ - arch/arm/syscall.o \ - arch/arm/vfork.o \ - arch/arm/aeabi_nonsense.o \ - libgcc/__udivmodsi4.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o \ - libgcc/__clzsi2.o \ - - diff --git a/usr/klibc/arch/ia64/Kbuild b/usr/klibc/arch/ia64/Kbuild new file mode 100644 index 0000000..49070ff --- /dev/null +++ b/usr/klibc/arch/ia64/Kbuild @@ -0,0 +1,13 @@ +# +# klibc files for ia64 +# + +klib-y := vfork.o setjmp.o pipe.o syscall.o + +klib-y += ../../libgcc/__divdi3.o ../../libgcc/__divsi3.o +klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__udivsi3.o +klib-y += ../../libgcc/__umodsi3.o ../../libgcc/__umoddi3.o +klib-y += ../../libgcc/__udivmodsi4.o ../../libgcc/__udivmoddi4.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/ia64/Makefile.inc b/usr/klibc/arch/ia64/Makefile.inc index 8bd2910..9d3748c 100644 --- a/usr/klibc/arch/ia64/Makefile.inc +++ b/usr/klibc/arch/ia64/Makefile.inc @@ -6,21 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/vfork.o \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/pipe.o \ - arch/$(KLIBCARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__divsi3.o \ - libgcc/__udivdi3.o \ - libgcc/__udivsi3.o \ - libgcc/__umodsi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmodsi4.o \ - libgcc/__udivmoddi4.o - -KLIBCARCHSOOBJS = $(patsubst %o,%.lo,%(KLIBCARCHOBJS)) - -archclean: diff --git a/usr/klibc/arch/m32r/Kbuild b/usr/klibc/arch/m32r/Kbuild new file mode 100644 index 0000000..ceb2ba0 --- /dev/null +++ b/usr/klibc/arch/m32r/Kbuild @@ -0,0 +1,13 @@ +# +# klibc files for m32r +# + + +klib-y := setjmp.o syscall.o + +klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o +klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o +klib-y += ../../libgcc/__udivmoddi4.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/m32r/Makefile.inc b/usr/klibc/arch/m32r/Makefile.inc index 794aec6..5664cd0 100644 --- a/usr/klibc/arch/m32r/Makefile.inc +++ b/usr/klibc/arch/m32r/Makefile.inc @@ -6,14 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -archclean: diff --git a/usr/klibc/arch/m68k/Kbuild b/usr/klibc/arch/m68k/Kbuild new file mode 100644 index 0000000..8d6137c --- /dev/null +++ b/usr/klibc/arch/m68k/Kbuild @@ -0,0 +1,8 @@ +# +# klibc files for m68k +# + +klib-y := setjmp.o syscall.o vfork.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/m68k/Makefile.inc b/usr/klibc/arch/m68k/Makefile.inc index a6f9827..1e77ed5 100644 --- a/usr/klibc/arch/m68k/Makefile.inc +++ b/usr/klibc/arch/m68k/Makefile.inc @@ -7,11 +7,6 @@ # included from the main Makefile, and t # accordingly. # -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - arch/$(KLIBCARCH)/vfork.o - KLIBCBITSIZE = 32 # Extra linkflags when building the shared version of the library @@ -21,5 +16,3 @@ # 2816 MB - normal binaries start at 204 # script right. Not sure if there is a fundamental reason # to not duck below the halfway point... KLIBCSHAREDFLAGS = -Ttext 0xb0000000 - -archclean: diff --git a/usr/klibc/arch/mips/Kbuild b/usr/klibc/arch/mips/Kbuild new file mode 100644 index 0000000..90783c9 --- /dev/null +++ b/usr/klibc/arch/mips/Kbuild @@ -0,0 +1,14 @@ +# +# klibc files for mips +# + +klib-y := pipe.o vfork.o setjmp.o syscall.o + +klib-y += ../../libgcc/__clzsi2.o ../../libgcc/__ashldi3.o +klib-y += ../../libgcc/__ashrdi3.o ../../libgcc/__lshrdi3.o +klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o +klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o +klib-y += ../../libgcc/__udivmoddi4.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/mips/Makefile.inc b/usr/klibc/arch/mips/Makefile.inc index adbfc38..9c1b1f8 100644 --- a/usr/klibc/arch/mips/Makefile.inc +++ b/usr/klibc/arch/mips/Makefile.inc @@ -6,24 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/pipe.o \ - arch/$(KLIBCARCH)/vfork.o \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - libgcc/__clzsi2.o \ - libgcc/__ashldi3.o \ - libgcc/__ashrdi3.o \ - libgcc/__lshrdi3.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - - -KLIBCARCHSOOBJS = $(patsubst %.o,%.lo,$(KLIBCARCHOBJS)) - - -archclean: diff --git a/usr/klibc/arch/parisc/Kbuild b/usr/klibc/arch/parisc/Kbuild new file mode 100644 index 0000000..d57a873 --- /dev/null +++ b/usr/klibc/arch/parisc/Kbuild @@ -0,0 +1,8 @@ +# +# klibc files for parisc +# + +klib-y := setjmp.o syscall.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/parisc/Makefile.inc b/usr/klibc/arch/parisc/Makefile.inc index f479a6c..0df4e2a 100644 --- a/usr/klibc/arch/parisc/Makefile.inc +++ b/usr/klibc/arch/parisc/Makefile.inc @@ -6,11 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o - -KLIBCARCHOOBJS = $(patsubst %o,%.lo,%(KLIBCARCHOBJS)) - -archclean: diff --git a/usr/klibc/arch/ppc/Kbuild b/usr/klibc/arch/ppc/Kbuild new file mode 100644 index 0000000..13612ce --- /dev/null +++ b/usr/klibc/arch/ppc/Kbuild @@ -0,0 +1,12 @@ +# +# klibc files for ppc +# + +klib-y := arch/$(KLIBCARCH)/setjmp.o arch/$(KLIBCARCH)/syscall.o + +klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o +klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o +klib-y += ../../libgcc/__udivmoddi4.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/ppc/Makefile.inc b/usr/klibc/arch/ppc/Makefile.inc index 53d99c4..e04316f 100644 --- a/usr/klibc/arch/ppc/Makefile.inc +++ b/usr/klibc/arch/ppc/Makefile.inc @@ -6,17 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - - -KLIBCARCHSOOBJS = $(patsubst %.o,%.lo,$(KLIBCARCHOBJS)) - -archclean: diff --git a/usr/klibc/arch/sh/Kbuild b/usr/klibc/arch/sh/Kbuild new file mode 100644 index 0000000..ab7ad5a --- /dev/null +++ b/usr/klibc/arch/sh/Kbuild @@ -0,0 +1,8 @@ +# +# klibc files for sh +# + +klib-y := setjmp.o syscall.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/sh/Makefile.inc b/usr/klibc/arch/sh/Makefile.inc index ccabfa4..c58f605 100644 --- a/usr/klibc/arch/sh/Makefile.inc +++ b/usr/klibc/arch/sh/Makefile.inc @@ -6,10 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -ARCHOBJS = arch/sh/setjmp.o \ - arch/sh/syscall.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -archclean: diff --git a/usr/klibc/arch/sparc64/Kbuild b/usr/klibc/arch/sparc64/Kbuild new file mode 100644 index 0000000..2854f69 --- /dev/null +++ b/usr/klibc/arch/sparc64/Kbuild @@ -0,0 +1,8 @@ +# +# klibc files for sparc64 +# + +klib-y := pipe.o setjmp.o syscall.o sysfork.o + +always := crt0.o +targets := crt0.o diff --git a/usr/klibc/arch/sparc64/Makefile.inc b/usr/klibc/arch/sparc64/Makefile.inc index 1641f51..e6fb346 100644 --- a/usr/klibc/arch/sparc64/Makefile.inc +++ b/usr/klibc/arch/sparc64/Makefile.inc @@ -6,11 +6,3 @@ # Special rules for this architecture. # included from the main Makefile, and that pathnames should be # accordingly. # - -KLIBCARCHOBJS = \ - arch/$(KLIBCARCH)/pipe.o \ - arch/$(KLIBCARCH)/setjmp.o \ - arch/$(KLIBCARCH)/syscall.o \ - arch/$(KLIBCARCH)/sysfork.o - -archclean:
maximilian attems
2006-Jul-23 16:55 UTC
[klibc] [PATCH/RFC] klibc/kbuild: arm, ia64, m32r, m68k, mips, parisc, ppc, sh, sparc64 fixes
On Sun, Jul 23, 2006 at 06:10:22PM +0200, Sam Ravnborg wrote:> On Wed, Jul 19, 2006 at 04:16:39PM +0200, maximilian attems wrote: > > On Wed, 19 Jul 2006, maximilian attems wrote: > > > > > On Mon, 10 Jul 2006, Sam Ravnborg wrote: > > > > > > > Fix several architectures to support new list based klibc build > > > > > > > > Signed-off-by: Sam Ravnborg <sam at ravnborg.org> > > > > --- > > > > > > 1.4.11 builds fine for alpha, amd64, ia64, mips, mipsel, sparc but not on ppc > > > > hmm hppa affected too, although much later > > -> http://buildd.debian.org/fetch.php?&pkg=klibc&ver=1.4.11-2&arch=hppa&stamp=1153316149&file=log&as=raw > > > > ld -o usr/kinit/kinit usr/klibc/arch/parisc/crt0.o usr/kinit/kinit.o usr/kinit/do_mounts.o usr/kinit/ramdisk_load.o usr/kinit/initrd.o usr/kinit/name_to_dev.o usr/kinit/devname.o usr/kinit/getarg.o usr/kinit/getintfile.o usr/kinit/open.o usr/kinit/readfile.o usr/kinit/xpio.o usr/kinit/do_mounts_md.o usr/kinit/do_mounts_mtd.o usr/kinit/nfsroot.o usr/kinit/ipconfig/lib.a usr/kinit/nfsmount/lib.a usr/kinit/run-init/lib.a usr/kinit/fstype/lib.a usr/kinit/resume/lib.a --start-group usr/klibc/libc.a /usr/lib/gcc/hppa-linux-gnu/4.1.2/libgcc.a --end-group ; cp -f usr/kinit/kinit usr/kinit/kinit.g ; strip --strip-all -R .comment -R .note --strip-all -R .comment -R .note usr/kinit/kinit > > usr/kinit/initrd.o: In function `run_linuxrc': > > (.text+0x168): undefined reference to `vfork' > > make[3]: *** [usr/kinit/kinit] Error 1 > > At first look this seems to be un-related to recent kbuild changes?? > > Samindeed this is a consequence of 044f2b0daa4768e0cdc0af5775fc215ec2c11bd8 that uncovered this hppa specific missing definition. easy to roll back in Debian until fixed. have you had time to look at the missing ppc Kbuild rule? thanks for your feedback! -- maks
Sam Ravnborg
2006-Jul-23 17:20 UTC
[klibc] [PATCH/RFC] klibc/kbuild: arm, ia64, m32r, m68k, mips, parisc, ppc, sh, sparc64 fixes
> have you had time to look at the missing ppc Kbuild rule?I assume you refer to following fix. I cannot send maip to hpa+klibc atm since my providers smtp realy is listed at spamcop so if you could forward to hpa+klibc it would be nice. [PATCH] klibc/ppc: fix build error introduced by recent kbuild changes From: Sam Ravnborg <sam at ravnborg.org> Fix ppc build error. Signed-off-by: Sam Ravnborg <sam at ravnborg.org> --- diff --git a/usr/klibc/arch/ppc/Kbuild b/usr/klibc/arch/ppc/Kbuild index 13612ce..699380f 100644 --- a/usr/klibc/arch/ppc/Kbuild +++ b/usr/klibc/arch/ppc/Kbuild @@ -2,7 +2,7 @@ # # klibc files for ppc # -klib-y := arch/$(KLIBCARCH)/setjmp.o arch/$(KLIBCARCH)/syscall.o +klib-y := setjmp.o syscall.o klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o
maximilian attems
2006-Jul-23 18:47 UTC
[klibc] [PATCH/RFC] klibc/kbuild: arm, ia64, m32r, m68k, mips, parisc, ppc, sh, sparc64 fixes
On Sun, Jul 23, 2006 at 07:20:53PM +0200, Sam Ravnborg wrote:> > > have you had time to look at the missing ppc Kbuild rule? > I assume you refer to following fix.thanks a lot will upload tommorrow to Debian, have no ppc here atm.> I cannot send maip to hpa+klibc atm since my providers smtp realy is > listed at spamcop so if you could forward to hpa+klibc it would be nice.sure, message is bellow: ----- Forwarded message from Sam Ravnborg <sam at ravnborg.org> ----- From: Sam Ravnborg <sam at ravnborg.org> To: maximilian attems <maks at sternwelten.at> Cc: klibc at zytor.com, "H. Peter Anvin" <hpa at zytor.com> Subject: Re: [klibc] [PATCH/RFC] klibc/kbuild: arm, ia64, m32r, m68k, mips, parisc, ppc, sh, sparc64 fixes From: Sam Ravnborg <sam at ravnborg.org> Fix ppc build error. Signed-off-by: Sam Ravnborg <sam at ravnborg.org> --- diff --git a/usr/klibc/arch/ppc/Kbuild b/usr/klibc/arch/ppc/Kbuild index 13612ce..699380f 100644 --- a/usr/klibc/arch/ppc/Kbuild +++ b/usr/klibc/arch/ppc/Kbuild @@ -2,7 +2,7 @@ # # klibc files for ppc # -klib-y := arch/$(KLIBCARCH)/setjmp.o arch/$(KLIBCARCH)/syscall.o +klib-y := setjmp.o syscall.o klib-y += ../../libgcc/__divdi3.o ../../libgcc/__moddi3.o klib-y += ../../libgcc/__udivdi3.o ../../libgcc/__umoddi3.o
Maybe Matching Threads
- [klibc 00/31] klibc as a historyless patchset (updated and reorganized)
- [patch] sparc build fix
- [PATCH 00/16] External building, update for 2.6.33 and multiple root devices.
- [PATCH] add mips64 support
- [klibc:master] Build and install shared binaries only if KLIBCSHAREDFLAGS is defined