diff options
author | Palmer Dabbelt <palmer@dabbelt.com> | 2017-05-18 18:08:25 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer@dabbelt.com> | 2017-10-19 09:19:32 -0700 |
commit | ff6f4d9b2d6c25ac144bab869df6e3d6123a6f8f (patch) | |
tree | 59e6a3f173dd8987b985d830a745f06e6b881f9d /ld | |
parent | 95e42ad4425f0ab0ebfb90035a891be576f9fca4 (diff) | |
download | gdb-ff6f4d9b2d6c25ac144bab869df6e3d6123a6f8f.zip gdb-ff6f4d9b2d6c25ac144bab869df6e3d6123a6f8f.tar.gz gdb-ff6f4d9b2d6c25ac144bab869df6e3d6123a6f8f.tar.bz2 |
RISC-V: Add R_RISCV_DELETE, which marks bytes for deletion
We currently delete bytes by shifting an entire BFD backwards to
overwrite the bytes we no longer need. The result is that relaxing a
BFD is quadratic time.
This patch adds an additional relocation that specifies a byte range
that will be deleted from the final object file, and adds a relaxation
pass (between the existing passes that delete bytes and the alignment
pass) that actually deletes the bytes. Note that deletion is still
quadratic time, and nothing uses R_RISCV_DELETE yet.
I've been meaning to go convert all the other relaxations to use
R_RISCV_DELETE and then make it faster, but this patch has been sitting
around for months so it looks like that won't happen for a bit. The
PCREL->GPREL relaxation that comes next uses this, and since we've been
using these two patches out of tree since I wrote them months ago I
figure it's better to just get them in now. I (or someone else :)) can
convert all the relocations later...
R_RISCV_DELETE will never be emitted into ELF objects, so therefor isn't
exposed to the rest of binutils. As such, we're not considering this as
part of the ABI.
bfd/ChangeLog
2017-10-19 Palmer Dabbelt <palmer@dabbelt.com>
* elfnn-riscv (R_RISCV_DELETE): New define.
(_bfd_riscv_relax_delete): New function.
(perform_relocation): Handle R_RISCV_DELETE.
(_bfd_riscv_relax_section): Likewise.
ld/ChangeLog
2017-10-19 Palmer Dabbelt <palmer@dabbelt.com>
* emultempl/riscvelf.em (riscv_elf_before_allocation): Add a
third relaxation pass.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/emultempl/riscvelf.em | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 7745a9c..586420a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2017-10-19 Palmer Dabbelt <palmer@dabbelt.com> + + * emultempl/riscvelf.em (riscv_elf_before_allocation): Add a + third relaxation pass. + 2017-10-17 Alan Modra <amodra@gmail.com> * ld.texinfo (-z): Combine negative options with corresponding diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em index 5fe93c2..3aa82da 100644 --- a/ld/emultempl/riscvelf.em +++ b/ld/emultempl/riscvelf.em @@ -39,7 +39,7 @@ riscv_elf_before_allocation (void) else ENABLE_RELAXATION; - link_info.relax_pass = 2; + link_info.relax_pass = 3; } static void |