-
Notifications
You must be signed in to change notification settings - Fork 268
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
<strings.h> ffs probably used to work by accident on x86 #439
Comments
hubot
pushed a commit
to aosp-mirror/platform_bionic
that referenced
this issue
Jul 10, 2017
<strings.h>'s ffs used to work by accident. In the past, <strings.h> used to incorrectly declare ffs for all platforms at all API levels. In the unified headers, there's no such declaration for x86 before API 18 (which makes sense, because that function was missing on x86 until then). But as long as there was a declaration for ffs, the compiler just inlined __builtin_ffs. There was no problem at link time because the compiler didn't actually add a reference to the missing ffs symbol. Restore the old behavior by manually instructing the compiler to inline its builtin in these cases. Bug: android/ndk#439 Test: built new NDK 'ffs' test Change-Id: I840e99f237c86f7cb028a0f67aaa8c6ff3eda245
danalbert cherrypicked this for r15c, so marking closed. |
miodragdinic
pushed a commit
to MIPS/ndk
that referenced
this issue
Apr 17, 2018
This test requires <android/legacy_strings_inlines.h>. Bug: android/ndk#439 Test: ./run_tests.py --filter ffs --rebuild --toolchain clang --ndk /usr/local/google/android-ndk-hacked Change-Id: I2e6ee1daeca626e0ba739374f4b662ac61438a63
sepehrst
pushed a commit
to spsforks/android-bionic-libc
that referenced
this issue
Apr 22, 2024
<strings.h>'s ffs used to work by accident. In the past, <strings.h> used to incorrectly declare ffs for all platforms at all API levels. In the unified headers, there's no such declaration for x86 before API 18 (which makes sense, because that function was missing on x86 until then). But as long as there was a declaration for ffs, the compiler just inlined __builtin_ffs. There was no problem at link time because the compiler didn't actually add a reference to the missing ffs symbol. Restore the old behavior by manually instructing the compiler to inline its builtin in these cases. Bug: android/ndk#439 Test: built new NDK 'ffs' test Change-Id: I840e99f237c86f7cb028a0f67aaa8c6ff3eda245
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we had an internal report of someone having trouble building some ffs-using code for x86 after they upgraded to r15b. i suspect this was because of the switch to unified headers. in the past, strings.h used to declare ffs for all platforms at all API levels. in the more correct unified headers, there's no such declaration for x86 before API 18.
but --- i think as long as there was a declaration the compiler will have just said "ffs? i know ffs!" and inlined
__builtin_ffs
and not had any problem at link-time because it wasn't actually adding a reference to the missing symbol.i think we should probably add a <android/legacy_strings_inlines.h> with a
static inline
that just calls__builtin_ffs
(which is all the libc ffs is anyway).The text was updated successfully, but these errors were encountered: