[llvm-bugs] [Bug 52390] New: clang -O2 BPF netd.o failed to boot on some Android devices

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 3 13:19:26 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52390

            Bug ID: 52390
           Summary: clang -O2 BPF netd.o failed to boot on some Android
                    devices
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chh at google.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 25418
  --> https://bugs.llvm.org/attachment.cgi?id=25418&action=edit
zip of netd.i.c, netd.old.s, netd.new.s

When upgrading Android's prebuilt clang/llvm compiler tools,
we found boot failures on some but not all ARM devices.
We tried to revert one change https://reviews.llvm.org/D107281
and then passed booting on all failing devices.

We found that D107281 changed -O2 output of Android's
system/netd/bpf_progs/netd.c. By replacing that .o file
with one compiled by older compiler, or with only -O1,
Android can boot again on the failing devices.

Without knowing the exact impact of D107281 on BPF and specific
ARM devices, we are looking for reverting this change at least
for the Android platform and/or BPF target.
Could someone take a look of the attached output files and suggest a fix?

(1) netd.i.c    (preprocessed file from AOSP)
(2) netd.old.s  (compiled by older clang without D107281)
(3) netd.new.s  (compiled by clang with D107281, fail to boot)

The files are generated from AOSP source tree:

prebuilts/clang/host/linux-x86/clang-r433403b/bin/clang \
--target=bpf -nostdlibinc -no-canonical-prefixes \
-O2 -isystem bionic/libc/include \
-isystem bionic/libc/kernel/uapi \
-isystem bionic/libc/kernel/uapi/asm-arm64 \
-isystem bionic/libc/kernel/android/uapi \
-I system/core/libcutils/include \
-I system/bpf/progs/include \
-I system/netd/bpf_progs \
-I system/netd/libnetdbpf/include \
-I system/netd/libnetdutils/include \
system/netd/bpf_progs/netd.c \
-E -o /tmp/netd.i.c

# use clang without D107281, or with AOSP prebuilt clang
prebuilts/clang/host/linux-x86/clang-r433403b/bin/clang \
--target=bpf -nostdlibinc -no-canonical-prefixes -O2 \
/tmp/netd.i.c -S -o /tmp/netd.old.s

# use the latest clang or a version after D107281:
clang --target=bpf -nostdlibinc -no-canonical-prefixes -O2 \
/tmp/netd.i.c -S -o /tmp/netd.new.s

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211103/5061a50d/attachment.html>


More information about the llvm-bugs mailing list