bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/19567] Symbol_value::value doesn't support x32 overflow check


From: hjl.tools at gmail dot com
Subject: [Bug gold/19567] Symbol_value::value doesn't support x32 overflow check
Date: Sun, 07 Feb 2016 03:49:19 +0000

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:

address@hidden 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.  */
address@hidden 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
address@hidden pr19567]$ make
./ld.gold -m elf32_x86_64 -o x x.o
address@hidden 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.


reply via email to

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