http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60151

            Bug ID: 60151
           Summary: HAVE_AS_GOTOFF_IN_DATA is mis-detected on x86-64
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
                CC: ubizjak at gmail dot com

i386.h has

/* Under some conditions we need jump tables in the text section,
   because the assembler cannot handle label differences between
   sections.  This is the case for x86_64 on Mach-O for example.  */

#define JUMP_TABLES_IN_TEXT_SECTION \
  (flag_pic && ((TARGET_MACHO && TARGET_64BIT) \
   || (!TARGET_64BIT && !HAVE_AS_GOTOFF_IN_DATA)))

HAVE_AS_GOTOFF_IN_DATA is only used for 32-bit PIC.  However,
configure.ac has

    gcc_GAS_CHECK_FEATURE([GOTOFF in data],
        gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
[       .text
.L0:
        nop
        .data
        .long .L0@GOTOFF])
    AC_DEFINE_UNQUOTED(HAVE_AS_GOTOFF_IN_DATA,

On Linux/x86-64, we get

configure:25031: checking assembler for GOTOFF in data
configure:25048: /usr/local/bin/as --64  -o conftest.o conftest.s >&5
conftest.s: Assembler messages:
conftest.s:5: Error: 8-byte relocation cannot be applied to 4-byte field
configure:25051: $? = 1
configure: failed program was
        .text
.L0:
        nop
        .data
        .long .L0@GOTOFF
configure:25062: result: no

On Linux/i686, we get

configure:25026: checking assembler for GOTOFF in data
configure:25043: /usr/local32/bin/as --32  -o conftest.o conftest.s >&5
configure:25046: $? = 0
configure:25057: result: yes

As the result, we put jump table in .text section for -m32 -fPIC
on Linux/x86-64.

Reply via email to