From patchwork Wed May 15 20:37:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 244176 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 B92882C00AB for ; Thu, 16 May 2013 06:37:27 +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 :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=R0Sk3uaEjuM4o5fjx1 l5GYuEg993X/23MfaqvANf76ETzpCfcOJyN5YuKNglHYzmURVsIF8HZsnbDoTpP8 BnwMLa+/PRL/SpPiGDF4OVKNLTwoIH7sKukXjAHxdcqgmYmlX4LQzSfUnOySvL+A NeT3ulhvqQy8RPjN+zztU5CKA= 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:date:message-id:subject :from:to:cc:content-type; s=default; bh=w4ppNa2UjHtMADQ56wV28Ed7 ZzQ=; b=D4a/DGSM34NK2s8+bgPY8tnYDMJZBfbbDFMPtizd3TL9s7xPRwXS+ujN CbZdqoH9Vj3pP8nSiCSFsRmyzPIGtIjwfZuC+3hNYfrhntbzE4LKNqJ1FhLFt1yG RajJfhzc9GIJFSZPRlH3bKDVMsXIjAI5HTGZOLQ6NMnIX6AgtF8= Received: (qmail 4204 invoked by alias); 15 May 2013 20:37:20 -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 4193 invoked by uid 89); 15 May 2013 20:37:20 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-pb0-f42.google.com (HELO mail-pb0-f42.google.com) (209.85.160.42) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 15 May 2013 20:37:19 +0000 Received: by mail-pb0-f42.google.com with SMTP id up7so1697562pbc.1 for ; Wed, 15 May 2013 13:37:18 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.68.180.4 with SMTP id dk4mr40113108pbc.104.1368650238062; Wed, 15 May 2013 13:37:18 -0700 (PDT) Received: by 10.70.10.34 with HTTP; Wed, 15 May 2013 13:37:18 -0700 (PDT) In-Reply-To: References: <01C0CBB0EEA14756825F357E55849BFE@AMDP6> Date: Wed, 15 May 2013 22:37:18 +0200 Message-ID: Subject: Re: Using GS for TLS on x86-64 for target RDOS From: Uros Bizjak To: Leif Ekblad Cc: Michael Matz , "gcc-patches@gcc.gnu.org" X-Virus-Found: No On Wed, May 15, 2013 at 9:00 PM, Leif Ekblad wrote: > I made the suggested changes, and enclose a new patch. <...> > It's been tested with target RDOS, but not with target Linux. > > Uros, could you commit the patch if it is acceptable? I have committed attached patch with following ChangeLog: 2013-05-15 Leif Ekblad * config/i386/i386.c (ix86_decompose_address): Use DEFAULT_TLS_SEG_REG to access TLS segment register. * config/i386/i386.h (DEFAULT_TLS_SEG_REG): New define. * config/i386/rdos.h (DEFAULT_TLS_SEG_REG): Ditto. (TARGET_TLS_DIRECT_SEG_REFS_DEFAULT): Ditto. Patch was also tested on x86_64-pc-linux-gnu {,-m32}. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 198944) +++ config/i386/i386.c (working copy) @@ -11698,7 +11698,7 @@ ix86_decompose_address (rtx addr, struct ix86_addr if (XINT (op, 1) == UNSPEC_TP && TARGET_TLS_DIRECT_SEG_REFS && seg == SEG_DEFAULT) - seg = TARGET_64BIT ? SEG_FS : SEG_GS; + seg = DEFAULT_TLS_SEG_REG; else return 0; break; @@ -13650,7 +13650,7 @@ ix86_delegitimize_tls_address (rtx orig_x) if (GET_CODE (x) != PLUS || GET_MODE (x) != Pmode) return orig_x; if (ix86_decompose_address (x, &addr) == 0 - || addr.seg != (TARGET_64BIT ? SEG_FS : SEG_GS) + || addr.seg != DEFAULT_TLS_SEG_REG || addr.disp == NULL_RTX || GET_CODE (addr.disp) != CONST) return orig_x; Index: config/i386/i386.h =================================================================== --- config/i386/i386.h (revision 198944) +++ config/i386/i386.h (working copy) @@ -543,6 +543,9 @@ extern tree x86_mfence; /* The default abi used by target. */ #define DEFAULT_ABI SYSV_ABI +/* The default TLS segment register used by target. */ +#define DEFAULT_TLS_SEG_REG (TARGET_64BIT ? SEG_FS : SEG_GS) + /* Subtargets may reset this to 1 in order to enable 96-bit long double with the rounding mode forced to 53 bits. */ #define TARGET_96_ROUND_53_LONG_DOUBLE 0 Index: config/i386/rdos.h =================================================================== --- config/i386/rdos.h (revision 198944) +++ config/i386/rdos.h (working copy) @@ -21,6 +21,12 @@ along with GCC; see the file COPYING3. If not see #undef TARGET_EXECUTABLE_SUFFIX #define TARGET_EXECUTABLE_SUFFIX ".exe" +#undef TARGET_TLS_DIRECT_SEG_REFS_DEFAULT +#define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT MASK_TLS_DIRECT_SEG_REFS + +#undef DEFAULT_TLS_SEG_REG +#define DEFAULT_TLS_SEG_REG SEG_GS + #undef TARGET_RDOS #define TARGET_RDOS 1