chiark / gitweb /
[PATCH] klibc: version 1.0.6
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Mon, 11 Apr 2005 02:51:03 +0000 (04:51 +0200)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:55:01 +0000 (23:55 -0700)
22 files changed:
klibc/Makefile
klibc/klibc/Makefile
klibc/klibc/arch/alpha/sysstub.ph
klibc/klibc/arch/arm/sysstub.ph
klibc/klibc/arch/cris/sysstub.ph
klibc/klibc/arch/i386/sysstub.ph
klibc/klibc/arch/ia64/sysstub.ph
klibc/klibc/arch/m32r/sysstub.ph
klibc/klibc/arch/mips/sysstub.ph
klibc/klibc/arch/parisc/sysstub.ph
klibc/klibc/arch/ppc/sysstub.ph
klibc/klibc/arch/ppc64/sysstub.ph
klibc/klibc/arch/s390/sysstub.ph
klibc/klibc/arch/s390x/sysstub.ph
klibc/klibc/arch/sh/sysstub.ph
klibc/klibc/arch/sparc/sysstub.ph
klibc/klibc/arch/sparc64/sysstub.ph
klibc/klibc/arch/x86_64/sysstub.ph
klibc/klibc/socketcalls.pl
klibc/klibc/syscalls.pl
klibc/makeklcc.pl
klibc/version

index 7a9b92e8d61b1ed0c95bfd9b7662c5bb5d43af04..5071e60da40ef6b3f8f7eef0d01273a5ffaccacb 100644 (file)
@@ -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
index c412a9ffea33b15e94048d05c6dd1f55dd5c9af4..181a226151d809aaa096c28de040994c1d3b121f 100644 (file)
@@ -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
index a24b6c07dc81bc4d73adc47c9178fee7361673ba..08b97e807e7f9eef2e529543ef627671f13c0965 100644 (file)
 # 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 <asm/unistd.h>\n";
     print OUT "#include <machine/asm.h>\n";
     print OUT "\n";
index bf953ccd801b5ac98a90b4ba9d0a71966e310574..256ea3d53432c5603fa2fcf7429c88fc2a6cbd17 100644 (file)
@@ -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 <asm/unistd.h>\n";
        
     print  OUT "\t.text\n";
index 6c894f62f5269bd64d5876d45209cff7aacb8adb..182ad73f8ce6048e2decb36bda463dbf6eca035a 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.text\n";
index 1ba7f36bac989af51cdb4457ac48730242fecf84..e2649e283e75a602b873b1b259da053b853fdea8 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index 34031a29ae1e06f3e7a60c9d9a68ce882bad40f7..8e686c68a33cd430a8c1708bbe34df1ce470307c 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.text\n";
index 3813ea4144eff6700c78935f4ebc0cca34827869..98dfb9d0a8478345fb0e7384570bc863cdb27815 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.text\n";
index abe599c17d933c10eeccfad28f434ef4e05a4a20..a71d5d02efab8f0291343d0bafa9078051082da2 100644 (file)
@@ -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 <asm/asm.h>\n";
     print OUT "#include <asm/regdef.h>\n";
     print OUT "#include <asm/unistd.h>\n";
index 63b5e17fcf65f0aa75d8c34083e48ba25a20dc32..e2196acaf3b29fe622edc073e17f55e58ed95991 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.text\n";
index 542ab5575c9638cb017b82cb6a688a42733ac35f..3b3916c726f4da5d0d084d4e9bd5871478b0d894 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index 0a379158e1c8264150db91f137fb3e57861ee9ab..9ee93701f6faecdd7ce5f7c9f01cde7c5f184a53 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.globl ${fname}\n";
index 3838a1f1b2863165c7f0153cf3ab2cefda4cdc6c..35f40a0865f1c98fa5ef0e7053a8d39f0259f52f 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index 10a47f7b072659b505a079403c80f982ba4f495e..55c721b558bb833d9eab01baa5db62e14e92bc8a 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index add5d358928eded6f95e4d28cacbca8761dec782..ce04b739e950340b6912bf50cb84c4bff27dbecb 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.section\t\".text.syscall\",\"ax\"\n";
index baad9e3d8216cbb87b255074d0909a69898cfdf9..d8cedb5ae5d484a5c9a819f45a1acc5b621831c8 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index 2ef2c6b66efa19b0d38a8cca602caa6eed98b4b2..deeb88ce07b2fe7fc463c919fc5d86acf094c665 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index 07af1227ca47ad0ed1afcafc19c75d09cadfe965..e2d797b1667f7372a7e32ac6a56f537d175cfd29 100644 (file)
@@ -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 <asm/unistd.h>\n";
     print OUT "\n";
     print OUT "\t.type ${fname},\@function\n";
index fd82b2b49f2a7de3ff3ba376043dc32b4b7e2822..024483f716429657e4947505d1aa136e259082ec 100644 (file)
@@ -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 = <FILE>) ) {
     chomp $line;
     $line =~ s/\s*[\#\;].*$//; # Strip comments and trailing blanks
@@ -39,10 +40,11 @@ while ( defined($line = <FILE>) ) {
            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 <sys/socketcalls.h>\n";
            print OUT "\n";
@@ -56,10 +58,10 @@ while ( defined($line = <FILE>) ) {
            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 = <FILE>) ) {
        die "$file:$.: Could not parse input\n";
     }
 }
+
+print "\n";
index 1c48ce58ff623856d484ef66144fa948a3fb99e3..9cea63097bfff4e8c71417862f1fd37a5b4faf6e 100644 (file)
@@ -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 = <UNISTD>) ) {
     chomp $line;
 
@@ -46,6 +47,8 @@ if (!open(FILE, '<', $file)) {
     die "$0: $file: $!\n";
 }
 
+print "syscall-objs := ";
+
 while ( defined($line = <FILE>) ) {
     chomp $line;
     $line =~ s/\s*(|[\#;].*)$//; # Strip comments and trailing blanks
@@ -104,11 +107,14 @@ while ( defined($line = <FILE>) ) {
        @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);
index f8a6294db3faa72101eebf191ce78c0a074fbe64..74045955fdcd75db015f85e765a45ef8b7256749 100644 (file)
@@ -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 = <KLIBCCONF>) ) {
     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";
index 90a27f9cea6e8f02e05a8bbab5d14650e3e932af..af0b7ddbffd5d5a877581ba8ba10deed158da14d 100644 (file)
@@ -1 +1 @@
-1.0.5
+1.0.6