https://sourceware.org/bugzilla/show_bug.cgi?id=18296
Bug ID: 18296
Summary: gold fails to properly handle R_386_GOTOFF
Product: binutils
Version: 2.26 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: hjl.tools at gmail dot com
CC: ian at airs dot com
[hjl@gnu-6 pr17689]$ cat x.S
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
call __x86.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $12, %esp
pushl bar_alias@GOTOFF(%ebx)
call foo@PLT
popl %eax
movl ptr@GOTOFF(%ebx), %eax
pushl (%eax)
call foo@PLT
addl $16, %esp
leal -8(%ebp), %esp
xorl %eax, %eax
popl %ecx
popl %ebx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.globl ptr
.section .data.rel.local,"aw",@progbits
.align 4
.type ptr, @object
.size ptr, 4
ptr:
.long bar_alias
.section
.text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
movl (%esp), %ebx
ret
[hjl@gnu-6 pr17689]$ cat bar.c
#include <stdio.h>
char *bar = "PASS";
extern char *bar_alias __attribute__ ((weak, alias ("bar")));
void
foo (char *x)
{
printf ("%s\n", x);
}
[hjl@gnu-6 pr17689]$ make
gcc -m32 -B./ -pie -O3 -fPIE -fpie -c -o x.o x.S
gcc -m32 -B./ -pie -O3 -fPIE -fpic -c -o bar.o bar.c
gcc -m32 -B./ -pie -shared -o libbar.so bar.o
gcc -m32 -B./ -pie -O3 -fPIE -o x x.o libbar.so -Wl,-R,.
./x
make: *** [all] Segmentation fault
[hjl@gnu-6 pr17689]$
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils