[libcxx-commits] [PATCH] D131792: [libunwind] Remove __ANDROID_API__ < 18 workaround

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 1 16:41:46 PDT 2022


rprichard added a comment.

This particular workaround seems fairly inexpensive and self-contained, so I wouldn't object to keeping it around. Though, would LLVM have to keep it around forever then?

Maybe in other parts of LLVM, it's harder to support older API levels, so it'd be nice there to require newer API levels (and let downstream users maintain support themselves if they need it). For example, I'm currently working on getting libc++ tests working on Android (and switching to using CMake to build Android's libc++), and there are some troublesome Android bugs I've run into that were fixed in API 21. I managed to come up with workarounds for older devices, but they're hairy/annoying, and since the next NDK release is likely to raise the minimum supported SDK to 21 anyway, I was planning to omit the workarounds.

Examples:

- I wrote an `adb_run.py` script that syncs a directory and runs an executable. There's a bug <https://issuetracker.google.com/36989613> in pre-21 devices where adbd leaks FDs on the device, which results in ETXTBSY errors. I have a horrid workaround that involves scanning `/proc/*/fd/*`, but it's unnecessary if we require API 21 to run the tests.
- There are a bunch of floating-point printf bugs that were fixed in API 21 (and one more in 23). At the moment, I have a separate feature test <https://gist.github.com/rprichard/3dad0e334cef31e2ec284666fe975cd9> for each bug in libcxx/utils/libcxx/test/features.py, but I'm planning to omit most of them.
- The NDK will drop libandroid_support.a once API 21 is the minimum SDK version. LLVM knows that it has to link libc++.so against libandroid_support.a, but it links libandroid_support.a *after* libc whereas I think the NDK always links it before libc. This turns out to matter because the KitKat libc.so stubs expose swprintf, and the swprintf on that Android version just returns ENOTSUP. libandroid_support.a defines a real swprintf, but it needs to come first to override libc.so. I can upload my patch fixing the link order. (This bug can be fixed easily, but it demonstrates how it could be expensive to keep around something as simple as `target_link_libraries(${target} PUBLIC android_support)`. See D73516 <https://reviews.llvm.org/D73516>.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131792/new/

https://reviews.llvm.org/D131792



More information about the libcxx-commits mailing list