[PATCH, X86] Test for MACH-O before HAVE_AS_GOTOFF_IN_DATA
Iain Sandoe
iain@sandoe.co.uk
Sat Aug 18 12:40:00 GMT 2018
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);
--
2.17.1
More information about the Gcc-patches
mailing list