bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/17618] New: Linker fails to check PC-relative offset overflow in


From: hjl.tools at gmail dot com
Subject: [Bug ld/17618] New: Linker fails to check PC-relative offset overflow in PLT entry
Date: Tue, 18 Nov 2014 18:37:18 +0000

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

            Bug ID: 17618
           Summary: Linker fails to check PC-relative offset overflow in
                    PLT entry
           Product: binutils
           Version: 2.26 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com

X86-64 linker fails to check PC-relative offset overflow in PLT entry:

address@hidden plt]$ cat foo.c
#include <stdio.h>

void
foo (void)
{
  printf ("PASS\n");
}
address@hidden plt]$ cat main.c
extern void foo (void);
extern void bar (void);

int
main ()
{
  foo ();
  bar ();
  return 0;
}
address@hidden plt]$ cat gap.S 
    .text
    .p2align 4,,15
    .globl    bar
    .type    bar, @function
bar:
    jmp .L0
    .space 0x40000000, 0x90
.L0:
    jmp .L2
#ifdef GOLD
    .space 0x4fdfff14, 0x90
#else
    .space 0x3fdfff14, 0x90
#endif
.L2:
    leaq    .L2(%rip), %rcx
    movabsq    $_GLOBAL_OFFSET_TABLE_-.L2, %r11
    movabsq    address@hidden, %rax
    addq    %r11, %rcx
    addq    %rcx, %rax
    jmp    *%rax
    .size    bar, .-bar
    .section    .note.GNU-stack,"",@progbits
address@hidden plt]$ make LD=ld
gcc -O2    -c -o main.o main.c
gcc -O2  -c -o gap.o gap.S
gcc -O2  -fpic   -c -o foo.o foo.c
ld -shared -o libfoo.so gap.o foo.o
gcc -O2  -o foo main.o libfoo.so -Wl,-R,.
./foo
make: *** [all] Segmentation fault
address@hidden plt]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]