ietf-wg-bpf / ebpf-docs

eBPF Standard Documentation
37 stars 5 forks source link

ABI: Clarify if overlapping local functions are valid or prohibitted #139

Open Alan-Jowett opened 1 month ago

Alan-Jowett commented 1 month ago
main:
  mov %r0, 1
  mov %r1, %r0
  call local func1
  mov %r1, %r0
  call local func2
func1:
  add %r0, 1
func2:
  add %r0, 1
  exit

There are three functions: The main function, starting at PC 0 and ending at PC 7. The first local function func1, starting at PC 5 and ending at PC 7. The second local function func2, starting at PC 6 and ending at PC 7.

Is this valid? There doesn't appear to be anything in the ISA prohibiting it, but the Linux verifier rejects it.

dthaler commented 1 month ago

My view: From the ISA perspective, there is nothing against it. It would be up to the psABI (which specifies calling conventions for function calls), and the implementation.