From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: bug#24703: Store references in 8-byte chunks in compiled code Date: Wed, 9 Nov 2016 18:16:52 -0500 Message-ID: <20161109231652.GA12060@jasmine> References: <87r37gstf6.fsf_-_@netris.org> <87d1j0sl1l.fsf@netris.org> <87a8e4glot.fsf@gnu.org> <8f2024ad-13c1-d4b1-1541-c2a5bddcb403@etorok.net> <87h98bdvng.fsf@gnu.org> <87k2d6qqee.fsf@netris.org> <20161024194022.GA1772@jasmine> <87insh1oxz.fsf@gnu.org> <87a8de7s6q.fsf@inria.fr> <87oa1o75ga.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57770) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c4c75-0001hR-5c for bug-guix@gnu.org; Wed, 09 Nov 2016 18:17:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c4c74-0002pC-6L for bug-guix@gnu.org; Wed, 09 Nov 2016 18:17:03 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:36006) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c4c74-0002om-2i for bug-guix@gnu.org; Wed, 09 Nov 2016 18:17:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <87oa1o75ga.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 24703@debbugs.gnu.org On Wed, Nov 09, 2016 at 09:40:05PM +0100, Ludovic Courtès wrote: > I read much more code than I wanted just to end up in gcc/builtins.c. > In 8033772363b287ca529461e575ceb4a69d7af942 I added a patch for GCC 5.x > and 6.x that disables the ‘movabs’ optimization for strcpy/memcpy when > the source is a string constant that contains “/gnu/store” (I followed > Mark’s advice to disable the optimization for any string that contains > “/gnu/store”, rather than just for strings that start with > “/gnu/store”.) > > This can be tested by compiling a file like this one (comment or > uncomment the lines that you want): > > --8<---------------cut here---------------start------------->8--- > #include > void foo (char *x, char *y) > { > /* memcpy(x, "this is a long string, a very long string", 42); */ > /* strcpy(x, "STRCPY THIS IS A LONG STRING, A VERY LONG STRING"); */ > strcpy(x, "STRCPY /gnu/store/THIS IS A LONG STRING, A VERY LONG STRING"); > /* __builtin_strcpy(x, "THIS IS A LONG STRING, A VERY LONG STRING"); */ > /* strcpy(y, "/gnu/store/THIS IS A LONG STRING, A VERY LONG STRING"); */ > /* memcpy(y, "MEMCPY THIS IS A LONG STRING, A VERY LONG STRING", 30); */ > memcpy(y, "MEMCPY /gnu/store/THIS IS A LONG STRING, A VERY LONG STRING", 30); > /* __builtin_memcpy(y, "/gnu/store/THIS IS A LONG STRING, A VERY LONG STRING", 30); */ > } > --8<---------------cut here---------------end--------------->8--- > > … and then running “objdump -S foo.o | grep movabs”, for instance. Awesome. Thank you! > Now we need a plan to actually fix the bug. > > The long-term goal is to rebuild everything with a compiler that has > this patch, in the next ‘core-updates’. We might as well switch to GCC > 5 as the default compiler. > > In the meantime, the only approach I can think of is to (1) ungraft more > frequently than we’ve done so far, and (2) when we ungraft a package, > add gcc@5 as an input such that it gets rebuilt without the problem. > > Thoughts? Sounds good to me. I wonder, with our current build farm, how often can we do the full rebuilds required by ungrafting? I don't yet have a sense of how long it takes.