From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 20 18:05:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8193A1065672; Wed, 20 Jul 2011 18:05:15 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 014BF8FC0A; Wed, 20 Jul 2011 18:05:14 +0000 (UTC) Received: from park.js.berklix.net (p5DCBEA02.dip.t-dialin.net [93.203.234.2]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p6KI52Jn078739; Wed, 20 Jul 2011 18:05:03 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p6KI52Qu030411; Wed, 20 Jul 2011 20:05:03 +0200 (CEST) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id p6KI4qss011543; Wed, 20 Jul 2011 18:04:57 GMT (envelope-from jhs@fire.js.berklix.net) Message-Id: <201107201804.p6KI4qss011543@fire.js.berklix.net> To: John Baldwin From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Wed, 20 Jul 2011 11:13:51 EDT." <201107201113.52085.jhb@freebsd.org> Date: Wed, 20 Jul 2011 20:04:52 +0200 Sender: jhs@berklix.com Cc: freebsd-hackers@freebsd.org, Dan Nelson , Andriy Gapon Subject: Re: Freebsd-7.4 + std gcc 4.2.1 fails to honour -march=i586 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2011 18:05:15 -0000 Hi John & all, > On Wednesday, July 20, 2011 8:34:57 am Julian H. Stacey wrote: > > Hi, > > Reference: > > > From: John Baldwin > > > Date: Wed, 20 Jul 2011 07:48:05 -0400 > > > Message-id: <201107200748.05786.jhb@freebsd.org> > > > > John Baldwin wrote: > > > On Wednesday, July 20, 2011 7:33:26 am Julian H. Stacey wrote: > > > > What should FreeBSD do ? > > > > Add a comment to man gcc ... that -march=i586 is not > > > > enough, & feed the comment back to gcc project & see how > > > > they want to handle it ? > > > > > > No, this is not a GCC bug. If you want to use a single build machine that > > > will compile programs for other machines on a network to use, it must use the > > > lowest common denominator for its CPUTYPE in /etc/make.conf. > > > > > > The out-of-the-box crt files from a FreeBSD install will work fine on a 486 > > > and above, so can only get yourself into this quandry by building a new world > > > with a CPUTYPE (or similar CFLAGS) setting in /etc/make.conf that violates > > > this rule. > > > > > > You can fix your machine by fixing the CPUTYPE in your build machine and > > > building and installing a new world (do use NO_CLEAN=yes for your build, do a > > > full build). You will also want to rebuild any other binaries on this machine > > > that you share with other machines. > > > > > > -- > > > John Baldwin > > > > > > Hi John, > > Yes I realise all that now thanks. > > The point now is man gcc is misleading/ incomplete: > > "-march=cpu-type > > Generate instructions for the machine type cpu-type." > > Those instructions will not make a program that runs on a lesser CPU type > > without alternate crt for lesse CPU. > > > > CFLAGS in make.conf is fine for single developer/ host debugging, > > but is not appropriate for multi user multi make builds os src/ ports/ other > > > > Its seems just that gcc -march fails to select alternate crt. > > > > One gross ugly solution needing root would be to create chroots, > > but Too ugly. > > > > I suggest gcc via -march should also be used as a selection for sub > > dirs for crt ? & we should co-operate with gcc project on that, > > *BSD & *linux must all face same phenomena so lets not develop > > a non standard solution. > > I think this is a harder problem than you expect. Yes, Needs to be thought through, that's why I posted 13:33:26 +0200 : > > Question: with more complex programs than who, might there > > be sensitivity to other libs too ? Per Andriy's : > Talk to GCC people now? I'm not clear what's best, but yes, when its clear, then talk to gcc people. > It is not just the crt files > that matter, but every library. You would need CPU-specific versions of every > static library on the build system, Would be preferable. Though as we default to link dynamic, not as essential as crt.o . We could also have some ifdef to avoid by default generating for all of [3-6]86 that would save space & time, If the directory was not filled, a user of gcc --march=i586 would then fail to link from /usr/lib/i586/ & could receive a good error, instead of a 686 crt.o with no error. > and possibly you would want to do this for > all shared libraries too. I guess we could skip those, Presuming a target system should have a matched set for the right CPU & release etc. I'm not sure about the recent plethora of lib stuff /lib Seems to be all .so so I guess not affected. /libexec ld-elf.so.1 ld-elf32.so.1 # no man ld-elf /usr/lib This is where I'd suggest sub dirs of [3-6]86 with default machine native either in top dir or perhaps a native/ sub dir, or sym linked whatever gcc & out & other projects find best ? /usr/lib32 ... Sigh ! same as above ? .. /usr/libdata /ldscripts & /lint ? /usr/libexec Presumably can ignore this as real programs. & ignore inderminent localy variant dirs shown by cd /usr/local ; find . -type d -name \*lib\* -print Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below, not above; Indent with "> "; Cumulative like a play script. Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.