From patchwork Wed May 30 12:13:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 922757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92826-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="cnHbgTyz"; dkim-atps=neutral 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 40wqJB07cQz9s08 for ; Wed, 30 May 2018 22:13:45 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :mime-version:content-type; q=dns; s=default; b=tYjNEaKy7uZl8PWf 9MNKZ0Q61un+LRyuSmuDBH1jWrpw+AQQuQLeSm7d/Z5RBNQBANRxcFFX7owinEiw lc7OHybyP7EZPgYFh5l4R/HZfYlixjGalGxvYdEHBtYAcBNTg5zsIMhBlqz+wEeJ IUAbPb23myTjLI1QMQxys5/ERms= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:reply-to :mime-version:content-type; s=default; bh=7z7qy8pnHq33we6qZaFN8K MMdLg=; b=cnHbgTyzT3gbqCkKF0+akhiQNfqJRAkryVKBueonzP5E7P6pOy2aB5 /0HJPBlEefeAPNhwEx6be5XKBIU6c4FsE8p8nl4kdJsRQAMSHcIV+CgKFqD9zyzR 2GS1ScCqu4u8tQBgmIxCiYnZly4AsCp9oXAwet/h1TRS9FT0XzBkQ= Received: (qmail 106654 invoked by alias); 30 May 2018 12:13:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 92345 invoked by uid 89); 30 May 2018 12:13:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, NO_DNS_FOR_FROM autolearn=unavailable version=3.3.2 spammy= X-HELO: mga04.intel.com X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False X-ExtLoop1: 1 Date: Wed, 30 May 2018 05:13:05 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak , GNU C Library Subject: RFC: Linux/i386: Set TARGET_THREAD_SPLIT_STACK_OFFSET to 0x34 Message-ID: <20180530121305.GA43637@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.5 (2018-04-13) TARGET_THREAD_SPLIT_STACK_OFFSET has been wrong for Linux/i386 from the start. Should we change glibc for GCC's mistake or fix GCC? H.J. --- In glibc, sysdeps/i386/nptl/tls.h has typedef struct { void *tcb; /* Pointer to the TCB. Not necessarily the thread descriptor used by libpthread. */ dtv_t *dtv; void *self; /* Pointer to the thread descriptor. */ int multiple_threads; uintptr_t sysinfo; uintptr_t stack_guard; uintptr_t pointer_guard; int gscope_flag; int __glibc_reserved1; /* Reservation of some values for the TM ABI. */ void *__private_tm[4]; /* GCC split stack support. */ void *__private_ss; } tcbhead_t; Update i386 TARGET_THREAD_SPLIT_STACK_OFFSET to 0x34 to match the offset of __private_ss. PR target/85990 * config/i386/gnu-user.h (TARGET_THREAD_SPLIT_STACK_OFFSET): Set to 0x34. * config/i386/gnu-user64.h (TARGET_THREAD_SPLIT_STACK_OFFSET): Set to 0x34 for -m32. --- gcc/config/i386/gnu-user.h | 4 ++-- gcc/config/i386/gnu-user64.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h index d1dad685e72..7d061f392ea 100644 --- a/gcc/config/i386/gnu-user.h +++ b/gcc/config/i386/gnu-user.h @@ -134,6 +134,6 @@ along with GCC; see the file COPYING3. If not see /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ #define TARGET_THREAD_SSP_OFFSET 0x14 -/* We steal the last transactional memory word. */ -#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30 +/* i386 glibc provides __private_ss in %gs:0x34. */ +#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x34 #endif diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h index 491416fec0c..47d6a3bf34c 100644 --- a/gcc/config/i386/gnu-user64.h +++ b/gcc/config/i386/gnu-user64.h @@ -86,9 +86,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define TARGET_THREAD_SSP_OFFSET \ (TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14) -/* We steal the last transactional memory word. */ +/* i386 glibc provides __private_ss in %gs:0x34, + x32 glibc provides it in %fs:0x40. + x86_64 glibc provides it in %fs:0x70. */ #define TARGET_THREAD_SPLIT_STACK_OFFSET \ - (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30) + (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x34) #endif #undef WCHAR_TYPE