This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fix aligned_alloc usage for Android
ClosedPublic

Authored by smeenai on Jan 6 2023, 11:36 PM.

Details

Summary

Android only provides this function on API 28+; fix libc++ builds when
targeting older API levels.

Diff Detail

Event Timeline

smeenai created this revision.Jan 6 2023, 11:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 11:36 PM
smeenai requested review of this revision.Jan 6 2023, 11:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2023, 11:36 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik accepted this revision.Jan 7 2023, 1:06 AM
philnik added a subscriber: philnik.

LGTM assuming D139147 is being worked on.

This revision is now accepted and ready to land.Jan 7 2023, 1:06 AM
arichardson accepted this revision.Jan 7 2023, 3:00 AM
hans added a subscriber: hans.Jan 10 2023, 2:24 AM

LGTM assuming D139147 is being worked on.

I'm not involved with that effort directly (I work on Meta's Android compiler team, whereas @rprichard is on the Android NDK team at Google), but I understand wanting a buildbot to test this configuration. I can't speak on his behalf, but I trust that Ryan will work on that actively once holiday season is wrapped up.

This revision was automatically updated to reflect the committed changes.

LGTM assuming D139147 is being worked on.

I'm not involved with that effort directly (I work on Meta's Android compiler team, whereas @rprichard is on the Android NDK team at Google), but I understand wanting a buildbot to test this configuration. I can't speak on his behalf, but I trust that Ryan will work on that actively once holiday season is wrapped up.

Yeah I'll be resuming work on that soon.

The D139147 configuration currently only tests a configuration where libc++ is built against API21 and run on an API33 emulator. I think(?) that would be sufficient to catch this issue because the API21 headers and libc.so stub wouldn't have an aligned_alloc function? The emulator image would have one in its /system/lib64/libc.so though.

This change looks OK to me.