Skip to contentSkip to conversation

Support for the pseudo-C BPF assembler syntax in GAS

DISCUSSION Jose E. Marchesi 4 participants 9 messages Apr 26, 2023 – Apr 28, 2023 BPF

lore
Share & tools
lore
#2 lore raw
Quoted 7 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

#3 lore raw
Quoted 14 lines · Jose E. Marchesi
Quoted 8 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

This is awesome!
We recently converted tens of thousands of lines of bpf asm from macros to inline asm in C.
See tools/testing/selftests/bpf/progs/verifier_*.c
I wonder how gas-bpf can deal with that.
We had to fix several inline asm issues in clang to get to this point and probably more to come.

#4 lore raw

Odd. I replied to this yesterday, but somehow it wasn't sent.

Quoted 14 lines
Quoted 12 lines · Jose E. Marchesi
Quoted 8 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

This is awesome!
We recently converted tens of thousands of lines of bpf asm from macros to inline asm in C.
See tools/testing/selftests/bpf/progs/verifier_*.c
I wonder how gas-bpf can deal with that.

Inline assembly shall work.

Quoted 2 lines

We had to fix several inline asm issues in clang to get to this point and probably more to come.

We will give these tests a try and fix problems as we find them :)

We actually came with some ambiguities, undefined stuff, and other issues with the syntax while doing the implementation. We hope to discuss some of that during the LSF/MM/BPF next week, so we can consolidate the language in both toolchains.

Speaking of which, we are preparing the material for the "compiled BPF" activity during LSF/MM/BPF. I think the BPF track hasn't been scheduled yet, but how much time will we have to discuss about the topic?

maintainer
#5 lore raw
Quoted 19 lines · Jose E. Marchesi

Odd. I replied to this yesterday, but somehow it wasn't sent.

Quoted 17 lines
Quoted 14 lines · Jose E. Marchesi
Quoted 8 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

Quoted 7 lines
Quoted 5 lines

This is awesome!
We recently converted tens of thousands of lines of bpf asm from macros to inline asm in C.
See tools/testing/selftests/bpf/progs/verifier_*.c
I wonder how gas-bpf can deal with that.

Inline assembly shall work.

There is also an LLVM testcase [1] where most of the instructions are covered, but you probably have something similar.

Just of the curiosity, is the state machine generated by some tool or is it "pen and paper" exercise?

[1] https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/BPF/assembler-disassembler.s

Quoted 14 lines
Quoted 3 lines

We had to fix several inline asm issues in clang to get to this point and probably more to come.

We will give these tests a try and fix problems as we find them :)

We actually came with some ambiguities, undefined stuff, and other issues with the syntax while doing the implementation. We hope to discuss some of that during the LSF/MM/BPF next week, so we can consolidate the language in both toolchains.

Speaking of which, we are preparing the material for the "compiled BPF" activity during LSF/MM/BPF. I think the BPF track hasn't been scheduled yet, but how much time will we have to discuss about the topic?

#7 lore raw
In reply to Jose E. Marchesi
Quoted 34 lines · Jose E. Marchesi

Odd. I replied to this yesterday, but somehow it wasn't sent.

Quoted 14 lines
Quoted 12 lines · Jose E. Marchesi
Quoted 8 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

This is awesome!
We recently converted tens of thousands of lines of bpf asm from macros to inline asm in C.
See tools/testing/selftests/bpf/progs/verifier_*.c
I wonder how gas-bpf can deal with that.

Inline assembly shall work.

Quoted 2 lines

We had to fix several inline asm issues in clang to get to this point and probably more to come.

We will give these tests a try and fix problems as we find them :)

Quoted 8 lines

We actually came with some ambiguities, undefined stuff, and other issues with the syntax while doing the implementation. We hope to discuss some of that during the LSF/MM/BPF next week, so we can consolidate the language in both toolchains.

Speaking of which, we are preparing the material for the "compiled BPF" activity during LSF/MM/BPF. I think the BPF track hasn't been scheduled yet, but how much time will we have to discuss about the topic?

Awesome. I'd love to participate.

Martin, Daniel,
What is the schedule for bpf track ?

#6 lore raw
In reply to Eduard Zingerman
Quoted 27 lines · Jose E. Marchesi
Quoted 25 lines

Odd. I replied to this yesterday, but somehow it wasn't sent.

Quoted 22 lines
Quoted 14 lines · Jose E. Marchesi
Quoted 8 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Quoted 2 lines
Quoted 2 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html

This is awesome!
We recently converted tens of thousands of lines of bpf asm from macros to inline asm in C.
See tools/testing/selftests/bpf/progs/verifier_*.c
I wonder how gas-bpf can deal with that.

Quoted 4 lines
Quoted 1 line

Inline assembly shall work.

There is also an LLVM testcase [1] where most of the instructions are covered, but you probably have something similar.

Yes we have extensive instruction testing in the assembler.

Quoted 2 lines

Just of the curiosity, is the state machine generated by some tool or is it "pen and paper" exercise?

It is the later :)

But I plan to turn that function into a recursive-descend, for maintainability.

Quoted 16 lines

[1] https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/BPF/assembler-disassembler.s

Quoted 14 lines
Quoted 3 lines

We had to fix several inline asm issues in clang to get to this point and probably more to come.

We will give these tests a try and fix problems as we find them :)

We actually came with some ambiguities, undefined stuff, and other issues with the syntax while doing the implementation. We hope to discuss some of that during the LSF/MM/BPF next week, so we can consolidate the language in both toolchains.

Speaking of which, we are preparing the material for the "compiled BPF" activity during LSF/MM/BPF. I think the BPF track hasn't been scheduled yet, but how much time will we have to discuss about the topic?

#8 lore raw
In reply to Jose E. Marchesi
Quoted 10 lines
Quoted 7 lines · Jose E. Marchesi
Quoted 3 lines

Just a heads up, we just committed support for the assembly syntax used
by clang to the GNU assembler [1].

Thanks! Do you which gcc release is expected to contain these changes?

This is the assembler, i.e. binutils.
We don't need to update the compiler.

Turns out we do indeed have to update GCC. Otherwise non-trivial inline asm ends in mixed syntaxes within an instruction (like r2 = %r3). We are looking into this.

Oh well.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Salud!
[1] https://sourceware.org/pipermail/binutils/2023-April/127222.html