adapteva/epiphany-binutils — pull request #1 by planglois (2014-05-30 18:25:35+00:00)
Title: Add support for relocating function pointers.

This patch adds a new relocation type for EPIPHANY: BFD_RELOC_EPIPHANY_OVER32.
It adds support for building C code with `-fpic` such as:

~~~
int foo = 0;
void a()
{
foo++;
}
void (*b)() = a;
~~~

With `b` compiling down to:

~~~
_b:
.word _a@PLT
~~~

bfd/
* reloc.c (BFD_RELOC_EPIPHANY_OVER32): Define a new PLT
relocation.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
* elf32-epiphany.c (epiphany_elf_howto_table): Add a 32 bit PLT
relocation: R_EPIPHANY_OVER32.
(epiphany_reloc_type_lookup): Likewise.
(epiphany_final_link_relocate): Handle PLT relocation of type
R_EPIPHANY_OVER32.
(epiphany_elf_check_relocs): Add R_EPIPHANY_OVER32 to the
relocation types that need a PLT entry.

gas/
* config/tc-epiphany.h (TC_PARSE_CONS_EXPRESSION): Define.
(TC_CONS_FIX_NEW): Likewise.
* config/tc-epiphany.c (epiphany_parse_cons_expression): New
function.
(epiphany_cons_fix_new): New function.

include/
* elf/epiphany.h (R_EPIPHANY_OVER32): Define.