This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Fixes for i686-pc-linux-newlib
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: newlib at sourceware dot org
- Date: Tue, 03 Jan 2006 20:07:09 +0100
- Subject: [PATCH] Fixes for i686-pc-linux-newlib
The first hunk is a work around for the (in)famous INSTALL = ../ bug.
We can just pass down INSTALL as we detect it correctly in the toplevel
configure and in newlib's configure.
The second hunk is needed to invoke initialization and finalization
functions. I tested it by running a program compiled with gcc and with
profiling enabled. It creates the .gcda file correctly.
Can you apply them? I have no copyright on file, but these are small
enough to not require it.
2005-06-03 Paolo Bonzini <bonzini@gnu.org>
* Makefile.am (AM_MAKEFLAGS): Pass down INSTALL.
* libc/sys/linux/machine/i386/crt0.c (_start): Invoke _init and
_fini.
Paolo
Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/Makefile.am,v
retrieving revision 1.35
diff -u -p -r1.35 Makefile.am
--- Makefile.am 8 Sep 2005 22:45:49 -0000 1.35
+++ Makefile.am 3 Jan 2006 19:01:02 -0000
@@ -50,6 +50,7 @@ AM_MAKEFLAGS = \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
+ "INSTALL=$(INSTALL)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
Index: libc/sys/linux/machine/i386/crt0.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/machine/i386/crt0.c,v
retrieving revision 1.5
diff -u -p -r1.5 crt0.c
--- libc/sys/linux/machine/i386/crt0.c 10 Sep 2002 00:46:45 -0000 1.5
+++ libc/sys/linux/machine/i386/crt0.c 3 Jan 2006 19:01:04 -0000
@@ -16,6 +16,9 @@ extern char **environ;
extern int main(int argc,char **argv,char **envp);
+extern void _init (void);
+extern void _fini (void);
+
extern char _end;
extern char __bss_start;
@@ -41,5 +44,8 @@ void _start(int args)
* by this time by Linux. */
tzset(); /* initialize timezone info */
+
+ atexit (_fini);
+ _init ();
exit(main(argc,argv,environ));
}