From patchwork Tue Nov 5 14:00:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 288529 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 52B712C025E for ; Wed, 6 Nov 2013 01:02:12 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Cnoiwit/q7EEsfjIJYgeV0lkaRo7gzbxvSG1bb8pFDJFjqCfA53oj odfTsnIxEd49AmbdKgNurgNjIZr3qlD5e+AIyPxb+GNUmLj4LAIZ286L73RwThnM c9V48LPtV+nyQVFQzZN7l+TnwP4S9JYjymr6Mxl+soNTqyiaXnh5U8= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=e2T3qfvhNNvudbg4U0ga48GYLSw=; b=T0rmaPsy/BMZpISMuvKI oG/j3fLIsLJyorvD0v31UtzKwid3MIdgMsG+Hyoa+zJ1HZHBPn09+P1qvYdPgYWr 5UfUCRO5PeLhmhIOs2PuhdyVcLreG4YDXWh0XhVFXKjGm0b3M4NpqDoPbNiCWrMZ UxPPKuGwf4l5jFcWgoSYIoY= Received: (qmail 16986 invoked by alias); 5 Nov 2013 14:00:58 -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 16970 invoked by uid 89); 5 Nov 2013 14:00:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-gg0-f175.google.com Received: from Unknown (HELO mail-gg0-f175.google.com) (209.85.161.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 05 Nov 2013 14:00:16 +0000 Received: by mail-gg0-f175.google.com with SMTP id i1so3133903ggn.20 for ; Tue, 05 Nov 2013 06:00:08 -0800 (PST) X-Received: by 10.236.198.45 with SMTP id u33mr18456594yhn.37.1383660008187; Tue, 05 Nov 2013 06:00:08 -0800 (PST) Received: from gnu-tools-1.localdomain (76-220-57-190.lightspeed.sntcca.sbcglobal.net. [76.220.57.190]) by mx.google.com with ESMTPSA id w8sm36240102yhg.8.2013.11.05.06.00.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Nov 2013 06:00:07 -0800 (PST) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id B2D1D40738; Tue, 5 Nov 2013 06:00:05 -0800 (PST) Date: Tue, 5 Nov 2013 06:00:05 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org, konstantin.s.serebryany@gmail.com Subject: [PATCH 3/4] Use 64-bit system types for x86-64 Message-ID: <20131105140005.GB16493@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes x32 uses the same file system calls as x86-64. This patch fixes it for x32. Tested on x32, x86-64 and x86. Please install it. Thanks. H.J. --- libsanitizer/ChangeLog.x32 | 14 ++++++++++++++ .../sanitizer_common/sanitizer_platform_limits_linux.cc | 2 +- .../sanitizer_common/sanitizer_platform_limits_posix.h | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/libsanitizer/ChangeLog.x32 b/libsanitizer/ChangeLog.x32 index 40b185d..51d0fd4 100644 --- a/libsanitizer/ChangeLog.x32 +++ b/libsanitizer/ChangeLog.x32 @@ -1,5 +1,19 @@ 2013-11-05 H.J. Lu + * sanitizer_common/sanitizer_platform_limits_linux.cc + (struct_kernel_stat64_sz): Initialize to 0 if __x86_64__ is + defined. + * sanitizer_common/sanitizer_platform_limits_posix.h + (__sanitizer_dirent): Use 64-bit d_ino/d_off if __x86_64__ is + defined. + (__sanitizer___kernel_uid_t): Typedef as unsigned if __x86_64__ + is defined. + (__sanitizer___kernel_gid_t): Likewise. + (__sanitizer___kernel_off_t): Typedef as long long if __x86_64__ + is defined. + +2013-11-05 H.J. Lu + * sanitizer_common/sanitizer_linux.cc (internal_clone): Allocate 2 64-bit integers to save and restore fn and arg. Properly load newtls/child_tidptr into r8/r10. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc index fbea596..9870243 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc @@ -31,7 +31,7 @@ namespace __sanitizer { unsigned struct_io_event_sz = sizeof(struct io_event); unsigned struct_iocb_sz = sizeof(struct iocb); -#ifndef _LP64 +#if !defined(_LP64) && !defined(__x86_64__) unsigned struct_kernel_stat64_sz = sizeof(struct stat64); #else unsigned struct_kernel_stat64_sz = 0; diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index 007b4ec..67c459c 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -133,7 +133,7 @@ namespace __sanitizer { unsigned short d_reclen; // more fields that we don't care about }; -#elif SANITIZER_ANDROID +#elif SANITIZER_ANDROID || defined(__x86_64__) struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_off; @@ -159,16 +159,17 @@ namespace __sanitizer { #endif #if SANITIZER_LINUX -#ifdef _LP64 +#if defined(_LP64) || defined(__x86_64__) typedef unsigned __sanitizer___kernel_uid_t; typedef unsigned __sanitizer___kernel_gid_t; + typedef long long __sanitizer___kernel_off_t; #else typedef unsigned short __sanitizer___kernel_uid_t; typedef unsigned short __sanitizer___kernel_gid_t; + typedef long __sanitizer___kernel_off_t; #endif typedef unsigned short __sanitizer___kernel_old_uid_t; typedef unsigned short __sanitizer___kernel_old_gid_t; - typedef long __sanitizer___kernel_off_t; typedef long long __sanitizer___kernel_loff_t; typedef struct { unsigned long fds_bits[1024 / (8 * sizeof(long))];