[klibc] [PATCH] klcc compatibility with gcc

Erik van Konijnenburg ekonijn at xs4all.nl
Wed Mar 2 15:08:37 PST 2005


This patch addresses three issues in klcc:

 * lets klcc define __KLIBC__.
   It's also defined in the klibc <stddef.h>, but we cannot
   rely on stddef being included in every sourcefile of
   every application that wants to use klibc.
 * supports the option -include,
   for example 'gcc -include config.h expr.c'.
   This option is used in the ash Makefile.
 * when running 'klcc -o app main.o lib.o'
   only the last file was passed to the link-editor.

Regards,
Erik

--- klibc-0.204-pristine/klcc.in	2005-03-02 21:33:00.000000000 +0100
+++ klibc-0.204-work/klcc.in	2005-03-02 23:40:02.000000000 +0100
@@ -81,7 +81,7 @@
 # Begin parsing options.
 #
 
- at ccopt = ();
+ at ccopt = ('-D__KLIBC__');
 @ldopt = ();
 
 @files = ();			# List of files
@@ -117,6 +117,9 @@
 	# (-DFOO) or a disjoint argument (-D FOO)
 	push(@ccopt, $a);
 	push(@ccopt, shift(@ARGV)) if ( $2 eq '' );
+    } elsif ( $a eq '-include' ) {
+    	push(@ccopt, $a);
+	push(@ccopt, shift(@ARGV));
     } elsif ( $a =~ /^-[gp]/ ) {
 	# Debugging options to gcc *and* ld
 	push(@ccopt, $a);
@@ -163,8 +166,8 @@
 } else {
     @outopt = ('-o', $output || 'a.out');
 
+    @objs = ();
     foreach $f ( @files ) {
-	@objs = ();
 	@rmobjs = ();
 	if ( $flang{$f} eq 'obj' ) {
 	    push(@objs, $f);



More information about the klibc mailing list