From patchwork Wed Feb 1 23:36:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 722709 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vDKJm4wzdz9s0g for ; Thu, 2 Feb 2017 10:36:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OIGaztU4"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; q=dns; s=default; b=aQFqjBstpfMaOB3U6t l4mFnRM8xivHRK48WKNBZWzj9pqf4Dty9kiNyM7+HPO/gGEJpK9RaZc0c2LKPQNO bPh88HCERrY/FF12e6zwtVq/4atRl1vS2g/RJBLLhCaiiZRGGyYVo5WXgb+JvMBq EBQT0RUBeWfxzlY04kwoj1gzE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; s=default; bh=U1eyTrATXESNhDmDifIflrOX 3fI=; b=OIGaztU4Sfv9RRiOk5MWitc5oNGtmzyIc/bXb84ktoxgGKzAraA3O0Vh T4kGEY8U7ju+mb6jMlNbNOlMtPBF6GIlrG9SI6itJBNPcRMiz1b4V+Otvi96MBv+ +Srlu8t4JN865imkyVMfEAPH17aohSbV60TFDi/lX8IJIHvX9OQ= Received: (qmail 7933 invoked by alias); 1 Feb 2017 23:36:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 7919 invoked by uid 89); 1 Feb 2017 23:36:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=no version=3.3.2 spammy=stats, iant@golang.org, uintptr, iantgolangorg X-HELO: mail-it0-f47.google.com Received: from mail-it0-f47.google.com (HELO mail-it0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Feb 2017 23:36:04 +0000 Received: by mail-it0-f47.google.com with SMTP id c7so29641002itd.1 for ; Wed, 01 Feb 2017 15:36:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=fCpkbQ+MVOEjhTjRJGPhNZRoBLAfVCmOKwPUUTfuS3c=; b=gA6WopaZAlasDwRhj6guQxJKj/ReK8Jp6XXhTUS661MKu+eG1lKBgFev5cL9HpbRex jrNSLeQOYH/FeKf5V9oi29GtnEJR1XohQdmfv7ZtnWjxGX6Q0i6JqsjqyiAtYA+ozO5b xYTabtZuhX+V38BmzOHHNgrG1shnSXWRtS+1C+/Gc2hGEieasOYSemLP7bMYJZyWVHxe Quj4woxs+PaZyEV+Ce4s+dh0IJRunLlemSqPcVPIlcFnogFXGT6e2blgacyCRLpJdGUQ 0qLtZrACfCnpTY49xyiXnHSKFhkoZUf0EP/0316GaXwbfZJoVAVYudeo0OKI3dSggGx0 skbA== X-Gm-Message-State: AIkVDXIi7kKl0qrW9/CwliXcY0cZUFrnIoeMbiAip9mEtFC9dl61JStan3CUJ+MzFsWiDS8JPCpnNSRMWAJfGw== X-Received: by 10.36.207.212 with SMTP id y203mr4156075itf.63.1485992163127; Wed, 01 Feb 2017 15:36:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.19.241 with HTTP; Wed, 1 Feb 2017 15:36:02 -0800 (PST) In-Reply-To: References: From: Ian Lance Taylor Date: Wed, 1 Feb 2017 15:36:02 -0800 Message-ID: Subject: Re: Go patch committed: Fixes for m68k To: gcc-patches , "gofrontend-dev@googlegroups.com" On Mon, Jan 23, 2017 at 10:15 AM, Ian Lance Taylor wrote: > I committed a patch to the Go frontend and libgo to fix alignment > issues on m68k. This fixes PR 79037. Bootstrapped and ran Go tests > on x86_64-pc-linux-gnu. Tested by John Paul Adrian Glaubitz on > m68k-linux-gnu. Committed to mainline. Now also committed to GCC 6 branch, as follows. Ian Index: gcc/go/gofrontend/types.cc =================================================================== --- gcc/go/gofrontend/types.cc (revision 245107) +++ gcc/go/gofrontend/types.cc (working copy) @@ -2175,11 +2175,26 @@ is_common = true; } + // The current garbage collector requires that the GC symbol be + // aligned to at least a four byte boundary. See the use of PRECISE + // and LOOP in libgo/runtime/mgc0.c. + int64_t align; + if (!sym_init->type()->backend_type_align(gogo, &align)) + go_assert(saw_errors()); + if (align < 4) + align = 4; + else + { + // Use default alignment. + align = 0; + } + // Since we are building the GC symbol in this package, we must create the // variable before converting the initializer to its backend representation // because the initializer may refer to the GC symbol for this type. this->gc_symbol_var_ = - gogo->backend()->implicit_variable(sym_name, sym_btype, false, true, is_common, 0); + gogo->backend()->implicit_variable(sym_name, sym_btype, false, true, + is_common, align); if (phash != NULL) *phash = this->gc_symbol_var_; Index: libgo/runtime/go-unsafe-pointer.c =================================================================== --- libgo/runtime/go-unsafe-pointer.c (revision 245107) +++ libgo/runtime/go-unsafe-pointer.c (working copy) @@ -36,7 +36,8 @@ sizeof REFLECTION - 1 }; -const uintptr unsafe_Pointer_gc[] = {sizeof(void*), GC_APTR, 0, GC_END}; +const uintptr unsafe_Pointer_gc[] __attribute__((aligned(4))) = + {sizeof(void*), GC_APTR, 0, GC_END}; const struct __go_type_descriptor unsafe_Pointer = { Index: libgo/runtime/parfor.c =================================================================== --- libgo/runtime/parfor.c (revision 245107) +++ libgo/runtime/parfor.c (working copy) @@ -10,7 +10,7 @@ struct ParForThread { // the thread's iteration space [32lsb, 32msb) - uint64 pos; + uint64 pos __attribute__((aligned(8))); // stats uint64 nsteal; uint64 nstealcnt; Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 245109) +++ libgo/runtime/runtime.h (working copy) @@ -431,7 +431,7 @@ // otherwise parfor may return while other threads are still working ParForThread *thr; // array of thread descriptors // stats - uint64 nsteal; + uint64 nsteal __attribute__((aligned(8))); // force alignment for m68k uint64 nstealcnt; uint64 nprocyield; uint64 nosyield;