Skip to content
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

replace libandroid_support implementations with bionic #300

Closed
DanAlbert opened this issue Feb 16, 2017 · 2 comments
Closed

replace libandroid_support implementations with bionic #300

DanAlbert opened this issue Feb 16, 2017 · 2 comments
Assignees
Milestone

Comments

@DanAlbert
Copy link
Member

We should be able to make libc++ in the NDK as reliable as the one in the platform by improving libandroid_support (since that's where most of the bugs have come from). Our best bet will be to replace libandroid_support's source with bionic's, since that's quite well tested.

@DanAlbert DanAlbert added this to the r15 milestone Feb 16, 2017
@DanAlbert DanAlbert self-assigned this Feb 16, 2017
@DanAlbert
Copy link
Member Author

Isn't going to make it for r15 since O is taking up all the time for that release. Pushing to r16.

@DanAlbert DanAlbert modified the milestones: r16, r15 May 5, 2017
hubot pushed a commit to aosp-mirror/platform_bionic that referenced this issue Jul 13, 2017
libandroid_support shouldn't be using Bionic's TLS slot. Add a
thread_local based implementation. We can't use the thread_local
implementation in bionic because the linker needs this and pthread
thread-locals (which is how thread_local is implemented) doesn't work
that early.

Test: make checkbuild
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Bug: android/ndk#300
Change-Id: I7dcbf554ade2264d541d722fa3f86df04926e67a
@DanAlbert
Copy link
Member Author

There's more testing for me to do here, but all the old libandroid_support code is gone now.

miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Apparently we don't need these.

Test: ./validate.py
Bug: android/ndk#300
Change-Id: Ie48c59795e65880f620b20270b55a0f8b9c159ff
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Historically this is where the libandroid_support bugs are. The only
things we lose by dropping this is support for %a in printf and
functioning versions of *wprintf functions.

Parts of libc++ that rely on the former are just being marked XFAIL
for the moment (it's only needed for serialization of RNG state to
stringstreams, something that doesn't seem all that important). We'll
pick up Bionic's *sprintf family later to fix this.

We've actually had definitions for the latter forever, but they just
return -1 and set errno to ENOTSUP. The functions existing but not
working actually causes std::to_wstring to OOM (it allocates an
increasingly large wstring until it finds one that doesn't fail, and
never does), which in turn causes OOM killer to kill the device.

We can avoid this by implementing swprintf in terms of snprintf, using
wcsrtombs and mbsrtowcs to translate. The only thing that doesn't work
in this case is %ls. Since we're delegating to the device's snprintf,
that will not work on old devices, but will work on new devices, so
this only improves functionality.

We need to pull in part of bionic's wide character implementation for
this, because musl's isn't correct.

Also disable a %a test for pre-L. We didn't have support for this
until L, and it's temporarily being removed from libandroid_support.

Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#300
Bug: android/ndk#437
Change-Id: Ic70c0d3f6f439de2e1c19027ec4fd3d37b766f77
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
All we need from this is iswblank, for which we can trivially provide
our own definition.

Test: ./run_tests.py
Bug: android/ndk#300
Change-Id: I47ff80c27e0d475b7275c2c791a7ce1841b1a1ed
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
We only need a small handful of these now, and only on LP64.

Test: ./run_tests.py
Bug: android/ndk#300
Change-Id: I1e1f956bab4f3a28b6cdd89868d9ed43d8ec1cf9
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
We don't need two of these, and the other deserves a static_assert.

Test: ./run_tests.py
Bug: android/ndk#300
Change-Id: I76939d3bfb1a19e16fef737a0425bc173259cdd6
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Some of this was from musl, some was from bionic, but the bionic code
is likely out of date. Pull it all from bionic.

Test: ./run_tests.py
Bug: android/ndk#300
Change-Id: Iff9d65c4ad21f91f5fa05724c50005bf6d40f2aa
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
The old code worked fine for our limited use cases, but didn't match
with the bionic tests' expected values.

Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#300
Change-Id: If94b56275ae86ce84e9d0e48f0118eb3b0fb224e
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#300
Change-Id: I9177f06e80c839a807f1fd475bcedac9837137c5
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
It's over now, mister Frodo.

Test: ./checkbuild.py && ./run_tests.py
Bug: android/ndk#300
Change-Id: I708d8e4eca491488cc2bd7387fe2da90a45f2d8d
miodragdinic pushed a commit to MIPS/ndk that referenced this issue Apr 17, 2018
Test: None, markdown only
Bug: android/ndk#300
Change-Id: Id3f96927889834d23f7b0dbd0abb8eb931145dea
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
No functional change intended. This just rearranges some pieces of
stdio so we can build them with the NDK (as part of
libandroid_support).

The definition of struct __sFILE is moved to stdio/bits/struct_file.h.
When building for older API levels, stdio.h includes the public
version of this header and gets a definition which conflicts with
ours. Match the public header name so we can shadow it.

The definition of fpos_t moves into bits/fpos_t.h to accommodate for
the above.

Move __sglue into its own source file. We don't need the rest of
stdio.cpp (and don't want duplicates of things like __sF).

Move the *wprintf family into their own source file for the same
reason. We may end up doing this with more functions, but for now all
libandroid_support needs is the *wprintf family.

Test: make checkbuild
Test: Able to add vswprintf.c and wprintf.cpp (and everything they
      need) to libandroid_support and pass libc++ tests in the NDK.
Bug: android/ndk#300

Change-Id: I4127071906fc9dacf40e41cff35e403b48ba297c
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
No functional change intended. This just rearranges some pieces of
stdio so we can build them with the NDK (as part of
libandroid_support).

The definition of struct __sFILE is moved back into
bits/struct_file.h. When building for older API levels, stdio.h
includes the public version of this header and gets a definition which
conflicts with ours. We could move this to stdio/bits/stdio.h to
shadow it, or just put it back in the public header. We're
essentially stuck with things the way they are anyway, and putting it
back lets gnulib build against the NDK again.

Move __sglue into its own source file. We don't need the rest of
stdio.cpp (and don't want duplicates of things like __sF).

Move the *wprintf family into their own source file for the same
reason. We may end up doing this with more functions, but for now all
libandroid_support needs is the *wprintf family.

Test: make checkbuild
Test: Able to add vswprintf.c and wprintf.cpp (and everything they
      need) to libandroid_support and pass libc++ tests in the NDK.
Bug: android/ndk#300

Change-Id: I4127071906fc9dacf40e41cff35e403b48ba297c
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
No functional change intended. This just rearranges some pieces of
stdio so we can build them with the NDK (as part of
libandroid_support).

The definition of struct __sFILE is moved back into
bits/struct_file.h. When building for older API levels, stdio.h
includes the public version of this header and gets a definition which
conflicts with ours. We could move this to stdio/bits/stdio.h to
shadow it, or just put it back in the public header. We're
essentially stuck with things the way they are anyway, and putting it
back lets gnulib build against the NDK again.

Move __sglue into its own source file. We don't need the rest of
stdio.cpp (and don't want duplicates of things like __sF).

Move the *wprintf family into their own source file for the same
reason. We may end up doing this with more functions, but for now all
libandroid_support needs is the *wprintf family.

Test: make checkbuild
Test: Able to add vswprintf.c and wprintf.cpp (and everything they
      need) to libandroid_support and pass libc++ tests in the NDK.
Bug: android/ndk#300

Change-Id: I4127071906fc9dacf40e41cff35e403b48ba297c
sepehrst pushed a commit to spsforks/android-bionic-libc that referenced this issue Apr 22, 2024
No functional change intended. This just rearranges some pieces of
stdio so we can build them with the NDK (as part of
libandroid_support).

The definition of struct __sFILE is moved back into
bits/struct_file.h. When building for older API levels, stdio.h
includes the public version of this header and gets a definition which
conflicts with ours. We could move this to stdio/bits/stdio.h to
shadow it, or just put it back in the public header. We're
essentially stuck with things the way they are anyway, and putting it
back lets gnulib build against the NDK again.

Move __sglue into its own source file. We don't need the rest of
stdio.cpp (and don't want duplicates of things like __sF).

Move the *wprintf family into their own source file for the same
reason. We may end up doing this with more functions, but for now all
libandroid_support needs is the *wprintf family.

Test: make checkbuild
Test: Able to add vswprintf.c and wprintf.cpp (and everything they
      need) to libandroid_support and pass libc++ tests in the NDK.
Bug: android/ndk#300

Change-Id: I4127071906fc9dacf40e41cff35e403b48ba297c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant