[klibc] [klibc:master] klcc: Treat CC, LD, STRIP as multiple words

klibc-bot for Ben Hutchings ben at decadent.org.uk
Thu Aug 20 14:09:04 PDT 2020


Commit-ID:  7752eb456addbd1973e9c6b609294ccef89a65a2
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=7752eb456addbd1973e9c6b609294ccef89a65a2
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Thu, 20 Aug 2020 21:48:07 +0100
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Thu, 20 Aug 2020 21:50:09 +0100

[klibc] klcc: Treat CC, LD, STRIP as multiple words

LLVM cross-builds use the same front-end programs but with a
"-target <triplet>" option.  Add support for this.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 klcc/klcc.in     | 12 ++++++------
 klcc/makeklcc.pl | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/klcc/klcc.in b/klcc/klcc.in
index 43d0984a..7b3b8f3b 100644
--- a/klcc/klcc.in
+++ b/klcc/klcc.in
@@ -218,7 +218,7 @@ if ( $debugging ) {
 if ( $operation ne '' ) {
     # Just run gcc with the appropriate options
     @outopt = ('-o', $output) if ( defined($output) );
-    $rv = mysystem($CC, @ccopt, @outopt, files_with_lang(\@files, \%flang));
+    $rv = mysystem(@CC, @ccopt, @outopt, files_with_lang(\@files, \%flang));
 } else {
     if ( scalar(@files) == 0 ) {
 	die "$0: No input files!\n";
@@ -241,7 +241,7 @@ if ( $operation ne '' ) {
 	    push(@objs, $fo);
 	    push(@rmobjs, $fo) unless ( $save_temps );
 
-	    $rv = mysystem($CC, @ccopt, '-c', '-o', $fo, '-x', $flang{$f}, $f);
+	    $rv = mysystem(@CC, @ccopt, '-c', '-o', $fo, '-x', $flang{$f}, $f);
 
 	    if ( $rv ) {
 		unlink(@rmobjs);
@@ -251,18 +251,18 @@ if ( $operation ne '' ) {
     }
 
     # Get the libgcc pathname for the *current* gcc
-    open(LIBGCC, '-|', $CC, @ccopt, '-print-libgcc-file-name')
+    open(LIBGCC, '-|', @CC, @ccopt, '-print-libgcc-file-name')
 	or die "$0: cannot get libgcc filename\n";
     $libgcc = <LIBGCC>;
     chomp $libgcc;
     close(LIBGCC);
 
     if ( $shared ) {
-	$rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs,
+	$rv = mysystem(@LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs,
 		       @libs, @stdlibpath, '--start-group', @sharedlib,
 		       $libgcc, '--end-group');
     } else {
-	$rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs,
+	$rv = mysystem(@LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs,
 		       @libs, @stdlibpath, '--start-group', @staticlib,
 		       $libgcc, '--end-group');
     }
@@ -270,7 +270,7 @@ if ( $operation ne '' ) {
     unlink(@rmobjs);
 
     if ( $strip && !$rv ) {
-	$rv = mysystem($STRIP, @STRIPFLAGS, $output);
+	$rv = mysystem(@STRIP, @STRIPFLAGS, $output);
     }
 }
 
diff --git a/klcc/makeklcc.pl b/klcc/makeklcc.pl
index 5945eb16..41c5cf46 100644
--- a/klcc/makeklcc.pl
+++ b/klcc/makeklcc.pl
@@ -34,21 +34,21 @@ while ( defined($l = <KLIBCCONF>) ) {
     chomp $l;
     if ( $l =~ /^([^=]+)\=\s*(.*)$/ ) {
 	$n = $1;  $s = $2;
+	my @s = split(/\s+/, $s);
 
 	if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) {
-	    $s1 = pathsearch($s);
+	    $s1 = pathsearch($s[0]);
 	    die "$0: Cannot find $n: $s\n" unless ( defined($s1) );
-	    $s = $s1;
+	    $s[0] = $s1;
 	}
 
 	print "\$$n = \"\Q$s\E\";\n";
 	print "\$conf{\'\L$n\E\'} = \\\$$n;\n";
 
 	print "\@$n = ("; $sep = '';
-	while ( $s =~ /^\s*(\S+)/ ) {
-	    print $sep, "\"\Q$1\E\"";
+	for (@s) {
+	    print $sep, "\"\Q$_\E\"";
 	    $sep = ', ';
-	    $s = "$'";
 	}
 	print ");\n";
     }


More information about the klibc mailing list