Re: [PATCH] bpf: use xBPF signed div, mod insns when available

2020-09-22 Thread Jose E. Marchesi via Gcc-patches
The 'mod' and 'div' operators in eBPF are unsigned, with no signed counterpart. xBPF adds two new ALU operations, sdiv and smod, for signed division and modulus, respectively. Update bpf.md with 'define_insn' blocks for signed div and mod to use them when targetting xBPF,

Re: [PATCH] bpf: use xBPF signed div, mod insns when available

2020-09-22 Thread Jose E. Marchesi via Gcc-patches
Hi Segher! > On Thu, Sep 17, 2020 at 10:15:30AM -0700, David Faust via Gcc-patches wrote: >> The 'mod' and 'div' operators in eBPF are unsigned, with no signed >> counterpart. xBPF adds two new ALU operations, sdiv and smod, for >> signed division and modulus, respectively. Update bpf.md with >>

Re: [PATCH] bpf: use xBPF signed div, mod insns when available

2020-09-18 Thread Jose E. Marchesi via Gcc-patches
>> The 'mod' and 'div' operators in eBPF are unsigned, with no signed >> counterpart. xBPF adds two new ALU operations, sdiv and smod, for >> signed division and modulus, respectively. Update bpf.md with >> 'define_insn' blocks for signed div and mod to use them when targetting >> xBPF, and add n

[COMMITTED 1/2] bpf: use the expected instruction for NOPs

2020-09-14 Thread Jose E. Marchesi via Gcc-patches
The BPF ISA doesn't have a no-operation instruction, but in practice the Linux kernel verifier performs some optimizations that rely on these instructions to be encoded in a particular way. As it turns out, we were using the "wrong" instruction in GCC. This patch makes GCC to generate the expecte

Re: [PATCH] bpf: generate indirect calls for xBPF

2020-09-04 Thread Jose E. Marchesi via Gcc-patches
Hi David. > This patch updates the BPF back end to generate indirect calls via > the 'call %reg' instruction when targetting xBPF. > > Additionally, the BPF ASM_SPEC is updated to pass along -mxbpf to > gas, where it is now supported. Thanks for the patch. I just installed it on your behalf. S

Re: dg-options after board/cflags

2020-09-02 Thread Jose E. Marchesi via Gcc-patches
> On Wed, Sep 2, 2020 at 8:31 AM Jose E. Marchesi via Gcc-patches > wrote: >> >> >> Hi people! >> >> While adding a bpf-sim.exp to dejagnu, I noticed that the flags in >> board/cflags were included in the final compilation line _after_ the >> flag

dg-options after board/cflags

2020-09-02 Thread Jose E. Marchesi via Gcc-patches
Hi people! While adding a bpf-sim.exp to dejagnu, I noticed that the flags in board/cflags were included in the final compilation line _after_ the flags in the test's dg-options. Since the test options are more particular than the board options, I would expect them to be placed after any board-

Re: [PATCH] bpf: use elfos.h

2020-09-02 Thread Jose E. Marchesi via Gcc-patches
> BPF is an ELF-based target, so it definitely benefits from using > elfos.h. This patch makes the target to use it, and removes > superfluous definitions from bpf.h which are better defined in > elfos.h. > > Note that BPF, despite being an ELF target, doesn't use DWARF. At > some point it will

[COMMITTED] bpf: use the default asm_named_section target hook

2020-09-02 Thread Jose E. Marchesi via Gcc-patches
This patch makes the BPF backend to not provide its own implementation of the asm_named_section hook; the default handler works perfectly well. 2020-09-02 Jose E. Marchesi gcc/ * config/bpf/bpf.c (bpf_asm_named_section): Delete. (TARGET_ASM_NAMED_SECTION): Likewise. ---

[PATCH] bpf: use elfos.h

2020-09-01 Thread Jose E. Marchesi via Gcc-patches
BPF is an ELF-based target, so it definitely benefits from using elfos.h. This patch makes the target to use it, and removes superfluous definitions from bpf.h which are better defined in elfos.h. Note that BPF, despite being an ELF target, doesn't use DWARF. At some point it will generate DWARF

Re: [COMMITTED 0/4] bpf: backports to releases/gcc-10

2020-08-13 Thread Jose E. Marchesi via Gcc-patches
> On 8/12/20 9:12 PM, Jose E. Marchesi wrote: >> 1) CHERRY_PICK_PREFIX = '(cherry picked from commit ' and I used >> a slightly differnt wording. > > Yes, you used a bit different wording :) > >> 2) If I am not mistaken while reading the script, the CHERRY_PICK >> line >> should be part o

Re: [COMMITTED 0/4] bpf: backports to releases/gcc-10

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
> On 8/12/20 8:19 PM, Jose E. Marchesi wrote: >> Hi Martin. >> I left the changelog entry dates of the original commits untouched, and added `(cherry-pick from commit XXX)' lines to the commit messages. Hope that is ok... please let me know otherwise! >>> >>> Hello. >>> >>> For c

Re: [COMMITTED 0/4] bpf: backports to releases/gcc-10

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
Hi Martin. >> I left the changelog entry dates of the original commits untouched, >> and added `(cherry-pick from commit XXX)' lines to the commit >> messages. Hope that is ok... please let me know otherwise! > > Hello. > > For creating a backport please use contrib/git-backport.py script. > Th

[COMMITTED 1/4] bpf: add support for the -mxbpf option

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
This patch adds support for a new option -mxbpf. This tells GCC to generate code for an expanded version of BPF that relaxes some of the restrictions imposed by BPF. (cherry pick of 51e10276d6792f67f1d88d90f299e7ac1b1f1f24) 2020-05-19 Jose E. Marchesi gcc/ * config/bpf/bpf.opt (mxbpf

[COMMITTED 0/4] bpf: backports to releases/gcc-10

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
Hi people! Just a few BPF related backports from master to the gcc-10 branch. I left the changelog entry dates of the original commits untouched, and added `(cherry-pick from commit XXX)' lines to the commit messages. Hope that is ok... please let me know otherwise! :) Salud! Jose E. Marchesi

[COMMITTED 2/4] bpf: do not save/restore callee-saved registers in function prolog/epilog

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
BPF considers that every call to a function allocates a fresh set of registers that are available to the callee, of which the first five may have bee initialized with the function arguments. This is implemented by both interpreter and JIT in the Linux kernel. This is enforced by the kernel BPF ve

[COMMITTED 3/4] bpf: more flexible support for kernel helpers

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
This patch changes the existing support for BPF kernel helpers to be more flexible, in two main ways. First, there is no longer a hardcoded list of kernel helpers defined in the compiler internals. This is replaced by a new target-specific attribute `kernel_helper' that the user can use to define

[COMMITTED 4/4] bpf: remove trailing whitespaces from source files

2020-08-12 Thread Jose E. Marchesi via Gcc-patches
This patch is a little cleanup that removes trailing whitespaces from the bpf backend source files. (cherry pick of commit e87c540fe43e29663140ed67b98ee437c25696bb) 2020-08-07 Jose E. Marchesi gcc/ * config/bpf/bpf.md: Remove trailing whitespaces. * config/bpf/constraints.md:

[COMMITTED] bpf: remove trailing whitespaces from source files

2020-08-07 Thread Jose E. Marchesi via Gcc-patches
This patch is a little cleanup that removes trailing whitespaces from the bpf backend source files. 2020-08-07 Jose E. Marchesi gcc/ * config/bpf/bpf.md: Remove trailing whitespaces. * config/bpf/constraints.md: Likewise. * config/bpf/predicates.md: Likewise. gcc/tests

[COMMITTED] bpf: more flexible support for kernel helpers

2020-08-06 Thread Jose E. Marchesi via Gcc-patches
This patch changes the existing support for BPF kernel helpers to be more flexible, in two main ways. First, there is no longer a hardcoded list of kernel helpers defined in the compiler internals. This is replaced by a new target-specific attribute `kernel_helper' that the user can use to define

Re: [PATCH v2] libiberty, include: add bsearch_r

2020-06-23 Thread Jose E. Marchesi via Gcc-patches
Hi Nick. libctf wants a bsearch that takes a void * arg pointer to avoid a nonportable use of __thread. bsearch_r is required, not optional, at this point because as far as I can see this obvious-sounding function is not implemented by anyone's libc. We can easily move

[COMMITTED 1/2] bpf: add support for the -mxbpf option

2020-05-19 Thread Jose E. Marchesi via Gcc-patches
This patch adds support for a new option -mxbpf. This tells GCC to generate code for an expanded version of BPF that relaxes some of the restrictions imposed by BPF. 2020-05-19 Jose E. Marchesi gcc/ * config/bpf/bpf.opt (mxbpf): New option. * doc/invoke.texi (Option Summary):

[COMMITTED 2/2] bpf: do not save/restore callee-saved registers in function prolog/epilog

2020-05-19 Thread Jose E. Marchesi via Gcc-patches
BPF considers that every call to a function allocates a fresh set of registers that are available to the callee, of which the first five may have bee initialized with the function arguments. This is implemented by both interpreter and JIT in the Linux kernel. This is enforced by the kernel BPF ve

[COMMITTED 0/2][BPF] Introduce -mxbpf and first extension

2020-05-19 Thread Jose E. Marchesi via Gcc-patches
Hi people! I just committed these two BPF-specific small patches. See each commit for a description. Hope I didn't screw up with the ChangeLog entries in the commit message! :) Salud! Jose E. Marchesi (2): bpf: add support for the -mxbpf option bpf: do not save/restore callee-saved registe

<    1   2   3