[llvm] [BPF] Support Jump Table (PR #149715)

Anton Protopopov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 01:59:37 PDT 2025


aspsk wrote:

All looks to be compiling properly, I should be able to make this work altogether.

I have two questions & nits below, will split them in two comments.

Question 1: For switches and for computed goto relocations look a bit different. Switch:
```
       4:       18 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r2 = 0x0 ll
                0000000000000020:  R_BPF_64_64  BPF.JT.0.0
```
computed gotos:
```
      55:       18 02 00 00 28 00 00 00 00 00 00 00 00 00 00 00 r2 = 0x28 ll
                00000000000001b8:  R_BPF_64_64  .jumptables
...
      63:       18 01 00 00 38 00 00 00 00 00 00 00 00 00 00 00 r1 = 0x38 ll
                00000000000001f8:  R_BPF_64_64  .jumptables
```
The latter two point to properly defined symbols:
```
     3: 0000000000000028    16 OBJECT  LOCAL  DEFAULT     5 __const.simple_test.jt1
     4: 0000000000000038    16 OBJECT  LOCAL  DEFAULT     5 __const.simple_test.jt2
```
but this is another step to find those? Can relocation point to the symbol directly as with the switch?

https://github.com/llvm/llvm-project/pull/149715


More information about the llvm-commits mailing list