[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/13302] New: IRELATIVE relocation should come last
From: |
drepper.fsp at gmail dot com |
Subject: |
[Bug binutils/13302] New: IRELATIVE relocation should come last |
Date: |
Sun, 16 Oct 2011 15:45:24 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=13302
Bug #: 13302
Summary: IRELATIVE relocation should come last
Product: binutils
Version: 2.21
Status: NEW
Severity: normal
Priority: P2
Component: binutils
AssignedTo: address@hidden
ReportedBy: address@hidden
Classification: Unclassified
Assume this code:
extern int f(void);
void alt1(void) { }
void alt2(void) { }
static void (*resolve (void)) (void)
{
return f() ? alt1 : alt2;
}
void fct(void) __attribute__ ((ifunc ("resolve")));
extern __typeof(fct) int_fct __attribute__ ((alias("fct")));
void g(void) {
int_fct();
}
And this linker map:
{
global:
fct;
local:
*;
};
Compiling using
gcc -shared -fpic bug.c -Wl,--version-script,bug.map
The problem is the .rela.plt / .rel.plt section. On my x86-64 system it looks
like this:
0x0000000000200858 X86_64_JUMP_SLOT 000000000000000000 +0
__cxa_finalize
0x0000000000200860 X86_64_IRELATIVE 000000000000000000 +1304
0x0000000000200868 X86_64_JUMP_SLOT 000000000000000000 +0 f
This is a problem, the ifunc for the IRELATIVE relocation calls f. That PLT
slot isn't set up yet.
There is no problem with an ifunc callback to call another function. Therefore
IRELATIVE relocation should all be moved to the back of the section. There are
no drawbacks to doing this and carefully designed DSOs can call functions in
ifunc callbacks.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug binutils/13302] New: IRELATIVE relocation should come last,
drepper.fsp at gmail dot com <=
- [Bug binutils/13302] IRELATIVE relocation should come last, hjl.tools at gmail dot com, 2011/10/17
- [Bug binutils/13302] IRELATIVE relocation should come last, hjl.tools at gmail dot com, 2011/10/18
- [Bug binutils/13302] IRELATIVE relocation should come last, hjl.tools at gmail dot com, 2011/10/20
- [Bug binutils/13302] IRELATIVE relocation should come last, cvs-commit at gcc dot gnu.org, 2011/10/21
- [Bug binutils/13302] IRELATIVE relocation should come last, hjl.tools at gmail dot com, 2011/10/21
- [Bug binutils/13302] IRELATIVE relocation should come last, cvs-commit at gcc dot gnu.org, 2011/10/21
- [Bug binutils/13302] IRELATIVE relocation should come last, hjl.tools at gmail dot com, 2011/10/21
- [Bug binutils/13302] IRELATIVE relocation should come last, amodra at gmail dot com, 2011/10/22