From owner-freebsd-hackers Fri Apr 21 08:01:24 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id IAA09111 for hackers-outgoing; Fri, 21 Apr 1995 08:01:24 -0700 Received: from tonic.gmd.de (tonic.gmd.de [192.76.247.81]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id IAA09098 for ; Fri, 21 Apr 1995 08:01:19 -0700 Received: (from dws@localhost) by tonic.gmd.de (8.6.9/8.6.9) id RAA15147; Fri, 21 Apr 1995 17:00:44 +0200 Date: Fri, 21 Apr 1995 17:00:44 +0200 From: Dirk Steinberg Message-Id: <9504211500.ZM15146@tonic.gmd.de> Reply-To: Dirk.Steinberg@gmd.de X-Mailer: Z-Mail (3.2.0 06sep94) To: hackers@FreeBSD.org Subject: Patches to compile Kernel and Libraries with '-O3 -fomit-frame-pointer' Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Sender: hackers-owner@FreeBSD.org Precedence: bulk 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