quest: check-android-static-init refuses __init_cpu_features in the sentinel shim on NDK r30

Open
#2,895 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, cmake, cpp

Research direction

Read tools/check_quest_static_init.sh and use tools/quest_link_objects.py with llvm-nm to identify which link input defines __init_cpu_features in the shim. Confirm it is the NDK CPU feature constructor, then update the shim allow list and add a case that fails when the name is missing. Run just check-android-static-init and just build-android-observe with the pinned NDK r30; done when both exit 0.

Written by the indexing model from the issue text.

Description

backlog bug

just build-android-observe (added by #2875) and the plain shim's static-init check both exit 1 on the NDK r30 toolchain. The shim's .init_array holds an initializer named __init_cpu_features, and tools/check_quest_static_init.sh accepts that name only in its plugin branch.

Evidence at fe99a482a

Built in the #2875 worktree at fe99a482a, plus the android-arm64-observe preset, with ANDROID_NDK_HOME set to the NDK r30 that tools/ndk.pin names:

  • just build-android-observe compiles and links, then exits 1 in its shim check:
    check_quest_static_init: build/android-observe/sentinel/libovrplatformloader.so: .init_array entry 0x5b9220 (__init_cpu_features) is not an expected initializer; use a function-local static
  • llvm-nm --defined-only build/android-observe/sentinel/libovrplatformloader.so defines __init_cpu_features as a local function at 00000000005b9220, the address of that entry.
  • The same check on the plain shim, build/android-arm64/sentinel/libovrplatformloader.so (its CMake cache points at the same NDK r30 toolchain), exits 1 with the same symbol at 0x5b9210.
  • tools/check_quest_static_init.sh:41 accepts __init_cpu_features only in the plugin branch, which checks the runtime library. Line :43, the shim's list, names init_have_lse_atomics, init_cpu_features and the sentinel constructor only.
  • The runtime library passes on the same toolchain: check_quest_static_init: OK (2 .init_array entries in build/android-observe/sentinel/libnevr-runtime.so, 286 object files).

Each shim log holds exactly one failing entry. The four _GLOBAL__sub_I_* initializers of #2664 are not in either shim at this tip, so #2664 is a different failure.

Not shown

  • Whether every NDK r30 arm64 shim carries __init_cpu_features. Only the two trees above were checked.
  • Whether this check ever passed on an earlier NDK. No run in the tree records one.
  • Whether the manual Android workflow fails the same way in CI. Not measured.

Falsifier

An NDK r30 build of the shim whose .init_array holds __init_cpu_features and on which just check-android-static-init exits 0.

Work

  1. Find the link input that defines __init_cpu_features in the shim, with tools/quest_link_objects.py and llvm-nm. If it is the NDK's CPU-feature constructor, the shim's allow list at tools/check_quest_static_init.sh:43 is stale for r30.
  2. If it is the NDK's constructor, add that name to the shim's allow list with the comment the plugin branch carries, and add a case that fails when the name is missing.
  3. If it is not, remove that input from the shim's link.
  4. just check-android-static-init and just build-android-observe exit 0 on NDK r30.

Found while building the observe preset (#2875). Related: #2664 (four user-code initializers, a different failure).

Dominant language
C++
Stars
3
Forks
5
Avg merge
4h 37m
Merged PRs (30d)
524

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EchoTools/nevr-runtime

All issues in EchoTools/nevr-runtime

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.