From patchwork Tue Apr 9 14:34:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bruel X-Patchwork-Id: 235104 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 84BD12C00B9 for ; Wed, 10 Apr 2013 00:34:57 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=rhZYe/Ry+1LPKrWh7n3HzNAK3GojiIfbEf1p/JaWGZU fwFBfA17wmSFIU0ugWTZtIFN0ostBnI990uVI77u8ormZv/3hnf/ps6+q5Gc0Gng rFpf8Jl5dcV4e2z75FcWsOwAPmkAlI9NkrwbNLnMpm91qKfb613G4gbskm4OruFs = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=E7v0+wbfY/jEcBgLAQQTx6Mp/Zk=; b=H9FbBy1lzc0iO9eXD V0mpDdp/M0wRc46s5FgmhSgxA7a4wvgRG/F+aVzC5Sc2r5GPvyEfqsQ3m5mk9ASO I7kZ22u95CQ5K7RvIbtV9NTnpMXOTPEaxlUOiHAOqbui0eeies4c7FAShFXgqGTD HqQ1Di8n+HlhnKeJ4voE1rm0Kk= Received: (qmail 27491 invoked by alias); 9 Apr 2013 14:34:51 -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 27482 invoked by uid 89); 9 Apr 2013 14:34:51 -0000 X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from eu1sys200aog123.obsmtp.com (HELO eu1sys200aog123.obsmtp.com) (207.126.144.155) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 09 Apr 2013 14:34:50 +0000 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob123.postini.com ([207.126.147.11]) with SMTP ID DSNKUWQnBQVj4Moe76AKYlO037ZMup3jDktp@postini.com; Tue, 09 Apr 2013 14:34:49 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7612219E; Tue, 9 Apr 2013 14:34:44 +0000 (GMT) Received: from Webmail-eu.st.com (safex1hubcas6.st.com [10.75.90.73]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E9E21556E; Tue, 9 Apr 2013 14:34:41 +0000 (GMT) Received: from [164.129.122.89] (164.129.122.89) by webmail-eu.st.com (10.75.90.13) with Microsoft SMTP Server (TLS) id 8.3.279.5; Tue, 9 Apr 2013 16:34:43 +0200 Message-ID: <51642702.5090204@st.com> Date: Tue, 9 Apr 2013 16:34:42 +0200 From: Christian Bruel User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" Cc: Kaz Kojima Subject: [PATCH SH] Error: unaligned opcodes detected in executable segment X-Virus-Found: No Hello, This patch fixes label alignments after a ADDR_DIFF_VEC with byte offsets. The bug occurs with building the libgcc for a sh-elf target. See a reduced case here. The funny thing is that the assembly error given in Subject appears only on a debug section when compiled with -g, thus the emitted code without -g: .align 2 .L4: .byte .L3-.L5 .byte .L10-.L5 .byte .L7-.L5 .byte .L8-.L5 .byte .L9-.L5 .L3: mov.l .L13,r1 assembles silently, although unaligned... OK for trunk ? The failure occurs with the libgcc, so tested by allowing the sh-elf build to complete. Thanks, Christian 2013-04-09 Christian Bruel * config/sh/sh.md (barrier_align): Use next/prev_active_insn instead of next/prev_real_insn. Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 197633) +++ gcc/config/sh/sh.c (working copy) @@ -5842,7 +5842,7 @@ fixup_addr_diff_vecs (rtx first) int barrier_align (rtx barrier_or_label) { - rtx next = next_real_insn (barrier_or_label), pat, prev; + rtx next = next_active_insn (barrier_or_label), pat, prev; if (! next) return 0; @@ -5856,7 +5856,7 @@ barrier_align (rtx barrier_or_label) /* This is a barrier in front of a constant table. */ return 0; - prev = prev_real_insn (barrier_or_label); + prev = prev_active_insn (barrier_or_label); if (GET_CODE (PATTERN (prev)) == ADDR_DIFF_VEC) { pat = PATTERN (prev);