1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-15 06:50:17 +03:00

[PATCH] klibc: version 1.0.6

This commit is contained in:
kay.sievers@vrfy.org 2005-04-11 04:51:03 +02:00 committed by Greg KH
parent 7ab1623383
commit d3743cfb3b
22 changed files with 102 additions and 64 deletions

@ -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

@ -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

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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";

@ -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);

@ -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";

@ -1 +1 @@
1.0.5
1.0.6