• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión12adf8053ba0b241d3973b46109842a1cbfa60de (tree)
Tiempo2020-05-29 04:54:46
AutorDavid Faust <david.faust@orac...>
CommiterJose E. Marchesi

Log Message

bfd: fix handling of R_BPF_INSN_{32,64} relocations.

2020-05-28 David Faust <david.faust@oracle.com>

* elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
R_BPF_INSN_{32,64} relocations.

Cambiar Resumen

Diferencia incremental

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
1+2020-05-28 David Faust <david.faust@oracle.com>
2+
3+ * elf64-bpf.c (bpf_elf_relocate_section): Fix handling of
4+ R_BPF_INSN_{32,64} relocations.
5+
16 2020-05-28 Stephen Casner <casner@acm.org>
27
38 * pdp11.c: Implement BRD_RELOC_32 to relocate the low 16 bits of
--- a/bfd/elf64-bpf.c
+++ b/bfd/elf64-bpf.c
@@ -64,7 +64,7 @@ static reloc_howto_type bpf_elf_howto_table [] =
6464 MINUS_ONE, /* dst_mask */
6565 TRUE), /* pcrel_offset */
6666
67- /* 32-immediate in LDDW instruction. */
67+ /* 32-immediate in many instructions. Note: handled manually. */
6868 HOWTO (R_BPF_INSN_32, /* type */
6969 0, /* rightshift */
7070 2, /* size (0 = byte, 1 = short, 2 = long) */
@@ -460,6 +460,31 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
460460 r = bfd_reloc_ok;
461461 break;
462462 }
463+ case R_BPF_INSN_32:
464+ {
465+ /* Write relocated value */
466+ bfd_put (howto->bitsize, input_bfd, relocation,
467+ contents + rel->r_offset + 4);
468+
469+ r = bfd_reloc_ok;
470+ break;
471+ }
472+ case R_BPF_INSN_64:
473+ {
474+ /*
475+ LDDW instructions are 128 bits long, with a 64-bit immediate.
476+ The lower 32 bits of the immediate are in the same position
477+ as the imm32 field of other instructions.
478+ The upper 32 bits of the immediate are stored at the end of
479+ the instruction.
480+ */
481+ bfd_put (32, input_bfd, (relocation & 0xFFFFFFFF),
482+ contents + rel->r_offset + 4);
483+ bfd_put (32, input_bfd, (relocation >> 32),
484+ contents + rel->r_offset + 12);
485+ r = bfd_reloc_ok;
486+ break;
487+ }
463488 default:
464489 r = _bfd_final_link_relocate (howto, input_bfd, input_section,
465490 contents, rel->r_offset, relocation,