[Bug middle-end/63793] -mcmodel=medium in gfortran on x86_64 emits references that are RIP relative (instead of using the GOT)

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 14 00:33:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63793

--- Comment #12 from Iain Sandoe <iains at gcc dot gnu.org> ---
caveat: I have not examined this bug… 

.. 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= .. no-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


More information about the Gcc-bugs mailing list