All of lore.kernel.org
 help / color / mirror / Atom feed
From: jose.marchesi@oracle.com (Jose E. Marchesi)
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Jiong Wang <jiong.wang@netronome.com>,
	"David S. Miller" <davem@davemloft.net>,
	Edward Cree <ecree@solarflare.com>, Yonghong Song <yhs@fb.com>,
	Martin KaFai Lau <kafai@fb.com>, Andrii Nakryiko <andriin@fb.com>,
	binutils@sourceware.org, Daniel Borkmann <daniel@iogearbox.net>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH 0/9] eBPF support for GNU binutils
Date: Tue, 21 May 2019 20:58:43 +0200	[thread overview]
Message-ID: <87ftp7my70.fsf@oracle.com> (raw)
In-Reply-To: <CAADnVQJcfnEh4_ok1o9oWNiaBAdd-2XHiguu1FvPZdnAuXuWBg@mail.gmail.com> (Alexei Starovoitov's message of "Tue, 21 May 2019 11:18:23 -0700")


Hi Alexey.

    > > Despite using a different syntax for the assembler (the llvm assembler
    > > uses a C-ish expression-based syntax while the GNU assembler opts for
    > > a more classic assembly-language syntax) this implementation tries to
    > > provide inter-operability with clang/llvm generated objects.
    >
    > I also noticed your implementation doesn’t seem to use the same sub-register
    > syntax as what LLVM assembler is doing.
    >
    >   x register for 64-bit, and w register for 32-bit sub-register.
    >
    > So:
    >   add r0, r1, r2 means BPF_ALU64 | BPF_ADD | BFF_X
    >   add w0, w1, w1 means BPF_ALU | BPF_ADD | BPF_X
    >
    > ASAICT, different register prefix for different register width is also adopted
    > by quite a few other GNU assembler targets like AArch64, X86_64.
    
    there is also Ed's assembler:
    https://github.com/solarflarecom/ebpf_asm

Oh interesting, didn't know about it.

    It uses 2 ops style.
    I think 3 ops style "add r0,r1,r2" is not a good fit for bpf isa.

I agree.  My port uses two-operand formats for most instructions,
including arithmetic instructions.  Examples:

sub %r2, 666
sub %r3, -666
sub %r4, 0x7eadbeef
sub %r5, %r6
    
    I think we need to converge on one asm syntax for gas/bfd.
    At this point we cannot change llvm's asm output,
    so my preference would be to make gas accept it.
    But I understand the implementation difficulties to fit it into bfd infra.
    So I'm ok with more traditional asm the way Dave implemented it few
    years back.
    One asm syntax for gas and another asm syntax for clang is, imo, acceptable.
    
    Jose, can you combine Dave's patches with yours?

As far as I can see my port uses basically the same syntax than Dave's.

The only significant difference is that mine uses a % prefix for
register names.  I prefer it this way in order to avoid collisions with
symbols.
    
    I think Ed had an idea on how to specify BTF in asm syntax.
    BTF has to be supported by the assembler as well
    along with .btf.ext, lineinfo, etc
    Currently llvm emits btf as '.byte 0x...', but that's far from ideal.

I haven't looked into BTF yet, but it would be certainly good, for
everyone to use the same directives to support it :)

  reply	other threads:[~2019-05-21 19:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190520164526.13491-1-jose.marchesi () oracle ! com>
2019-05-21 15:41 ` [PATCH 0/9] eBPF support for GNU binutils Jiong Wang
2019-05-21 17:06   ` Jose E. Marchesi
2019-05-21 18:14     ` Jiong Wang
2019-05-21 19:13       ` Jose E. Marchesi
2019-05-21 17:43   ` David Miller
2019-05-21 18:18   ` Alexei Starovoitov
2019-05-21 18:58     ` Jose E. Marchesi [this message]
2019-05-21 19:02     ` Edward Cree
2019-05-21 19:34       ` Jose E. Marchesi
2019-05-21 19:49         ` Edward Cree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftp7my70.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andriin@fb.com \
    --cc=binutils@sourceware.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ecree@solarflare.com \
    --cc=jiong.wang@netronome.com \
    --cc=kafai@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.