summaryrefslogtreecommitdiff
path: root/klibc
diff options
context:
space:
mode:
Diffstat (limited to 'klibc')
-rw-r--r--klibc/Makefile8
-rw-r--r--klibc/klibc/Makefile6
-rw-r--r--klibc/klibc/arch/alpha/sysstub.ph6
-rw-r--r--klibc/klibc/arch/arm/sysstub.ph6
-rw-r--r--klibc/klibc/arch/cris/sysstub.ph6
-rw-r--r--klibc/klibc/arch/i386/sysstub.ph6
-rw-r--r--klibc/klibc/arch/ia64/sysstub.ph6
-rw-r--r--klibc/klibc/arch/m32r/sysstub.ph6
-rw-r--r--klibc/klibc/arch/mips/sysstub.ph6
-rw-r--r--klibc/klibc/arch/parisc/sysstub.ph6
-rw-r--r--klibc/klibc/arch/ppc/sysstub.ph6
-rw-r--r--klibc/klibc/arch/ppc64/sysstub.ph6
-rw-r--r--klibc/klibc/arch/s390/sysstub.ph6
-rw-r--r--klibc/klibc/arch/s390x/sysstub.ph6
-rw-r--r--klibc/klibc/arch/sh/sysstub.ph6
-rw-r--r--klibc/klibc/arch/sparc/sysstub.ph6
-rw-r--r--klibc/klibc/arch/sparc64/sysstub.ph6
-rw-r--r--klibc/klibc/arch/x86_64/sysstub.ph6
-rw-r--r--klibc/klibc/socketcalls.pl16
-rw-r--r--klibc/klibc/syscalls.pl12
-rw-r--r--klibc/makeklcc.pl26
-rw-r--r--klibc/version2
22 files changed, 102 insertions, 64 deletions
diff --git a/klibc/Makefile b/klibc/Makefile
index 7a9b92e8d6..5071e60da4 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 c412a9ffea..181a226151 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 a24b6c07dc..08b97e807e 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 <asm/unistd.h>\n";
print OUT "#include <machine/asm.h>\n";
print OUT "\n";
diff --git a/klibc/klibc/arch/arm/sysstub.ph b/klibc/klibc/arch/arm/sysstub.ph
index bf953ccd80..256ea3d534 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 <asm/unistd.h>\n";
print OUT "\t.text\n";
diff --git a/klibc/klibc/arch/cris/sysstub.ph b/klibc/klibc/arch/cris/sysstub.ph
index 6c894f62f5..182ad73f8c 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 <asm/unistd.h>\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 1ba7f36bac..e2649e283e 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 <asm/unistd.h>\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 34031a29ae..8e686c68a3 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 <asm/unistd.h>\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 3813ea4144..98dfb9d0a8 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 <asm/unistd.h>\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 abe599c17d..a71d5d02ef 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 <asm/asm.h>\n";
print OUT "#include <asm/regdef.h>\n";
print OUT "#include <asm/unistd.h>\n";
diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph
index 63b5e17fcf..e2196acaf3 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 <asm/unistd.h>\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 542ab5575c..3b3916c726 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 <asm/unistd.h>\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 0a379158e1..9ee93701f6 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 <asm/unistd.h>\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 3838a1f1b2..35f40a0865 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 <asm/unistd.h>\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 10a47f7b07..55c721b558 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 <asm/unistd.h>\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 add5d35892..ce04b739e9 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 <asm/unistd.h>\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 baad9e3d82..d8cedb5ae5 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 <asm/unistd.h>\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 2ef2c6b66e..deeb88ce07 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 <asm/unistd.h>\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 07af1227ca..e2d797b166 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 <asm/unistd.h>\n";
print OUT "\n";
print OUT "\t.type ${fname},\@function\n";
diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl
index fd82b2b49f..024483f716 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 = <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";
diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl
index 1c48ce58ff..9cea63097b 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 = <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);
diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl
index f8a6294db3..74045955fd 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 = <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";
diff --git a/klibc/version b/klibc/version
index 90a27f9cea..af0b7ddbff 100644
--- a/klibc/version
+++ b/klibc/version
@@ -1 +1 @@
-1.0.5
+1.0.6