diff options
Diffstat (limited to 'klibc')
-rw-r--r-- | klibc/MCONFIG | 9 | ||||
-rw-r--r-- | klibc/Makefile | 26 | ||||
-rw-r--r-- | klibc/include/arch/sparc/klibc/archsignal.h | 27 | ||||
-rw-r--r-- | klibc/include/sys/times.h | 4 | ||||
-rw-r--r-- | klibc/klcc.in | 14 | ||||
-rw-r--r-- | klibc/klibc.spec.in | 36 | ||||
-rw-r--r-- | klibc/klibc/Makefile | 2 | ||||
-rw-r--r-- | klibc/klibc/SYSCALLS.def | 8 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/MCONFIG | 10 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/crt0.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/exits.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/libgcc/__ashldi3.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/libgcc/__ashrdi3.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/libgcc/__lshrdi3.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/libgcc/__muldi3.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/libgcc/__negdi2.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/open.S | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/setjmp.S | 4 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/syscall.S | 4 | ||||
-rw-r--r-- | klibc/klibc/arch/i386/sysstub.ph | 2 | ||||
-rw-r--r-- | klibc/klibc/arch/x86_64/MCONFIG | 3 | ||||
-rw-r--r-- | klibc/klibc/open.c | 3 | ||||
-rw-r--r-- | klibc/klibc/sigaction.c | 2 | ||||
-rw-r--r-- | klibc/version | 2 |
24 files changed, 118 insertions, 54 deletions
diff --git a/klibc/MCONFIG b/klibc/MCONFIG index a7b2cb1bf3..c833499483 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -3,6 +3,14 @@ # Makefile configuration, without explicit rules # +# CROSS is the prefix used for system tools like gcc, ld etc. +CROSS = + +# KCROSS is the prefix we use for klibc installations. This is usually +# the same as CROSS, but may be different, e.g. to install an i386 +# cross-compilation suite on an x86-64 system, using the same gcc/binutils. +KCROSS ?= $(CROSS) + # Location for installation prefix = /usr bindir = $(prefix)/bin @@ -22,7 +30,6 @@ KRNLSRC = $(SRCROOT)/linux KRNLOBJ = $(SRCROOT)/linux ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) -CROSS = CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc diff --git a/klibc/Makefile b/klibc/Makefile index eb8f55570d..812ea92f47 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -17,6 +17,7 @@ $(CROSS)klibc.config: Makefile rm -f $@ echo 'ARCH=$(ARCH)' >> $@ echo 'CROSS=$(CROSS)' >> $@ + echo 'KCROSS=$(KCROSS)' >> $@ echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@ echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@ echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ @@ -49,19 +50,20 @@ local-install: $(CROSS)klcc mkdir -p $(INSTALLROOT)$(mandir)/man1 mkdir -p $(INSTALLROOT)$(SHLIBDIR) mkdir -p $(INSTALLROOT)$(INSTALLDIR) - -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin - set -xe ; for d in linux asm asm-generic ; do \ + -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin + set -xe ; for d in linux asm-$(ARCH) asm-generic $(ASMARCH); do \ mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ - cp -rfL $(KRNLSRC)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ - cp -rfL $(KRNLOBJ)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ - [ ! -d $(KRNLOBJ)/include2/$$d ] || \ - cp -rfL $(KRNLOBJ)/include2/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \ + [ ! -d $$r/$$d ] || \ + cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ + done ; \ done - cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/. - $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(CROSS)klcc.1 - $(INSTALL_EXEC) $(CROSS)klcc $(INSTALLROOT)$(bindir) + cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm + cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir) -include MCONFIG diff --git a/klibc/include/arch/sparc/klibc/archsignal.h b/klibc/include/arch/sparc/klibc/archsignal.h index 6af3709033..3be67a2158 100644 --- a/klibc/include/arch/sparc/klibc/archsignal.h +++ b/klibc/include/arch/sparc/klibc/archsignal.h @@ -8,6 +8,31 @@ #ifndef _KLIBC_ARCHSIGNAL_H #define _KLIBC_ARCHSIGNAL_H -/* No special stuff for this architecture */ +/* Hidden definitions */ + +struct __new_sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + void (*sa_restorer)(void); /* Not used by Linux/SPARC */ + __new_sigset_t sa_mask; +}; + +struct k_sigaction { + struct __new_sigaction sa; + void __user *ka_restorer; +}; + +struct __old_sigaction { + __sighandler_t sa_handler; + __old_sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer) (void); /* not used by Linux/SPARC */ +}; + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; #endif diff --git a/klibc/include/sys/times.h b/klibc/include/sys/times.h index 657f9c4b1c..dd86531669 100644 --- a/klibc/include/sys/times.h +++ b/klibc/include/sys/times.h @@ -5,10 +5,10 @@ #ifndef _SYS_TIMES_H #define _SYS_TIMES_H +#include <klibc/extern.h> +#include <sys/types.h> #include <linux/times.h> __extern clock_t times(struct tms *); -__extern int gettimeofday(struct timeval *, struct timezone *); -__extern int settimeofday(const struct timeval *, const struct timezone *); #endif /* _SYS_TIMES_H */ diff --git a/klibc/klcc.in b/klibc/klcc.in index 713843c37c..bdd03e73b3 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -1,19 +1,19 @@ # -*- perl -*- # Standard includes -@includes = ("-I${INSTALLDIR}/${CROSS}include/arch/${ARCH}", - "-I${INSTALLDIR}/${CROSS}include/bits${BITSIZE}", - "-I${INSTALLDIR}/${CROSS}include"); +@includes = ("-I${INSTALLDIR}/${KCROSS}include/arch/${ARCH}", + "-I${INSTALLDIR}/${KCROSS}include/bits${BITSIZE}", + "-I${INSTALLDIR}/${KCROSS}include"); # Default optimization options (for compiles without -g) @optopt = @OPTFLAGS; @goptopt = ('-O'); # Options and libraries to pass to ld; shared versus static -@staticopt = ("$INSTALLDIR/${CROSS}lib/crt0.o"); -@staticlib = ("$INSTALLDIR/${CROSS}lib/libc.a"); -@sharedopt = (@EMAIN, "$INSTALLDIR/${CROSS}lib/interp.o"); -@sharedlib = ('-R', "$INSTALLDIR/lib/${CROSS}libc.so"); +@staticopt = ("$INSTALLDIR/${KCROSS}lib/crt0.o"); +@staticlib = ("$INSTALLDIR/${KCROSS}lib/libc.a"); +@sharedopt = (@EMAIN, "$INSTALLDIR/${KCROSS}lib/interp.o"); +@sharedlib = ('-R', "$INSTALLDIR/${KCROSS}lib/libc.so"); # Returns the language (-x option string) for a specific extension. sub filename2lang($) { diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in index 237771532a..cab496b917 100644 --- a/klibc/klibc.spec.in +++ b/klibc/klibc.spec.in @@ -19,13 +19,21 @@ Vendor: Starving Linux Artists %description %{name} is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, minimal -entanglement, and portability, not speed. It is definitely a work in -progress, and a lot of things are still missing. +entanglement, and portability, not speed. + +%package devel +Summary: Libraries and tools needed to compile applications against klibc. +Group: Development/Libraries +Requires: klibc = %{version}-%{release} + +%description devel +This package contains the link libraries, header files, and gcc +wrapper scripts needed to compile applications against klibc. %package utils Summary: Small utilities built with klibc. Group: Utilities/System -Requires: klibc = %{version} +Requires: klibc = %{version}-%{release} %description utils This package contains a collection of programs that are linked against @@ -62,8 +70,11 @@ make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ install -# Install the docs +# Make the .so file in /lib a hardlink (they will be expanded as two +# files automatically if it crosses filesystems when extracted.) +ln -f %{buildroot}%{klibcdir}/lib/klibc-*.so %{buildroot}/lib +# Install the docs mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} install -m 444 README %{buildroot}%{libdocdir} install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc @@ -77,12 +88,25 @@ install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit %clean rm -rf $RPM_BUILD_ROOT +# +# Note: libc.so and interp.o are technically -devel files, but +# put them in this package until we can make really, really sure +# the dependency system can avoid confusion. (In fact, it would be +# good to eventually get them out of here, so that multiple runtimes +# can be installed should it be necessary.) +# %files %defattr(-,root,root,-) -%{klibcdir}/lib +/lib/klibc-*.so +%{klibcdir}/lib/*.so +%{klibcdir}/lib/interp.o + +%files devel +%defattr(-,root,root,-) %{klibcdir}/include +%{klibcdir}/lib/*.a +%{klibcdir}/lib/crt0.o %{_bindir}/klcc -/lib/klibc-*.so %doc %{_mandir}/man1/* %doc %{libdocdir}/* diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index a9aedc58f0..c412a9ffea 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -116,7 +116,7 @@ $(SOLIB).hash: $(SOLIB) sha1hash $(SOHASH): $(SOLIB) $(SOLIB).hash cp -f $(SOLIB) $@ - $(STRIP) $@ + $(STRIPCMD) $@ rm -f klibc-??????????????????????.so ln -f $@ klibc-`cat $(SOLIB).hash`.so diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index 3918bcb012..e8b9a7f176 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -146,13 +146,15 @@ ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t) ; Signal operations ; int kill(pid_t, int) +; We really should get rid of the non-rt_* of these, but that takes +; sanitizing <signal.h> for all architectures, sigh... <?> int sigaction(int, const struct sigaction *, struct sigaction *) -int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) <?> int sigsuspend(const sigset_t *) +<?> int sigpending(sigset_t *) +<?> int sigprocmask(int, const sigset_t *, sigset_t *) +int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) int rt_sigsuspend(const sigset_t *, size_t) -<?> int sigpending(sigset_t) int rt_sigpending(sigset_t *, size_t) -<?> int sigprocmask(int, const sigset_t *, sigset_t *) int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) <?> unsigned int alarm(unsigned int) int getitimer(int, struct itimerval *) diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 8310e26381..ecd1307d7f 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -8,16 +8,16 @@ # # Enable this to compile with register parameters; only safe for -# gcc > 3 -REGPARM_OPT := -mregparm=3 -DREGPARM=3 +# gcc >= 3 +REGPARM_OPT := -mregparm=3 -D_REGPARM=3 gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) -OPTFLAGS = -march=i386 -Os -g +OPTFLAGS = -march=i386 -Os -g -fomit-frame-pointer LDFLAGS = -m elf_i386 -ifneq ($(shell if [ $(gcc_major) -gt 2 ] ; then echo "new"; fi ;),) -REGPARM := $(REGPARM_OPT) +ifneq ($(gcc_major),2) +REQFLAGS += $(REGPARM_OPT) OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 ARCHREQFLAGS += -m32 else diff --git a/klibc/klibc/arch/i386/crt0.S b/klibc/klibc/arch/i386/crt0.S index 0f3a7db35e..fb02c694c0 100644 --- a/klibc/klibc/arch/i386/crt0.S +++ b/klibc/klibc/arch/i386/crt0.S @@ -20,7 +20,7 @@ _start: push %ebp # Keep gdb from getting confused push %ebp # Keep gdb from getting confused # Push the arguments and called __libc_init() -#ifndef REGPARM +#ifndef _REGPARM push %edx # atexit() function push %eax # ELF array #endif diff --git a/klibc/klibc/arch/i386/exits.S b/klibc/klibc/arch/i386/exits.S index 59ff563ad8..ed23d98bcb 100644 --- a/klibc/klibc/arch/i386/exits.S +++ b/klibc/klibc/arch/i386/exits.S @@ -28,7 +28,7 @@ exit: .globl _exit .type _exit,@function _exit: -#ifdef REGPARM +#ifdef _REGPARM movl %eax,%ebx #else popl %ebx diff --git a/klibc/klibc/arch/i386/libgcc/__ashldi3.S b/klibc/klibc/arch/i386/libgcc/__ashldi3.S index 80ed4be3cf..61982eb0eb 100644 --- a/klibc/klibc/arch/i386/libgcc/__ashldi3.S +++ b/klibc/klibc/arch/i386/libgcc/__ashldi3.S @@ -8,7 +8,7 @@ .globl __ashldi3 .type __ashldi3,@function __ashldi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S index ba43f9022a..4ac2af69a1 100644 --- a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S +++ b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S @@ -8,7 +8,7 @@ .globl __ashrdi3 .type __ashrdi3,@function __ashrdi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S index 6e521ace2c..730ee43178 100644 --- a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S +++ b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S @@ -8,7 +8,7 @@ .globl __lshrdi3 .type __lshrdi3,@function __lshrdi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__muldi3.S b/klibc/klibc/arch/i386/libgcc/__muldi3.S index c164588b16..81e23b190e 100644 --- a/klibc/klibc/arch/i386/libgcc/__muldi3.S +++ b/klibc/klibc/arch/i386/libgcc/__muldi3.S @@ -10,7 +10,7 @@ .type __muldi3,@function __muldi3: push %esi -#ifndef REGPARM +#ifndef _REGPARM movl 8(%esp),%eax movl %eax,%esi movl 16(%esp),%ecx diff --git a/klibc/klibc/arch/i386/libgcc/__negdi2.S b/klibc/klibc/arch/i386/libgcc/__negdi2.S index 6c95cb235c..c4f2cd517e 100644 --- a/klibc/klibc/arch/i386/libgcc/__negdi2.S +++ b/klibc/klibc/arch/i386/libgcc/__negdi2.S @@ -9,7 +9,7 @@ .globl __negdi2 .type __negdi2,@function __negdi2: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx #endif diff --git a/klibc/klibc/arch/i386/open.S b/klibc/klibc/arch/i386/open.S index 4f492a1566..54dd6151d1 100644 --- a/klibc/klibc/arch/i386/open.S +++ b/klibc/klibc/arch/i386/open.S @@ -15,7 +15,7 @@ .type open,@function open: -#ifdef REGPARM +#ifdef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movl 12(%esp),%ecx diff --git a/klibc/klibc/arch/i386/setjmp.S b/klibc/klibc/arch/i386/setjmp.S index bea900c519..2f3033f5bd 100644 --- a/klibc/klibc/arch/i386/setjmp.S +++ b/klibc/klibc/arch/i386/setjmp.S @@ -19,7 +19,7 @@ .globl setjmp .type setjmp, @function setjmp: -#ifdef REGPARM +#ifdef _REGPARM movl %eax,%edx #else movl 4(%esp),%edx @@ -42,7 +42,7 @@ setjmp: .globl longjmp .type longjmp, @function longjmp: -#ifdef REGPARM +#ifdef _REGPARM xchgl %eax,%edx #else movl 4(%esp),%edx # jmp_ptr address diff --git a/klibc/klibc/arch/i386/syscall.S b/klibc/klibc/arch/i386/syscall.S index f8fa7b4dd3..0634e8208a 100644 --- a/klibc/klibc/arch/i386/syscall.S +++ b/klibc/klibc/arch/i386/syscall.S @@ -14,7 +14,7 @@ .globl __syscall_common .type __syscall_common,@function __syscall_common: -#ifdef REGPARM +#ifdef _REGPARM xchgl %ebx,(%esp) #else popl %eax @@ -24,7 +24,7 @@ __syscall_common: pushl %edi pushl %ebp -#ifdef REGPARM +#ifdef _REGPARM xchgl %eax,%ebx xchgl %ecx,%edx movl ARG(0),%esi diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph index eaa8180911..1ba7f36bac 100644 --- a/klibc/klibc/arch/i386/sysstub.ph +++ b/klibc/klibc/arch/i386/sysstub.ph @@ -16,7 +16,7 @@ sub make_sysstub($$$$@) { print OUT "${fname}:\n"; if ( $stype eq 'varadic' ) { - print OUT "#ifdef REGPARM\n"; + print OUT "#ifdef _REGPARM\n"; print OUT "\tmovl 4(%esp),%eax\n"; print OUT "\tmovl 8(%esp),%edx\n"; print OUT "\tmovl 12(%esp),%ecx\n"; diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG index a2a2367633..13b6e391f9 100644 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -26,3 +26,6 @@ LDFLAGS = -m elf_x86_64 # 2 MB - normal binaries start at 4 MB SHAREDFLAGS = -Ttext 0x00200200 +# Additional asm- directories needed during installation +ASMARCH = asm-i386 + diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c index d52b53a699..cb1f5195db 100644 --- a/klibc/klibc/open.c +++ b/klibc/klibc/open.c @@ -8,8 +8,9 @@ #define _KLIBC_IN_OPEN_C #include <unistd.h> #include <fcntl.h> +#include <bitsize.h> -#if BITSIZE == 32 && !defined(__i386__) +#if _BITSIZE == 32 && !defined(__i386__) extern int __open(const char *, int, mode_t); diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c index 885bc6a4a4..819ffd4fe8 100644 --- a/klibc/klibc/sigaction.c +++ b/klibc/klibc/sigaction.c @@ -5,7 +5,7 @@ #include <signal.h> #include <sys/syscall.h> -#if !defined(__NR_sigaction) +#ifndef __NR_sigaction int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { diff --git a/klibc/version b/klibc/version index 58be07ab5e..1f39702100 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.205 +0.211 |