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

--- Comment #14 from H.J. Lu <hjl.tools at gmail dot com> ---
Another R_X86_64_32S overflow check testcase:

[hjl@gnu-tools-1 pr19567]$ cat x.S
#ifndef SPACE
#define SPACE 0x80000000
#endif
        .data
        .space SPACE
        .comm foo,4
        .text
        .globl _start
_start:
        mov $foo,%rax
        movl $1, (%rax)
        movl $93, %eax          /* Syscall number -> rax.  */
        syscall                 /* Do the system call.  */
[hjl@gnu-tools-1 pr19567]$ make LD=ld
gcc -mx32   -c -o x.o x.S
ld -m elf32_x86_64 -o x x.o
x.o: In function `_start':
(.text+0x3): relocation truncated to fit: R_X86_64_32S against symbol `foo'
defined in COMMON section in x.o
Makefile:15: recipe for target 'x' failed
make: *** [x] Error 1
[hjl@gnu-tools-1 pr19567]$ make
./ld.gold -m elf32_x86_64 -o x x.o
[hjl@gnu-tools-1 pr19567]$ gdb x
GNU gdb (GDB) Fedora 7.10.1-30.fc23
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from x...(no debugging symbols found)...done.
(gdb) r
Starting program: /export/home/hjl/bugs/binutils/pr19567/x 

Program received signal SIGSEGV, Segmentation fault.
0x0040007b in _start ()
(gdb) disass
Dump of assembler code for function _start:
   0x00400074 <+0>:     mov    $0xffffffff80401088,%rax
=> 0x0040007b <+7>:     movl   $0x1,(%rax)
   0x00400081 <+13>:    mov    $0x5d,%eax
   0x00400086 <+18>:    syscall 
End of assembler dump.
(gdb) p/x $rax
$1 = 0xffffffff80401088
(gdb)

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