This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/66232] New: -fPIC -fno-plt -mx32 fails to generate indirect branch via GOT


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

            Bug ID: 66232
           Summary: -fPIC -fno-plt -mx32 fails to generate indirect branch
                    via GOT
           Product: gcc
           Version: 6.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
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

[hjl@gnu-tools-1 plt-1]$ cat x.i
extern void bar (void);

void
foo (void)
{
  bar ();
}
[hjl@gnu-tools-1 plt-1]$ make
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -O2 -fPIC -fno-plt -mx32 -S
x.i
[hjl@gnu-tools-1 plt-1]$ cat x.s
        .file   "x.i"
        .section        .text.unlikely,"ax",@progbits
.LCOLDB0:
        .text
.LHOTB0:
        .p2align 4,,15
        .globl  foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movl    bar@GOTPCREL(%rip), %eax
        jmp     *%rax
        .cfi_endproc
.LFE0:
        .size   foo, .-foo
        .section        .text.unlikely
.LCOLDE0:
        .text
.LHOTE0:
        .ident  "GCC: (GNU) 6.0.0 20150521 (experimental)"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tools-1 plt-1]$ 

We should generate

jmp     *bar@GOTPCREL(%rip)

since GOT slot is 64-bit.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]