Re: [RFC bpf-next 8/9] libbpf: support llvm-generated indirect jumps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2025-07-08 at 01:30 -0700, Eduard Zingerman wrote:
> On Mon, 2025-07-07 at 12:07 -0700, Eduard Zingerman wrote:
> > On Thu, 2025-07-03 at 11:21 -0700, Eduard Zingerman wrote:
> > 
> > [...]
> > 
> > > > > >   .jumptables
> > > > > >     <subprog-rel-off-0>
> > > > > >     <subprog-rel-off-1> | <--- jump table #1 symbol:
> > > > > >     <subprog-rel-off-2> |        .size = 2   // number of entries in the jump table
> > > > > >     ...                          .value = 1  // offset within .jumptables
> > > > > >     <subprog-rel-off-N>                          ^
> > > > > >                                                  |
> > > > > >   .text                                          |
> > > > > >     ...                                          |
> > > > > >     <insn-N>     <------ relocation referencing -'
> > > > > >     ...                  jump table #1 symbol
> > 
> > [...]
> > 
> > I think I got it working in:
> > https://github.com/eddyz87/llvm-project/tree/separate-jumptables-section

Pushed fixes. Relocations are now emitted for gotox and reference
correct symbol:

0000000000000000 <foo>:
       0:       if w1 > 0x1f goto +0x10 <foo+0x88>
       1:       w1 = w1
       2:       r1 <<= 0x3
       3:       r2 = 0x0 ll
                0000000000000018:  R_BPF_64_64  .BPF.JT.0.0
       5:       r2 += r1
       6:       r1 = *(u64 *)(r2 + 0x0)
       7:       gotox r1
                0000000000000038:  R_BPF_64_64  .BPF.JT.0.0
       8:       goto +0x8 <foo+0x88>

Two llvm BPF unit tests are failing:

 Failed Tests (2):
  LLVM :: CodeGen/BPF/CORE/offset-reloc-fieldinfo-2-bpfeb.ll
  LLVM :: CodeGen/BPF/CORE/offset-reloc-fieldinfo-2.ll

But I think current state should be sufficient for basic testing.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux