[klibc] Re: build failure on alpha

Sam Ravnborg sam at ravnborg.org
Thu Jan 5 12:01:48 PST 2006


On Thu, Jan 05, 2006 at 10:17:05AM +0100, maximilian attems wrote:
> > 
> > Some strange things are going on in alpha land.
> > I need to try it out before attemting to fix it.
> 
> the debian initramfs-tools rely on klibc hope you find a fix soon :)

It was actually very simple. alpha plays some clever tricks to
share divide.c for all __* routines.

I saw no use of the -fPIC version so those I got rid of.
Here is my first attempt.
Please post result of make V=1 if it fails and let me know if it works.

	Sam

diff --git a/klibc/arch/alpha/Makefile.inc b/klibc/arch/alpha/Makefile.inc
index b7d15c7..0884451 100644
--- a/klibc/arch/alpha/Makefile.inc
+++ b/klibc/arch/alpha/Makefile.inc
@@ -16,80 +16,46 @@ DIVCFLAGS = $(REQFLAGS) $(ARCHREQFLAGS) 
 	-fcall-saved-21 -fcall-saved-22 -ffixed-23 -fcall-saved-24 \
 	-ffixed-25 -ffixed-27
 
-ARCHOBJS = \
-	arch/$(ARCH)/__divqu.o \
-	arch/$(ARCH)/__remqu.o \
-	arch/$(ARCH)/__divq.o \
-	arch/$(ARCH)/__remq.o \
-	arch/$(ARCH)/__divlu.o \
-	arch/$(ARCH)/__remlu.o \
-	arch/$(ARCH)/__divl.o \
-	arch/$(ARCH)/__reml.o \
-	arch/$(ARCH)/pipe.o \
-	arch/$(ARCH)/setjmp.o \
-	arch/$(ARCH)/syscall.o \
-	arch/$(ARCH)/sysdual.o
+ARCHOBJS := arch/$(ARCH)/pipe.o     arch/$(ARCH)/setjmp.o
+ARCHOBJS += arch/$(ARCH)/syscall.o  arch/$(ARCH)/sysdual.o
 
-ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
+DIVOBJS += arch/$(ARCH)/__divqu.o \
+           arch/$(ARCH)/__remqu.o \
+           arch/$(ARCH)/__divq.o \
+           arch/$(ARCH)/__remq.o \
+           arch/$(ARCH)/__divlu.o \
+           arch/$(ARCH)/__remlu.o \
+           arch/$(ARCH)/__divl.o \
+           arch/$(ARCH)/__reml.o
+
+ARCHOBJS += $(DIVOBJS)
+
+quiet_cmd_regswap = REGSWAP $@
+      cmd_regswap = sed -e 's/\$$0\b/$$27/g'  -e 's/\$$24\b/$$99/g' \
+                        -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \
+                        -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@
+
+# Use static pattern rule to avoid using a temporary file
+$(addprefix $(obj)/,$(DIVOBJS:.o=.S)): $(obj)/arch/$(ARCH)/%.S: \
+                                       $(obj)/arch/$(ARCH)/%.ss
+	$(call if_changed,regswap)
+
+quiet_cmd_genss = DIV-CC  $@
+      cmd_genss = $(CC) $(DIVCFLAGS) $(FILE_CFLAGS) \
+                        -DNAME=$(basename $(notdir $@)) -S -o $@ $<
+
+$(obj)/arch/$(ARCH)/%.ss: $(obj)/arch/$(ARCH)/divide.c
+	$(call if_changed,genss)
+
+$(obj)/arch/$(ARCH)/__divqu.ss: FILE_CFLAGS := -DSIGNED=0 -DREM=0 -DBITS=64
+$(obj)/arch/$(ARCH)/__remqu.ss: FILE_CFLAGS := -DSIGNED=0 -DREM=1 -DBITS=64
+$(obj)/arch/$(ARCH)/__divq.ss:  FILE_CFLAGS := -DSIGNED=1 -DREM=0 -DBITS=64
+$(obj)/arch/$(ARCH)/__remq.ss:  FILE_CFLAGS := -DSIGNED=1 -DREM=1 -DBITS=64
+$(obj)/arch/$(ARCH)/__divlu.ss: FILE_CFLAGS := -DSIGNED=0 -DREM=0 -DBITS=32
+$(obj)/arch/$(ARCH)/__remlu.ss: FILE_CFLAGS := -DSIGNED=0 -DREM=1 -DBITS=32
+$(obj)/arch/$(ARCH)/__divl.ss:  FILE_CFLAGS := -DSIGNED=1 -DREM=0 -DBITS=32
+$(obj)/arch/$(ARCH)/__reml.ss:  FILE_CFLAGS := -DSIGNED=1 -DREM=1 -DBITS=32
 
-arch/$(ARCH)/%.s: arch/$(ARCH)/%.ss
-	sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \
-	    -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \
-            -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@
-
-arch/$(ARCH)/%.ls: arch/$(ARCH)/%.lss
-	sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \
-	    -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \
-            -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@
-
-arch/$(ARCH)/__divqu.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $<
-
-arch/$(ARCH)/__remqu.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $<
-
-arch/$(ARCH)/__divq.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $<
-
-arch/$(ARCH)/__remq.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $<
-
-arch/$(ARCH)/__divlu.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $<
-
-arch/$(ARCH)/__remlu.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $<
-
-arch/$(ARCH)/__divl.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $<
-
-arch/$(ARCH)/__reml.ss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $<
-
-arch/$(ARCH)/__divqu.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $<
-
-arch/$(ARCH)/__remqu.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $<
-
-arch/$(ARCH)/__divq.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $<
-
-arch/$(ARCH)/__remq.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $<
-
-arch/$(ARCH)/__divlu.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $<
-
-arch/$(ARCH)/__remlu.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $<
-
-arch/$(ARCH)/__divl.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $<
-
-arch/$(ARCH)/__reml.lss: arch/$(ARCH)/divide.c
-	$(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $<
-
-archclean:
-	rm -f arch/$(ARCH)/*.ss arch/$(ARCH)/*.lss
+targets     += $(DIVOBJS:.o=.S) $(DIVOBJS:.o=.ss)
+clean-files += $(DIVOBJS:.o=.S) $(DIVOBJS:.o=.ss)
 



More information about the klibc mailing list