Issue 239336
Summary Aarch64 with -target bpf creates non-deterministic compiler output
Labels new issue
Assignees
Reporter jspricke
    I debugged that [bpfcc](https://github.com/iovisor/bcc) is not [reproducible](https://reproduce.debian.net/arm64/api/v1/builds/533479/artifacts/1382168/diffoscope) in Debian and found that clang creates non-deterministic compiler output. A minimal reproducer on Debian is:
```
#include <linux/bpf/vmlinux.h>
#include <bpf/bpf_core_read.h>

struct request___x {
	struct gendisk *rq_disk;
};

void block_rq_insert_btf(u64 *ctx)
{
	struct request___x *r = (void *)ctx[0];
	struct gendisk *disk = BPF_CORE_READ(r, rq_disk);

	BPF_CORE_READ(disk, major);
}
```
which can be tested with:
```
 $ mmdebstrap --variant=essential --include=clang,libbpf-dev,linux-bpf-dev \
    --customize-hook='upload input.c /input.c' \
    --chrooted-customize-hook='while :; do clang -Wno-missing-declarations -g -target bpf \
 -I/usr/include/aarch64-linux-gnu -c input.c; cksum input.o; done' \
 unstable /dev/null
```

it creates different results within 20 tries for me. I tested with clang-21, 23 and 24 (1:24~++20261025103442+7e3c57157096-1~exp1) from Debian. A minimal example without includes is: [biolatency.bpf.min.c](https://github.com/user-attachments/files/34441620/biolatency.bpf.min.c).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to