From patchwork Wed Jun 27 19:47:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai Tietz X-Patchwork-Id: 167733 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 DFBD61007D2 for ; Thu, 28 Jun 2012 05:48:11 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341431293; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:Date:Message-ID:Subject:From:To: Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=755sr/8 WoNU6mMrgnmy+ZaL4oOY=; b=NMXJsD+ZVDOaAXNZ+A6cGVyUQWzXj35bD547h+S aoj9/UTZgY6I0vpRuxZTMwS0ER7v9ZF2QK+RCqApMhxJxK/1+GucQs6n7VMLhYnA fqB4LKv7ibQt+I/Dm1Fo7iLg3MihrNCORFqkwFuT5t8m+KQAzs0olpmyFY+WelOm +2CY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=J4Nbd3oWUJgtMBfN0rLmS8jiT5whUHkeI0qzokctROri+hJ6SOEpgS/IwJOEJn BGcFFfmPaf7v9ajle+X+pQaiAl2BXhJrx4+zsVGH7UcPFwsZWaVocIIZ2rRC5SwP fOYXZ9OFYca+xvkCLRBi9rHj1rCGnPLtD7//qeprK2D44=; Received: (qmail 31866 invoked by alias); 27 Jun 2012 19:48:08 -0000 Received: (qmail 31857 invoked by uid 22791); 27 Jun 2012 19:48:07 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jun 2012 19:47:53 +0000 Received: by wgbed3 with SMTP id ed3so1139934wgb.8 for ; Wed, 27 Jun 2012 12:47:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.98.69 with SMTP id eg5mr7315996wib.3.1340826472302; Wed, 27 Jun 2012 12:47:52 -0700 (PDT) Received: by 10.216.16.21 with HTTP; Wed, 27 Jun 2012 12:47:51 -0700 (PDT) Date: Wed, 27 Jun 2012 21:47:51 +0200 Message-ID: Subject: [patch i386]: always allow for pe-coff that relocations can be put into readonly memory From: Kai Tietz To: GCC Patches Cc: Richard Henderson 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 Hello, this patch makes sure that for pe(+)-coff targets always relocations are allowed in readonly memory. This fixes for x86_64-w64-mingw32 target some testcases. ChangeLog 2012-06-27 Kai Tietz * config/i386/winnt.c (i386_pe_reloc_rw_mask): New function. * config/i386/i386-protos.h (i386_pe_reloc_rw_mask): Add prototype. * config/i386/cygming.h (TARGET_ASM_RELOC_RW_MASK): Define as i386_pe_reloc_rw_mask. Tested for i686-pc-cygwin, i686-w64-mingw32, and x86_64-w64-mingw32. Ok for apply? Regards, Kai Index: config/i386/winnt.c =================================================================== --- config/i386/winnt.c (revision 189009) +++ config/i386/winnt.c (working copy) @@ -421,6 +421,14 @@ DECL_SECTION_NAME (decl) = build_string (len, string); } +/* Local and global relocs can be placed always into readonly memory for + memory for PE-COFF targets. */ +int +i386_pe_reloc_rw_mask (void) +{ + return 0; +} + /* Select a set of attributes for section NAME based on the properties of DECL and whether or not RELOC indicates that DECL's initializer might contain runtime relocations. Index: config/i386/i386-protos.h =================================================================== --- config/i386/i386-protos.h (revision 189009) +++ config/i386/i386-protos.h (working copy) @@ -264,6 +264,8 @@ extern bool i386_pe_type_dllimport_p (tree); extern bool i386_pe_type_dllexport_p (tree); +extern int i386_pe_reloc_rw_mask (void); + extern rtx maybe_get_pool_constant (rtx); extern char internal_label_prefix[16]; Index: config/i386/cygming.h =================================================================== --- config/i386/cygming.h (revision 189009) +++ config/i386/cygming.h (working copy) @@ -225,6 +225,11 @@ #define SUBTARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info +/* Local and global relocs can be placed always into readonly memory + for PE-COFF targets. */ +#undef TARGET_ASM_RELOC_RW_MASK +#define TARGET_ASM_RELOC_RW_MASK i386_pe_reloc_rw_mask + /* Output a common block. */ #undef ASM_OUTPUT_ALIGNED_DECL_COMMON #define ASM_OUTPUT_ALIGNED_DECL_COMMON \