[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/25384] New: Copy relocations and BIND_NOW on POWER ELFv1 results
From: |
fweimer at redhat dot com |
Subject: |
[Bug ld/25384] New: Copy relocations and BIND_NOW on POWER ELFv1 results in crashes |
Date: |
Tue, 14 Jan 2020 13:50:25 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=25384
Bug ID: 25384
Summary: Copy relocations and BIND_NOW on POWER ELFv1 results
in crashes
Product: binutils
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: fweimer at redhat dot com
Target Milestone: ---
Target: powerpc64
Created attachment 12203
--> https://sourceware.org/bugzilla/attachment.cgi?id=12203&action=edit
libshared.so
This script produces a ./main executable which crashes when run:
cat >like-pthread.c <<EOF
void
implementation (void)
{
}
EOF
gcc -fPIC -shared -o liblike-pthread.so like-pthread.c -Wl,-z,now
cat >like-dl.c <<EOF
extern void implementation (void) __attribute__ ((weak));
void
use_implementation (void)
{
if (implementation != 0)
implementation ();
}
EOF
gcc -fPIC -shared -o liblike-dl.so like-dl.c -Wl,-z,now
cat >shared.c <<EOF
extern void use_implementation (void);
extern void _exit (int);
void
call_dlopen (void)
{
use_implementation ();
_exit (0);
}
EOF
cat >main.s <<EOF
.section .rodata
ptr:
.quad alias
.weakref alias, implementation
.section ".opd","aw"
.align 3
.globl main
main:
.quad .L.main,.TOC.@tocbase
.text
.type main, @function
.L.main:
bl call_dlopen
nop
EOF
gcc -fPIC -shared -o libshared.so shared.c -Wl,--no-as-needed -L. -llike-dl
-llike-pthread
gcc -Wl,-rpath,. -o main main.s -Wl,--no-as-needed -L. -lshared
It reproduces with binutils 2.27 and the current master branch in Git (at
commit 7a6bf3becbe3e0ce47d2681edcfe7adcb67fe4e2).
GDB says this:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00003fffb7d008c8 in use_implementation () from ./liblike-dl.so
#2 0x00003fffb7f50918 in call_dlopen () from ./libshared.so
#3 0x0000000010000784 in main ()
The construct in use_implementation was previously discussed here:
<https://www.sourceware.org/ml/gnu-gabi/2016-q1/msg00004.html>
This crash arises when current glibc is built with --enable-bind-now (see the
downstream report; our 2.17 build includes the --enable-bind-now changes in
glibc master).
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/25384] New: Copy relocations and BIND_NOW on POWER ELFv1 results in crashes,
fweimer at redhat dot com <=
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, fweimer at redhat dot com, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, fweimer at redhat dot com, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, fweimer at redhat dot com, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, amodra at gmail dot com, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, cvs-commit at gcc dot gnu.org, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, amodra at gmail dot com, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, cvs-commit at gcc dot gnu.org, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, cvs-commit at gcc dot gnu.org, 2020/01/14
- [Bug ld/25384] Copy relocations and BIND_NOW on POWER ELFv1 results in crashes, fweimer at redhat dot com, 2020/01/15