[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/20796] New: m68k binutils produce R_68K_NONE relocations in .rel
From: |
slyfox at inbox dot ru |
Subject: |
[Bug ld/20796] New: m68k binutils produce R_68K_NONE relocations in .rela.plt. Causes glibc to fail to load binaries. |
Date: |
Tue, 08 Nov 2016 23:42:19 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=20796
Bug ID: 20796
Summary: m68k binutils produce R_68K_NONE relocations in
.rela.plt. Causes glibc to fail to load binaries.
Product: binutils
Version: 2.28 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: slyfox at inbox dot ru
Target Milestone: ---
How to reproduce. We will need to build a shared library and an executable.
//Executable source:
// a.c
#include <stdio.h>
int main(void) {
printf ("hello!\n");
return 0;
}
//Library source:
// b.c
void buggy_symbol (void)
{
return;
}
Building:
Compiling...
$ m68k-unknown-linux-gnu-gcc -c a.c -o a.o
$ m68k-unknown-linux-gnu-gcc -shared -fPIC b.c -o libb.so
Linking...
$ m68k-unknown-linux-gnu-gcc -L. -Wl,--gc-sections '-Wl,-rpath=$ORIGIN' -u
buggy_symbol a.o -o bug -lb
Running...
$ ./bug
./bug: error while loading shared libraries: unexpected PLT reloc type 0x00
$ LD_BIND_NOW=1 ./bug
hello!
$ readelf -a bug | egrep 'R_68K_NONE|Relocation section'
Relocation section '.rela.dyn' at offset 0x38c contains 3 entries:
00000000 00000000 R_68K_NONE 0
00000000 00000000 R_68K_NONE 0
Relocation section '.rela.plt' at offset 0x3b0 contains 5 entries:
00000000 00000000 R_68K_NONE 0
The sample is a distilled failure of GHC build failure.
GHC adds '-u buggy_symbol' when links both libraries and executables but
executables don't require it.
Workarounds so far. Any of there does work:
- add -Wl,-z,now
- drop -Wl,--gc-sections
- drop -u buggy_symbol
Binutils version: 2.27.51.20161105
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/20796] New: m68k binutils produce R_68K_NONE relocations in .rela.plt. Causes glibc to fail to load binaries.,
slyfox at inbox dot ru <=