Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1PagKl-0007lQ-4k for mharc-grub-devel@gnu.org; Wed, 05 Jan 2011 22:16:15 -0500 Received: from [140.186.70.92] (port=50711 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PagKi-0007kx-Rc for grub-devel@gnu.org; Wed, 05 Jan 2011 22:16:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PagKh-0002JM-HG for grub-devel@gnu.org; Wed, 05 Jan 2011 22:16:12 -0500 Received: from nm8-vm0.bullet.mail.ne1.yahoo.com ([98.138.91.23]:48152) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PagKh-0002J6-B8 for grub-devel@gnu.org; Wed, 05 Jan 2011 22:16:11 -0500 Received: from [98.138.90.50] by nm8.bullet.mail.ne1.yahoo.com with NNFMP; 06 Jan 2011 03:16:10 -0000 Received: from [98.138.89.163] by tm3.bullet.mail.ne1.yahoo.com with NNFMP; 06 Jan 2011 03:16:10 -0000 Received: from [127.0.0.1] by omp1019.mail.ne1.yahoo.com with NNFMP; 06 Jan 2011 03:16:10 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 177797.59853.bm@omp1019.mail.ne1.yahoo.com Received: (qmail 85225 invoked by uid 60001); 6 Jan 2011 03:16:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1294283770; bh=s/RtNyzhc+v2eoPyMwYpvMJ+QqTFWt9ErFeastU3RXQ=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=BWWOFP6EIEA5qbP9Tk3X0X0C6r2XOrGKOD7MEJggjCw4RUc75Pc73EmLsLjLQ0/zEx7ScDCmHf/yb1GX7/q7gIufL/j12WWGeJ3ZQZMdxdkZS7JeWinOKsMTndA4GMaMGMf0nPLCgxxzqk7ZTMZoou9o6W2V3i558ewoFPPbu1Q= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=4l42lmGi8Yf7YJ7XSr0rQvV2O1djpytmNi8V87H5+SZwD0BoVAuf24/se4HCbLHuYc8YmT2CM1hIUNYOWj5u+jFUiuNLUQcxCtp3mBkt2sB8vRokk3lGiT9Dok2uldZlzB8NpHCbzfSgCgZaVEKKWxyLX2dijAHV3OTAjZ38FO8=; Message-ID: <98959.84179.qm@web120309.mail.ne1.yahoo.com> X-YMail-OSG: YQbiluwVM1lmD084lvIRdeSWL8_hK8juTMbgx12ttCOGSu1 j2bhKnXGgCilzuGPIZDGXHf6lOmBq6rnBILEYwAeXsIJgpdDKnYEsz9ZhFI0 VFZRNeGIomNem72R1ZXx.LX8CMySQFlJeOmPWl5NVU6izuVVaXrcCV0Jzaj8 b38aHWHAVBLyfyNNsAV14tq9iSbXFpgb4u5JQewpcJL8qFkI.x7EHrRCWNrD 1qCxUSpbt0vWnlLCLFQ-- Received: from [180.68.85.212] by web120309.mail.ne1.yahoo.com via HTTP; Wed, 05 Jan 2011 19:16:09 PST X-Mailer: YahooMailRC/553 YahooMailWebService/0.8.107.285259 References: <201101060307.p0637i3J056355@m5p.com> Date: Wed, 5 Jan 2011 19:16:09 -0800 (PST) From: crocket To: The development of GNU GRUB In-Reply-To: <201101060307.p0637i3J056355@m5p.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Subject: Re: Small PIC Fixes X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jan 2011 03:16:14 -0000 I am "he" for your information. Don't expect anything from "she", sir. ----- Original Message ---- From: "ehem+grub@m5p.com" To: The development of GNU GRUB Sent: Thu, January 6, 2011 12:07:44 PM Subject: Re: Small PIC Fixes >From: Vladimir '?-coder/phcoder' Serbinenko > On 01/05/2011 06:58 AM, ehem+grub@m5p.com wrote: > > Perhaps not the biggest deal, but I do like to get low-hanging fixes out > > of the way if they appear. > > > > One very significant item I found. It appears GCC is fine with %rbx being > > clobbered when building PIC in 64-bit mode, even though it has problems > > with %ebx being clobbered when building PIC in 32-bit mode. > This patch only increases the number of possible ways preprocessor > defines can be resolved, which in turn increases the maintenance cost. > Restoring %ebx/%rbx unconditionally is cheap. Maintaining exponentially > growing number of the way #if's can be resolved isn't. > I don't see any problem to enduser with these 2 small instructions > always being there. Please point to where the number of ways the preprocessor defines can be resolved has increased. I did switch the direction of two cases (APPLE_CC and __x86_64__ defined; plus __pic__ defined, but APPLE_CC undefined), but those two cases already existed. > > One other item I did notice. Are there really any processors in the amd64 > > class that *don't* support CPUID? I'd like to hardcode > > grub_cpu_is_cpuid_supported() to return 1 if __x86_64__ is defined, but > > I'm a tad worried I'll be unpleasantly surprised. > Similar problems. Maintaining something that is always the same is > easier than something with loads of #if's. Great, I concur. Notice how the patch rips out *12* #if/#else/#endif blocks, and replaces all of them with *1* #if/#else/#endif block that completely lacks any nesting! Making more systems run over a piece of code will merely provide more testing for the common case; it won't increase testing of the uncommon case, alas that is by *far* the more valuable testing since that is where bugs tend to show up. In the case of grub_cpu_is_cpuid_supported(), unless you specifically know of an amd64-class processor that lacks the cpuid instruction, attempting to maintain the extra code means more time spent there for no gain. Worse, copy&paste code is pretty well a magnet for bugs from typos or missing a varient somewhere, and it makes any attempt at coverage testing impossible (since no machine exists to test it). > Rule of thumb is: "if it works and your improvement isn't visible to any > enduser, don't touch it". Well, "crocket" managed to uncover the situation. The situation of attempting to build -fpic might rarely come up, but s/he managed to find it. I doubt the patch covers everything needed to make -fpic work, but it takes a few steps in that direction. If you want to criticize, criticize for lack of checking before sending the patch (revised patch attached). -- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | EHeM@gremlin.m5p.com PGP F6B23DE0 | ) / \_CS\ | _____ -O #include O- _____ | / _/ 2477\___\_|_/DC21 03A0 5D61 985B <-PGP-> F2BE 6526 ABD2 F6B2\_|_/___/3DE0