This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Complex relocs
- From: Etienne Bergeron <etienne dot bergeron at octasic dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Mon, 24 Jan 2011 19:20:43 +0000
- Subject: Complex relocs
I just read this post on the mailing related to the complex relocations added in the elf32-mep.c in 2007.
http://cygwin.ru/ml/binutils/2007-09/msg00440.html
I see some limitation for our cases.
1) The type is applied on the "reloc" (RELC/SRELC) and not on the "operator".
- Thus, it is not possible to have both signed and unsigned arithmetic within the same reloc.
2) The way symbols_resolve(elflink.c) works hide a potential bug,
3) and is inefficient for lots of complex relocs O(n2)
- The symbols are represented as "string" instead of "ndx" in the symbols table
An example of a potential bug:
------------------------------
static int x;
int y;
int foo()
{
extern int x;
static int delta = (&x-&y); <<-- complex reloc, but which "x" to use (local/global)?! (in the implementation, local)
[...]
}
I think "resolve_symbol" should be back-end specific, and "binutils" may provide a default one.
Also, I think backend should provide a "decode_symbol" function for pretty-printing a symbol when using objdump -t or readelf -s.
--
Etienne Bergeron
http://www.octasic.com