bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/18695] [x86-64] Missing relocation overflow check


From: hjl.tools at gmail dot com
Subject: [Bug gold/18695] [x86-64] Missing relocation overflow check
Date: Sun, 07 Feb 2016 13:25:03 +0000

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

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Cary Coutant from comment #10)
> Created attachment 8963 [details]
> Patch to fix broken x32 overflow checks
> 
> Fix incorrect x32 overflow checking for refs to weak undef symbols.

> With this patch, I can build basic_static_pic_test in x32 mode.
> HJ, I'd appreciate it if you could give it more testing before I
> commit it.
> 
> 2016-02-06  Cary Coutant  <address@hidden>
> 
> gold/
>       * x86_64.cc (X86_64_relocate_functions::pcrela32_check): Fix x32
>       overflow checking when symbol value + addend < 0.

Yes, it works.  Can you improve overflow message?

address@hidden pr18695]$ make x
gcc -B./ -mx32 -fno-lto  -o x foo.o main.o
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/x32/crtbegin.o: In function
`__do_global_dtors_aux':
crtstuff.c:(.text+0x72): relocation truncated to fit: R_X86_64_PC32 against
`.bss'
crtstuff.c:(.text+0x84): relocation truncated to fit: R_X86_64_PC32 against
`.bss'
main.o: In function `main':
/export/home/hjl/bugs/binutils/pr18695/main.c:8:(.text.startup+0x2): relocation
truncated to fit: R_X86_64_PC32 against symbol `foo' defined in COMMON section
in foo.o
/export/home/hjl/bugs/binutils/pr18695/main.c:9:(.text.startup+0x22):
relocation truncated to fit: R_X86_64_PC32 against symbol `foo' defined in
COMMON section in foo.o
collect2: error: ld returned 1 exit status
Makefile:31: recipe for target 'x' failed
make: *** [x] Error 1
address@hidden pr18695]$ make y
gcc -B./ -mx32 -fno-lto  -o y foo.o main.o -fuse-ld=gold
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/x32/crtbegin.o(.text+0x72): error:
relocation overflow
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/x32/crtbegin.o(.text+0x84): error:
relocation overflow
main.c:8: error: relocation overflow
main.c:9: error: relocation overflow
/usr/libx32/libc_nonshared.a(elf-init.oS):function __libc_csu_init: error:
relocation overflow
/usr/libx32/libc_nonshared.a(elf-init.oS):function __libc_csu_init: error:
relocation overflow
collect2: error: ld returned 1 exit status
Makefile:34: recipe for target 'y' failed
make: *** [y] Error 1
address@hidden pr18695]$ 

Overflow message from gold contains not much useful messages for users.

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