aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2006-01-05 21:01:48 +0100
committerH. Peter Anvin <hpa@zytor.com>2006-01-05 22:10:39 -0800
commita1d1224379db621fd3d36b1a4c23fe06258e818a (patch)
tree90a0b0d549e4f3b877317b029bd21c074b6d6b31
parent5c8e790c8f4400c2c94a06846836bf3b29d00b71 (diff)
downloadklibc-a1d1224379db621fd3d36b1a4c23fe06258e818a.tar.gz
Fix generation of Alpha divide stubsklibc-1.1.16
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.
-rw-r--r--klibc/arch/alpha/Makefile.inc118
1 files changed, 42 insertions, 76 deletions
diff --git a/klibc/arch/alpha/Makefile.inc b/klibc/arch/alpha/Makefile.inc
index b7d15c735f54f..0884451fb8b39 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
-
-ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS))
-
-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
+ARCHOBJS := arch/$(ARCH)/pipe.o arch/$(ARCH)/setjmp.o
+ARCHOBJS += arch/$(ARCH)/syscall.o arch/$(ARCH)/sysdual.o
+
+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
+
+targets += $(DIVOBJS:.o=.S) $(DIVOBJS:.o=.ss)
+clean-files += $(DIVOBJS:.o=.S) $(DIVOBJS:.o=.ss)