From d3743cfb3bd605a8ccb52d30eeaad6a00e6d2123 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 11 Apr 2005 04:51:03 +0200 Subject: [PATCH] [PATCH] klibc: version 1.0.6 --- klibc/Makefile | 8 ++++---- klibc/klibc/Makefile | 6 ++++-- klibc/klibc/arch/alpha/sysstub.ph | 6 +++--- klibc/klibc/arch/arm/sysstub.ph | 6 +++--- klibc/klibc/arch/cris/sysstub.ph | 6 +++--- klibc/klibc/arch/i386/sysstub.ph | 6 +++--- klibc/klibc/arch/ia64/sysstub.ph | 6 +++--- klibc/klibc/arch/m32r/sysstub.ph | 6 +++--- klibc/klibc/arch/mips/sysstub.ph | 6 +++--- klibc/klibc/arch/parisc/sysstub.ph | 6 +++--- klibc/klibc/arch/ppc/sysstub.ph | 6 +++--- klibc/klibc/arch/ppc64/sysstub.ph | 6 +++--- klibc/klibc/arch/s390/sysstub.ph | 6 +++--- klibc/klibc/arch/s390x/sysstub.ph | 6 +++--- klibc/klibc/arch/sh/sysstub.ph | 6 +++--- klibc/klibc/arch/sparc/sysstub.ph | 6 +++--- klibc/klibc/arch/sparc64/sysstub.ph | 6 +++--- klibc/klibc/arch/x86_64/sysstub.ph | 6 +++--- klibc/klibc/socketcalls.pl | 16 ++++++++++------ klibc/klibc/syscalls.pl | 12 +++++++++--- klibc/makeklcc.pl | 26 ++++++++++++++++++++++++++ klibc/version | 2 +- 22 files changed, 102 insertions(+), 64 deletions(-) diff --git a/klibc/Makefile b/klibc/Makefile index 7a9b92e8..5071e60d 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -18,12 +18,12 @@ $(CROSS)klibc.config: Makefile 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 'CC=$(CC)' >> $@ + echo 'LD=$(LD)' >> $@ echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ echo 'OPTFLAGS=$(OPTFLAGS)' >> $@ echo 'LDFLAGS=$(LDFLAGS)' >> $@ - echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@ + echo 'STRIP=$(STRIP)' >> $@ echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ echo 'EMAIN=$(EMAIN)' >> $@ echo 'BITSIZE=$(BITSIZE)' >> $@ @@ -45,7 +45,7 @@ local-all: $(CROSS)klcc local-clean: rm -f klibc.config klcc -local-spotless: +local-spotless: local-clean rm -f klibc.spec *~ tags local-install: $(CROSS)klcc diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index c412a9ff..181a2261 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -141,7 +141,9 @@ syscalls.nrs: ../include/sys/syscall.h syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs rm -rf syscalls mkdir syscalls - $(PERL) syscalls.pl SYSCALLS.i $(ARCH) $(BITSIZE) syscalls.nrs ../include/klibc/havesyscall.h + $(PERL) syscalls.pl SYSCALLS.i arch/$(ARCH)/sysstub.ph $(ARCH) \ + $(BITSIZE) syscalls.nrs \ + syscalls ../include/klibc/havesyscall.h touch $@ ../include/klibc/havesyscall.h: syscalls.dir @@ -150,7 +152,7 @@ syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscall socketcalls.dir: SOCKETCALLS.def socketcalls.pl socketcommon.h rm -rf socketcalls mkdir socketcalls - $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) + $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) socketcalls touch $@ %/static.obj: %.dir diff --git a/klibc/klibc/arch/alpha/sysstub.ph b/klibc/klibc/arch/alpha/sysstub.ph index a24b6c07..08b97e80 100644 --- a/klibc/klibc/arch/alpha/sysstub.ph +++ b/klibc/klibc/arch/alpha/sysstub.ph @@ -12,13 +12,13 @@ # A few system calls are dual-return with the second return value in # r20 (a4). -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; $stype = 'common' if ( $stype eq 'dual0' ); - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "#include \n"; print OUT "\n"; diff --git a/klibc/klibc/arch/arm/sysstub.ph b/klibc/klibc/arch/arm/sysstub.ph index bf953ccd..256ea3d5 100644 --- a/klibc/klibc/arch/arm/sysstub.ph +++ b/klibc/klibc/arch/arm/sysstub.ph @@ -6,10 +6,10 @@ # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/cris/sysstub.ph b/klibc/klibc/arch/cris/sysstub.ph index 6c894f62..182ad73f 100644 --- a/klibc/klibc/arch/cris/sysstub.ph +++ b/klibc/klibc/arch/cris/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph index 1ba7f36b..e2649e28 100644 --- a/klibc/klibc/arch/i386/sysstub.ph +++ b/klibc/klibc/arch/i386/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/ia64/sysstub.ph b/klibc/klibc/arch/ia64/sysstub.ph index 34031a29..8e686c68 100644 --- a/klibc/klibc/arch/ia64/sysstub.ph +++ b/klibc/klibc/arch/ia64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/m32r/sysstub.ph b/klibc/klibc/arch/m32r/sysstub.ph index 3813ea41..98dfb9d0 100644 --- a/klibc/klibc/arch/m32r/sysstub.ph +++ b/klibc/klibc/arch/m32r/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/mips/sysstub.ph b/klibc/klibc/arch/mips/sysstub.ph index abe599c1..a71d5d02 100644 --- a/klibc/klibc/arch/mips/sysstub.ph +++ b/klibc/klibc/arch/mips/sysstub.ph @@ -9,11 +9,11 @@ # system call number in r0 (v0), return an error value in r19 (a3) as # well as the return value in r0 (v0). -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "#include \n"; print OUT "#include \n"; diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph index 63b5e17f..e2196aca 100644 --- a/klibc/klibc/arch/parisc/sysstub.ph +++ b/klibc/klibc/arch/parisc/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/ppc/sysstub.ph b/klibc/klibc/arch/ppc/sysstub.ph index 542ab557..3b3916c7 100644 --- a/klibc/klibc/arch/ppc/sysstub.ph +++ b/klibc/klibc/arch/ppc/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph index 0a379158..9ee93701 100644 --- a/klibc/klibc/arch/ppc64/sysstub.ph +++ b/klibc/klibc/arch/ppc64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.globl ${fname}\n"; diff --git a/klibc/klibc/arch/s390/sysstub.ph b/klibc/klibc/arch/s390/sysstub.ph index 3838a1f1..35f40a08 100644 --- a/klibc/klibc/arch/s390/sysstub.ph +++ b/klibc/klibc/arch/s390/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/s390x/sysstub.ph b/klibc/klibc/arch/s390x/sysstub.ph index 10a47f7b..55c721b5 100644 --- a/klibc/klibc/arch/s390x/sysstub.ph +++ b/klibc/klibc/arch/s390x/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/sh/sysstub.ph b/klibc/klibc/arch/sh/sysstub.ph index add5d358..ce04b739 100644 --- a/klibc/klibc/arch/sh/sysstub.ph +++ b/klibc/klibc/arch/sh/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.section\t\".text.syscall\",\"ax\"\n"; diff --git a/klibc/klibc/arch/sparc/sysstub.ph b/klibc/klibc/arch/sparc/sysstub.ph index baad9e3d..d8cedb5a 100644 --- a/klibc/klibc/arch/sparc/sysstub.ph +++ b/klibc/klibc/arch/sparc/sysstub.ph @@ -5,12 +5,12 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/sparc64/sysstub.ph b/klibc/klibc/arch/sparc64/sysstub.ph index 2ef2c6b6..deeb88ce 100644 --- a/klibc/klibc/arch/sparc64/sysstub.ph +++ b/klibc/klibc/arch/sparc64/sysstub.ph @@ -5,12 +5,12 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/x86_64/sysstub.ph b/klibc/klibc/arch/x86_64/sysstub.ph index 07af1227..e2d797b1 100644 --- a/klibc/klibc/arch/x86_64/sysstub.ph +++ b/klibc/klibc/arch/x86_64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl index fd82b2b4..024483f7 100644 --- a/klibc/klibc/socketcalls.pl +++ b/klibc/klibc/socketcalls.pl @@ -15,12 +15,13 @@ for $arg ( @ARGV ) { push(@args, $arg); } } -($file, $arch) = @args; +($file, $arch, $outputdir) = @args; if (!open(FILE, "< $file")) { die "$file: $!\n"; } +print "socketcall-objs := "; while ( defined($line = ) ) { chomp $line; $line =~ s/\s*[\#\;].*$//; # Strip comments and trailing blanks @@ -39,10 +40,11 @@ while ( defined($line = ) ) { push(@cargs, "$arg a".$i++); } $nargs = $i; + print " \\\n\tsocketcalls/${name}.o"; if ( $arch eq 'i386' ) { - open(OUT, '>', "socketcalls/${name}.S") - or die "$0: Cannot open socketcalls/${name}.S\n"; + open(OUT, '>', "${outputdir}/${name}.S") + or die "$0: Cannot open ${outputdir}/${name}.S\n"; print OUT "#include \n"; print OUT "\n"; @@ -56,10 +58,10 @@ while ( defined($line = ) ) { print OUT "\t.size ${name},.-${name}\n"; close(OUT); } else { - open(OUT, '>', "socketcalls/${name}.c") - or die "$0: Cannot open socketcalls/${name}.c\n"; + open(OUT, '>', "${outputdir}/${name}.c") + or die "$0: Cannot open ${outputdir}/${name}.c\n"; - print OUT "#include \"../socketcommon.h\"\n"; + print OUT "#include \"socketcommon.h\"\n"; print OUT "\n"; print OUT "#ifndef __NR_${name}\n\n"; @@ -82,3 +84,5 @@ while ( defined($line = ) ) { die "$file:$.: Could not parse input\n"; } } + +print "\n"; diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl index 1c48ce58..9cea6309 100644 --- a/klibc/klibc/syscalls.pl +++ b/klibc/klibc/syscalls.pl @@ -18,13 +18,14 @@ for $arg ( @ARGV ) { push(@args, $arg); } } -($file, $arch, $bits, $unistd, $havesyscall) = @args; +($file, $sysstub, $arch, $bits, $unistd, $outputdir, $havesyscall) = @args; -require "arch/$arch/sysstub.ph"; +require "$sysstub"; if (!open(UNISTD, '<', $unistd)) { die "$0: $unistd: $!\n"; } + while ( defined($line = ) ) { chomp $line; @@ -46,6 +47,8 @@ if (!open(FILE, '<', $file)) { die "$0: $file: $!\n"; } +print "syscall-objs := "; + while ( defined($line = ) ) { chomp $line; $line =~ s/\s*(|[\#;].*)$//; # Strip comments and trailing blanks @@ -104,11 +107,14 @@ while ( defined($line = ) ) { @args = split(/\s*\,\s*/, $argv); print HAVESYS "#define _KLIBC_HAVE_SYSCALL_${fname} ${sname}\n"; - make_sysstub($fname, $type, $sname, $stype, @args); + print " \\\n\tsyscalls/${fname}.o"; + make_sysstub($outputdir, $fname, $type, $sname, $stype, @args); } else { die "$file:$.: Could not parse input: \"$line\"\n"; } } +print "\n"; + print HAVESYS "\n#endif\n"; close(HAVESYS); diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl index f8a6294d..74045955 100644 --- a/klibc/makeklcc.pl +++ b/klibc/makeklcc.pl @@ -5,8 +5,27 @@ # Usage: makeklcc klcc.in klibc.config perlpath # +use File::Spec; + ($klccin, $klibcconf, $perlpath) = @ARGV; +sub pathsearch($) { + my($file) = @_; + my(@path); + my($p,$pp); + + if ( $file =~ /\// ) { + return File::Spec->rel2abs($file); + } + + foreach $p ( split(/\:/, $ENV{'PATH'}) ) { + $pp = File::Spec->rel2abs(File::Spec->catpath(undef, $p, $file)); + return $pp if ( -x $pp ); + } + + return undef; +} + print "#!${perlpath}\n"; open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; @@ -14,6 +33,13 @@ while ( defined($l = ) ) { chomp $l; if ( $l =~ /^([^=]+)\=(.*)$/ ) { $n = $1; $s = $2; + + if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) { + $s1 = pathsearch($s); + die "$0: Cannot find $n: $s\n" unless ( defined($s1) ); + $s = $s1; + } + print "\$$n = \"\Q$s\E\";\n"; print "\@$n = qw($s);\n"; print "\$conf{\'\L$n\E\'} = \\\$$n;\n"; diff --git a/klibc/version b/klibc/version index 90a27f9c..af0b7ddb 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.5 +1.0.6 -- 2.39.5