From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21624 invoked by alias); 14 Nov 2014 00:33:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 21573 invoked by uid 48); 14 Nov 2014 00:33:26 -0000 From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/63793] -mcmodel=medium in gfortran on x86_64 emits references that are RIP relative (instead of using the GOT) Date: Fri, 14 Nov 2014 00:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01169.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D63793 --- Comment #12 from Iain Sandoe --- caveat: I have not examined this bug=E2=80=A6=20 .. but I have the following patch in my Q (solves a problem when GAS is the assembler). This should not fire unless the configuration says that the assembler supports gotoff in data (which GAS does, of course) Otherwise, I'm not aware of any darwin-specific support for mcmodel=3D .. n= o-one has had time to look at it ... .. if the patch makes a difference, look for a config error. --- gcc_assert (!TARGET_64BIT); #endif /* We can't use @GOTOFF for text labels on VxWorks; see gotoff_operand. = */ 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) { fprintf (file, ASM_LONG "%s%d-", LPREFIX, value); machopic_output_function_base_name (file); 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); } /* Generate either "mov $0, reg" or "xor reg, reg", as appropriate >>From gcc-bugs-return-466698-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Nov 14 00:36:03 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 25417 invoked by alias); 14 Nov 2014 00:36:03 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 25349 invoked by uid 48); 14 Nov 2014 00:35:59 -0000 From: "howarth at bromo dot med.uc.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/63793] -mcmodel=medium in gfortran on x86_64 emits references that are RIP relative (instead of using the GOT) Date: Fri, 14 Nov 2014 00:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: howarth at bromo dot med.uc.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg01170.txt.bz2 Content-length: 1376 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63793 --- Comment #13 from howarth at bromo dot med.uc.edu --- (In reply to howarth from comment #11) > FYI, the darwin linker developer had the following comments on @GOTOFF.. > > > This may be a red herring. > > > > @GOTOFF is a different concept. IIRC, the ELF runtime sets of RBX to point > > to the GOT table. @GOTOFF is for accessing variables that are a (link time) > > fixed offset in the GOT table. > > > > Darwin does not support @GOTOFF at all. Local variables are accessed > > RIP-rel, or if large, indirectly via @GOT. > > However, outside of the sections of gcc/config/i386/i386.[c/md] conditional > on HAVE_AS_GOTOFF_IN_DATA, I don't see any other obvious places where %rip > would be emitted for Mach-O but not linux. Empirically, it seems logical that this bug should be in the section conditional on HAVE_AS_GOTOFF_IN_DATA because the problematic symbol with the core name sumpartgrid shows up as in a grep of the assembly as... movabsq $sumpartgrid.3500@GOTOFF, %rax on linux, while on darwin it shows up as leaq _sumpartgrid.2471(%rip), %rax I am assuming that the emission of @GOTOFF on linux is entirely under the control of the HAVE_AS_GOTOFF_IN_DATA conditional and thus should point us at the section that needs to be enhanced to use &GOT on darwin for -mcmodel=medium/large.