Skip to content

Add mallopt and related constants for Android #4459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chriswailes
Copy link

@chriswailes chriswailes commented May 23, 2025

Description

This change adds constants that can be passed to BIONIC's implementation of mallopt

Sources

Constant definitions in BIONIC source: https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/malloc.h;l=215

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented May 23, 2025

Some changes occurred in the Android module

cc @maurer

@chriswailes chriswailes changed the title Add mallopt related constants for Android Add mallopt and related constants for Android May 23, 2025
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@rustbot label +stable-nominated

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label May 28, 2025
@tgross35 tgross35 enabled auto-merge May 28, 2025 22:46
@tgross35 tgross35 force-pushed the mallopt-consts branch 2 times, most recently from 134e718 to 28abaf5 Compare June 1, 2025 22:24
The `HeapTaggingLevel` enum does not have a typedef alias and thus
generated tests will not compile due to the missing `enum` keyword.  As
a result the constants are defined using `i32` to match the signature
for `mallopt`.

See: https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/malloc.h;l=215
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chriswailes is this a newer change? It looks like there is a CI failure:

      Running test/main.rs (target/aarch64-linux-android/debug/deps/main-eb05d161ceda646b)
/checkout/target/aarch64-linux-android/debug/deps/main-eb05d161ceda646b: 1 file pushed, 0 skipped. 8.0 MB/s (17585976 bytes in 2.098s)

status: exit status: 134
stdout ---

stderr ---
WARNING: linker: /data/local/tmp/main-eb05d161ceda646b: unsupported flags DT_FLAGS_1=0x8000001
CANNOT LINK EXECUTABLE "/data/local/tmp/main-eb05d161ceda646b": cannot locate symbol "mallopt" referenced by "/data/local/tmp/main-eb05d161ceda646b"...
Aborted 

If this is a newer version than we test with, you can add a skip in libc-test/build.rs.

@chriswailes
Copy link
Author

This change is failing presubmit because of the old versions of the emulator and system image used by the CI. I'm working on two possible solutions to this issue:

  1. Updating the emulator and system image used by the current CI setup
    • The update is complete but all emulator hangs, preventing any tests from being run
    • The emulator needs to be debugged
  2. Re-engineering the Android tests to use Cuttlefish images on the appropriate test hosts to avoid having to use QEMU

It's going to be a week or two until I'm able to put significant time into addressing the issue. If you'd like I can close this pull request and re-open it once the Android test infrastructure is updated.

@tgross35
Copy link
Contributor

tgross35 commented Jun 4, 2025

If you need the change here sooner, you can also add a skip in libc-test/build.rs and we can merge this.

It would be great to get the Android tests working better though. I don't know enough about it to know what the best solution is, but updates there would be very welcome at any time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-android O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants