From patchwork Thu Dec 30 02:11:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Koning X-Patchwork-Id: 76958 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]) by ozlabs.org (Postfix) with SMTP id 1C45EB6EF1 for ; Thu, 30 Dec 2010 13:12:07 +1100 (EST) Received: (qmail 14168 invoked by alias); 30 Dec 2010 02:12:05 -0000 Received: (qmail 14156 invoked by uid 22791); 30 Dec 2010 02:12:03 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from ausc60pc101.us.dell.com (HELO ausc60pc101.us.dell.com) (143.166.85.206) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Dec 2010 02:11:57 +0000 X-Loopcount0: from 10.152.240.141 From: Paul Koning Subject: [PATCH] pdp11: Fix misaligned variables Date: Wed, 29 Dec 2010 21:11:36 -0500 Message-Id: To: gcc-patches Mime-Version: 1.0 (Apple Message framework v1082) X-IsSubscribed: yes 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 The assembly output for common and local variables wasn't forcing even byte alignment when required, causing execution failures due to alignment exceptions. Fixed by this patch. Checked by build and make check of selected testcases. Committed. paul ChangeLog: 2010-12-29 Paul Koning * config/pdp11/pdp11-protos.h (pdp11_asm_output_var): Declare. * config/pdp11/pdp11.c (pdp11_asm_output_var): New function. * config/pdp11/pdp11.h (ASM_OUTPUT_ALIGNED_COMMON, ASM_OUTPUT_ALIGNED_LOCAL): New macros. (ASM_OUTPUT_COMMON, ASM_OUTPUT_LOCAL): Delete. Index: config/pdp11/pdp11-protos.h =================================================================== --- config/pdp11/pdp11-protos.h (revision 168294) +++ config/pdp11/pdp11-protos.h (working copy) @@ -44,3 +44,4 @@ #endif /* RTX_CODE */ extern void output_ascii (FILE *, const char *, int); +extern void pdp11_asm_output_var (FILE *, const char *, int, int, bool); Index: config/pdp11/pdp11.c =================================================================== --- config/pdp11/pdp11.c (revision 168294) +++ config/pdp11/pdp11.c (working copy) @@ -716,6 +716,19 @@ void +pdp11_asm_output_var (FILE *file, const char *name, int size, + int align, bool global) +{ + if (align > 8) + fprintf (file, "\n\t.even\n"); + fprintf (file, ".globl "); + assemble_name (file, name); + fprintf (file, "\n"); + assemble_name (file, name); + fprintf (file, ": .=.+ %#ho\n", (unsigned short)size); +} + +void print_operand_address (FILE *file, register rtx addr) { register rtx breg; Index: config/pdp11/pdp11.h =================================================================== --- config/pdp11/pdp11.h (revision 168294) +++ config/pdp11/pdp11.h (working copy) @@ -648,20 +648,15 @@ /* This says how to output an assembler line to define a global common symbol. */ -#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ -( fprintf ((FILE), ".globl "), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), "\n"), \ - assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ": .=.+ %#ho\n", (unsigned short)(ROUNDED)) \ -) +#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ + pdp11_asm_output_var (FILE, NAME, SIZE, ALIGN, true) + /* This says how to output an assembler line to define a local common symbol. */ -#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ -( assemble_name ((FILE), (NAME)), \ - fprintf ((FILE), ":\t.=.+ %#ho\n", (unsigned short)(ROUNDED))) +#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ + pdp11_asm_output_var (FILE, NAME, SIZE, ALIGN, false) /* Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.