Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 1995 17:00:44 +0200
From:      Dirk Steinberg <Dirk.Steinberg@gmd.de>
To:        hackers@FreeBSD.org
Subject:   Patches to compile Kernel and Libraries with '-O3 -fomit-frame-pointer'
Message-ID:  <9504211500.ZM15146@tonic.gmd.de>

next in thread | raw e-mail | index | archive | help
Hi,

After some deadly failures I succeeded in compiling and running
FreeBSD-950417 with maximum gcc optimization: "-O3 -fomit-frame-pointer".

As for the gcc flags, this is easily accomplished by editing /etc/make.conf
for the user-level code. For the kernel itself the appropriate line in the
Makefile
containing the "COPTFLAGS" definition needs to be adapted.

Needless to say, for both the kernel and the user-land, this didn't work at
first:

/usr/libexec/ld.so fails horribly when compiled with "-fomit-frame-pointer".
I learned the hard way :-(  (after compiling /bin and /sbin dynamically...).

For the kernel compile, the functions dummyinit() in in kern/init_main.c
and dummy_cleanup() in kern/kern_xxx.c get optimized away by gcc
when compiling with an optimization setting higher than "-O2", e.g.
"-O3".

The following patch fixes these problems.

Apart from these, the machine now runs happily with an uptime of
3 days...

	- Dirk

PS: If I could only get a new sup from freefall... It replies to ping,
	but the supfilesrv seems to have died.


diff -ur 950417/lib/csu/i386/Makefile ./lib/csu/i386/Makefile
--- 950417/lib/csu/i386/Makefile	Thu Mar 30 11:09:46 1995
+++ ./lib/csu/i386/Makefile	Sun Apr 23 23:36:35 1995
@@ -1,7 +1,7 @@
 #	from: @(#)Makefile	5.6 (Berkeley) 5/22/91
 #	$Id: Makefile,v 1.15 1995/03/30 06:40:31 phk Exp $

-CFLAGS+=	-DLIBC_SCCS -DDYNAMIC
+CFLAGS+=	-DLIBC_SCCS -DDYNAMIC -fno-omit-frame-pointer
 OBJS=		crt0.o gcrt0.o c++rt0.o
 CLEANFILES+=	a.out
 MAN3+=		dlopen.3
diff -ur 950417/sys/kern/init_main.c ./sys/kern/init_main.c
--- 950417/sys/kern/init_main.c	Mon Apr 10 22:20:26 1995
+++ ./sys/kern/init_main.c	Mon Apr 17 19:54:21 1995
@@ -110,7 +110,7 @@
  * called to initialize various pseudo-devices and whatnot.
  */

-static void dummyinit() {}
+void dummyinit() {}
 TEXT_SET(pseudo_set, dummyinit);

 typedef void (*pseudo_func_t)(void);
diff -ur 950417/sys/kern/kern_xxx.c ./sys/kern/kern_xxx.c
--- 950417/sys/kern/kern_xxx.c	Sun Dec  4 20:58:43 1994
+++ ./sys/kern/kern_xxx.c	Mon Apr 17 19:53:16 1995
@@ -46,7 +46,7 @@

 /* This implements a "TEXT_SET" for cleanup functions */

-static void
+void
 dummy_cleanup() {}
 TEXT_SET(cleanup_set, dummy_cleanup);

------------ snip, snip -----------------

-- 
------------------------------------------------------------------------------
Dirk W. Steinberg - German National Research Center for Computer Science (GMD)
Institute for Application-Oriented Software- and Systems Technology   (ISA-NW)
Network Engineering Department  -  Rathausallee 10  -   D-53754 Sankt Augustin
Phone: +49 2241 14-3182 - Fax: +49 2241 14-3038 - Email: Dirk.Steinberg@gmd.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9504211500.ZM15146>