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

            Bug ID: 17619
           Summary: Gold fails to check PC-relative offset overflow in PLT
                    entry
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at google dot com
          Reporter: hjl.tools at gmail dot com
                CC: ian at airs dot com

On Linux/x86-64, gold fails to check PC-relative offset overflow in PLT entry:

[hjl@gnu-6 pr17618]$ cat main.c 
extern void foo (void);
extern void bar (void);

int
main ()
{
  foo ();
  bar ();
  return 0;
}
[hjl@gnu-6 pr17618]$ cat foo.S
    .section    .rodata.str1.1,"aMS",@progbits,1
.LC0:
    .string    "PASS"
    .text
    .p2align 4,,15
    .globl    foo
    .type    foo, @function
foo:
    leal    .LC0(%rip), %edi
    jmp    puts@PLT
    .size    foo, .-foo

    .p2align 4,,15
    .globl    bar
    .type    bar, @function
bar:
    jmp .L0
    .space 0x40000000, 0x90
.L0:
    jmp .L2
    .space 0x4fdfff14, 0x90
.L2:
    .size    bar, .-bar
    .section    .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr17618]$ make
gcc -mx32 -O2    -c -o main.o main.c
gcc -mx32 -O2  -fpic -c -o foo.o foo.S
./ld -m elf32_x86_64 -shared -o libfoo.so foo.o
./ld: warning: overflow in PLT unwind data; unwinding through PLT may fail
gcc -mx32 -O2  -o foo main.o libfoo.so -Wl,-R,.
./foo
make: *** [all] Segmentation fault
[hjl@gnu-6 pr17618]$

-- 
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