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

            Bug ID: 19969
           Summary: ld fails to detect run-time relocation overflow
           Product: binutils
           Version: 2.27 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
            Target: x86-64

[hjl@gnu-6 error-1]$ cat y.c
int foo = -1;
[hjl@gnu-6 error-1]$ cat bar.c 
extern int * get_foo_p (void);

int
main (void)
{
  int *p = get_foo_p ();
  if (*p != -1)
    __builtin_abort ();
  return 0;
}
[hjl@gnu-6 error-1]$ cat x.S
        .text
        .globl  get_foo_p
        .type   get_foo_p, @function
get_foo_p:
        movl    foo_p(%rip), %eax
        ret
        .size   get_foo_p, .-get_foo_p
        .globl  foo_p
        .data
        .align 4
        .type   foo_p, @object
        .size   foo_p, 4
foo_p:
        .long   foo
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-6 error-1]$ make
gcc -g -fPIC -c -o y.o y.c
ld -shared  -o y.so y.o
gcc -g -c -o x.o x.S
gcc -g -c -o bar.o bar.c
gcc -o x x.o bar.o y.so -Wl,-R,.
./x
./x: Symbol `foo' causes overflow in R_X86_64_32 relocation
Makefile:12: recipe for target 'all' failed
make: *** [all] Segmentation fault
[hjl@gnu-6 error-1]$

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