meson: generate better arch defines for clang bpf compilation
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Jan 2022 17:38:23 +0000 (18:38 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 4 Jan 2022 00:18:47 +0000 (00:18 +0000)
commite897b07f97cf25e092a4cc8e1144e06564b45d53
tree82ecfe1aabe5d81e519ae93b1f4f02ca9e4aa106
parentc9b1efdf146bef4e1aace1f3ff9076583e8fa709
meson: generate better arch defines for clang bpf compilation

The code assume that meson's cpu_family can be mapped directly to
'-D__<cpu_family>__'. This works in a surprising number of cases, but not for a
few architectures. PPC uses "powerpc", and RISC-V omits the trailing underscores.
ARM and RISC-V require a second define too.

Fixes #21900.

(I don't think this matters too much: we need *something* so that gnu/stubs.h
can be successfully included. But we don't actually call syscalls or depend too
much on the host environment, so things should be fine as long as we don't get
a compilation error.)
src/core/bpf/meson.build