https://sourceware.org/bugzilla/show_bug.cgi?id=18386

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
0x66 prefix should also be ignored in 64-bit mode:

[hjl@gnu-6 18386b]$ cat call.S 
        .text
        .p2align 4,,15
        .globl  bar
        .type   bar, @function
bar:
        data16 jmp      *foo_p(%rip)
        .size   bar, .-bar
[hjl@gnu-6 18386b]$ cat main.c 
#include <stdio.h>

const char* (*foo_p) (void);
const char* bar (void);

const char*
foo (void)
{
  return "PASS";
}

int
main (int argc, char **argv)
{
  foo_p = foo;
  printf("%s\n", bar ());
  printf("%p\n", foo);
  return 0;
}
[hjl@gnu-6 18386b]$ make
gcc -pie -B./  -fPIE   -c -o main.o main.c
gcc -pie -B./  -c -o call.o call.S
gcc -pie -B./  -o x main.o call.o
./x
PASS
0x56102545b6c0
[hjl@gnu-6 18386b]$ objdump -dwr call.o

call.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <bar>:
   0:   66 ff 25 00 00 00 00    jmpw   *0x0(%rip)        # 7 <bar+0x7>  3:
R_X86_64_PC32        foo_p-0x4
[hjl@gnu-6 18386b]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to