Date: Thu, 10 Dec 1998 15:55:53 +1100 From: Peter Jeremy <peter.jeremy@auss2.alcatel.com.au> To: current@FreeBSD.ORG Subject: Re: buildworld and PAM and login and stuff Message-ID: <98Dec10.155522est.40382@border.alcanet.com.au>
next in thread | raw e-mail | index | archive | help
Archie Cobbs <archie@whistle.com> wrote: >Brings up a related question I was wondering about.. what happens >if you compile the kernel -O2? I guess it must break something, >otherwise that would be the default.. ? I understand the stock gcc (2.7.2.1) generates bad code with -O2. I don't know the exact details. Mikhail Teterin <mi@kot.ne.mediaone.net> wrote: >using the gcc-2.8.1 compiler. I had to add the libkern's muldi3 (I >think), to the Makefile manually. I don't recall this one (although I haven't tried using gcc-2.8.1 on -current). I _am_ aware of one (fairly subtle) problem with gcc-2.8.1 that prevents it correctly building a kernel: The cpp _does_not_ remove backslash-newline sequences from string constants (and maybe elsewhere as well). This causes problems with the DEVICE_NAMES macro defined in vector.h and used in vector.s. I have reported this to bug-gcc (in mid-June) but haven't seen any response. At this time, I don't know of any way to disable this - the only work- around is to use a gcc-2.7.x derived cpp (eg the standard cpp). This implies changing NORMAL_S and DRIVER_S in /sys/i386/conf/Makefile.i386 to explicitly use the standard (2.7.2.1-derived) cpp in front of as. [Note that according to the GNU as documentation, gas handles backslashes inside strings in the same way as C. This is not (and, according to one of the gas maintainers, has never been) true]. I have also identified 3 cases where gcc-2.8.1 generates sub-optimal code: a) A long-long variable divided by a constant power-of-2 generates an unnecessary call to __cmpdi2. This prevents a 2.x (and presumably -current) kernel from linking because __cmpdi2 is not included in the kernel support library. This may be the problem Mikhail has seen. b) The code for random() does divide and modulo operations which gcc-2.7 merges into a single idivl instruction, whilst 2.8.1 generates additional code to `optimise' the division. c) In some cases where gcc converts a loop index multiplied by a constant into a temporary variable incremented by the constant, gcc 2.8.1 unnecessarily splits the addition into two pieces. For the first problem, I have a patch (posted to freebsd-ports on 13th April) that fixes this by extending the code in the expmed.c to open-code the 64-bit compare. It's about 500 lines. Richard Kenner <kenner@vlsi1.ultra.nyu.edu> developed patches for the other two problems and mailed them to me. I don't know what further distribution has been made. They total about 50 lines. Peter -- Peter Jeremy (VK2PJ) peter.jeremy@alcatel.com.au Alcatel Australia Limited 41 Mandible St Phone: +61 2 9690 5019 ALEXANDRIA NSW 2015 Fax: +61 2 9690 5982 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98Dec10.155522est.40382>