diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-08-16 10:41:56 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-09-07 09:42:15 -0700 |
commit | b1308d2c3749cc454f00b70768ee33724d919527 (patch) | |
tree | cf051908c28994feb29b449bee2786c84eff14bd /gdb/objc-lang.c | |
parent | e50142270b699c4960e56824a0300865589dc292 (diff) | |
download | binutils-b1308d2c3749cc454f00b70768ee33724d919527.zip binutils-b1308d2c3749cc454f00b70768ee33724d919527.tar.gz binutils-b1308d2c3749cc454f00b70768ee33724d919527.tar.bz2 |
RISC-V: Support PCREL_* relocations agaist weak undefined symbols
I recently modified our Linux port's base address such the absolute
address 0 is no longer addressable as a 32-bit PC-relative offset.
Since Linux links a weak undefined symbol in an intermediate binary, it
needs to be able to reference absolute address 0.
This patch changes R_RISCV_PCREL_* relocations to absolute relocations
while resolving them in order to allow these symbols to be referenced in
PC-relative programs linked at high addresses. Note that this doesn't
apply to PIC, which also uses PC-relative relocations, just to
position-dependent objects, which we use to allow programs to be linked
at high addresses.
In case some of our embedded users are using R_RISCV_PCREL_* as a hacked
up method of getting position-independent binaries (which can work if
you have very simple programs), we only convert the relocations when the
PC-relative version would overflow.
bfd/ChangeLog:
2017-09-07 Palmer Dabbelt <palmer@dabbelt.com>
* elfnn-riscv.c (riscv_zero_pcrel_hi_reloc): New function.
(riscv_record_pcrel_hi_reloc): Add absolute argument.
(riscv_elf_relocate_section): Call riscv_zero_pcrel_hi_reloc for
R_RISCV_PCREL_HI20 relocs, and pass the result to
riscv_record_pcrel_hi_reloc.
Diffstat (limited to 'gdb/objc-lang.c')
0 files changed, 0 insertions, 0 deletions