X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=klibc%2Fklcc.in;h=5629f24f1c02e7a15c8bd3f504f58d008f6fcbe8;hp=36c4d9b3eeeb6332b5a9d9fc369529a6db033e5f;hb=9607c4222c08c2d3def2faeac62f6cca5d3ce119;hpb=c07669bd663d780e4957691e488798aa0178e76b diff --git a/klibc/klcc.in b/klibc/klcc.in index 36c4d9b3e..5629f24f1 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -1,5 +1,7 @@ # -*- perl -*- +use IPC::Open3; + # Standard includes @includes = ("-I${prefix}/${KCROSS}include/arch/${ARCH}", "-I${prefix}/${KCROSS}include/bits${BITSIZE}", @@ -57,7 +59,7 @@ sub files_with_lang($$) { # Skip object files if ( $need ne 'obj' ) { - unless ( $xopt eq $need ) { + unless ( $xopt eq $need || $need eq 'stdin') { push(@as, '-x', $need); $xopt = $need; } @@ -79,7 +81,11 @@ sub syserr($) { # Run a program; printing out the command line if $verbose is set sub mysystem(@) { print STDERR join(' ', @_), "\n" if ( $verbose ); - return system(@_); + my $cmd = shift; + open(INPUT, "<&STDIN"); # dup STDIN filehandle to INPUT + my $childpid = open3("<&INPUT", ">&STDOUT", ">&STDERR", $cmd, @_); + waitpid ($childpid, 0); + return $?; } # @@ -117,6 +123,11 @@ while ( defined($a = shift(@ARGV)) ) { # Not an option. Must be a filename then. push(@files, $a); $flang{$a} = $lang || filename2lang($a); + } elsif ( $a eq '-' ) { + # gcc gets its input from stdin + push(@files, $a); + # prevent setting -x + $flang{$a} = 'stdin' } elsif ( $a =~ /^-print-klibc-(.*)$/ ) { # This test must precede -print if ( defined($conf{$1}) ) {