From patchwork Sat Aug 18 12:40:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 959197 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=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483918-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="DxCQNLGZ"; 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 41t05v1DBBz9s4Z for ; Sat, 18 Aug 2018 22:40:17 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; q=dns; s=default; b=TrasOpUmq+Dh1hEw6SZ6 WX0ccs6U93VwAbxJ23CrnvlFsjR1o30bB8uapVeltKbNtnzV6p3DIf7EqkcAA8TW lawfJ0IxUy45AKTkBrNjdJkxGqufwmFQNqY8ZwCGrehY/dUXF9KHKiN8SWf5qrxF NWk78H5n8G6DUyOFnOY6WK4= 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:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=default; bh=MxSRgj5N2hsAAhZ1PH4gT1rhYT k=; b=DxCQNLGZ5d2Ks1GODy1naRGGQuM5njvvv82+P/lk42vD1acZEXwwKuWe28 4uhV6jhnlM9DW3/gYh9B9a41yy3HCMgjw97MLVVJtHTEQZWTywgWOQ5laclWXceh dfn+N4vSQURsH0IjKMoVZ0w/kkTNWwnjI2muGtm3hVIUXXSRE= Received: (qmail 120740 invoked by alias); 18 Aug 2018 12:40:10 -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 120731 invoked by uid 89); 18 Aug 2018 12:40:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, KAM_LAZY_DOMAIN_SECURITY, KAM_STOCKGEN autolearn=ham version=3.3.2 spammy=i386.c, i386c, UD:i386.c, Hx-spam-relays-external:ESMTPA X-HELO: smtp2.wavenetuk.net Received: from lisa.wavenetuk.net (HELO smtp2.wavenetuk.net) (195.26.37.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Aug 2018 12:40:07 +0000 Received: from euterpe-sie.home (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id 7A859600189; Sat, 18 Aug 2018 13:40:04 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH, X86] Test for MACH-O before HAVE_AS_GOTOFF_IN_DATA Message-Id: Date: Sat, 18 Aug 2018 13:40:01 +0100 Cc: Uros Bizjak , Mike Stump To: GCC Patches Hi, If we use an assembler which supports HAVE_AS_GOTOFF_IN_DATA, (e.g. a modern GAS) on Darwin, we produce wrong code because the gotoff-in-data test is conducted before the mach-o case. This should be a no-op on non-Darwin targets, since the Darwin test is guarded on #ifdef TARGET_MACHO. Bootstrapped on x86_64-linux-gnu (with 32 multilib) and on x86_64-apple-darwin10 and 16. OK for trunk? Iain gcc/ * config/i386/i386.c (ix86_output_addr_diff_elt): Move the MACH-O specific test before the one for HAVE_AS_GOTOFF_IN_DATA. --- gcc/config/i386/i386.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 3548de2169..9c8a1f0ee9 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -19768,8 +19768,6 @@ ix86_output_addr_diff_elt (FILE *file, int value, int rel) if (TARGET_64BIT || TARGET_VXWORKS_RTP) fprintf (file, "%s%s%d-%s%d\n", directive, LPREFIX, value, LPREFIX, rel); - else if (HAVE_AS_GOTOFF_IN_DATA) - fprintf (file, ASM_LONG "%s%d@GOTOFF\n", LPREFIX, value); #if TARGET_MACHO else if (TARGET_MACHO) { @@ -19778,6 +19776,8 @@ ix86_output_addr_diff_elt (FILE *file, int value, int rel) putc ('\n', file); } #endif + else if (HAVE_AS_GOTOFF_IN_DATA) + fprintf (file, ASM_LONG "%s%d@GOTOFF\n", LPREFIX, value); else asm_fprintf (file, ASM_LONG "%U%s+[.-%s%d]\n", GOT_SYMBOL_NAME, LPREFIX, value);