Bug ID 1178241
Summary Building cilium on x86_64 fails after LLVM 11 update
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Kubic
Assignee kubic-bugs@opensuse.org
Reporter aaronpuchert@alice-dsl.net
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

There is a new default warning, and cilium builds with -Werror:

/home/abuild/rpmbuild/BUILD/go/src/github.com/cilium/cilium/bpf/lib/dbg.h:168:13:
error: cast to smaller integer type '__u32' (aka 'unsigned int') from '__u32 *'
(aka 'unsigned int *') [-Werror,-Wpointer-to-int-cast]
                .source = EVENT_SOURCE,
                          ^~~~~~~~~~~~
bpf_lxc.c:21:22: note: expanded from macro 'EVENT_SOURCE'
#define EVENT_SOURCE LXC_ID
                     ^~~~~~
/home/abuild/rpmbuild/BUILD/go/src/github.com/cilium/cilium/bpf/lxc_config.h:28:16:
note: expanded from macro 'LXC_ID'
#define LXC_ID fetch_u32(LXC_ID)
               ^~~~~~~~~~~~~~~~~
/home/abuild/rpmbuild/BUILD/go/src/github.com/cilium/cilium/bpf/lib/utils.h:130:22:
note: expanded from macro 'fetch_u32'
#define fetch_u32(x) __fetch(x)
                     ^~~~~~~~~~
/home/abuild/rpmbuild/BUILD/go/src/github.com/cilium/cilium/bpf/lib/utils.h:122:21:
note: expanded from macro '__fetch'
# define __fetch(x) (__u32)(&(x))
                    ^~~~~~~~~~~~~

There are more occurrences. The warning seems valid to me: pointers on x86_64
are 64-bit wide, so the conversion to a 32-bit integer is lossy. If this is
intended, convert to uintptr_t first, then to __u32:

# define __fetch(x) (__u32)(uintptr_t)(&(x))

That might require #include <stdint.h>.

Generally only conversions to uintptr_t are guaranteed to have no information
loss, i.e. you can convert them back to a pointer and get the original pointer
back.

LLVM 11 is currently staged in K, so you can see the full log here:
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:K/cilium/standard/x86_64


You are receiving this mail because: