diff options
author | David 'Digit' Turner <digit@google.com> | 2014-06-13 12:28:11 +0200 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2014-06-16 13:10:20 -0700 |
commit | 891dedb935b50f1abb39eedfe33049a1e49283cb (patch) | |
tree | 8066a42ec9e07537607254deb91195fb9d102a88 /libc/arch-x86 | |
parent | 4fb0d4fb312ed696081200e65ce9bf643928e5e6 (diff) | |
download | bionic-891dedb935b50f1abb39eedfe33049a1e49283cb.zip bionic-891dedb935b50f1abb39eedfe33049a1e49283cb.tar.gz bionic-891dedb935b50f1abb39eedfe33049a1e49283cb.tar.bz2 |
libc: Fix 'index' symbol export.
The C library didn't export the 'index' symbol, but its C++ name-mangling
instead, which broke the ABI and prevented some applications from loading
properly.
The main reason was that the implementation under bionic/index.cpp relied
on the declaration to specify that the function has C linkage.
However, the declaration for index() was removed from both <string.h>
and <strings.h> in a recent patch, which made the compiler think it was
ok to compile the function with C++ linkage instead!
This patch does the following:
- Move index() definition to bionic/ndk_cruft.cpp and ensure it uses
C linkage.
Note that this removes index() from the 64-bit library entirely, this
is intentional and will break source compatibility. Simply replacing
an index() call with the equivalent strchr() should be enough to fix
this in third-party code.
- Remove bionic/index.cpp from the tree and build files.
- Remove x86 assembly implementation from arch-x86/ to avoid conflict
with the one in ndk_cruft.cpp
BUG=15606653
Change-Id: I816b589f69c8f8a6511f6be6195d20cf1c4e8123
Diffstat (limited to 'libc/arch-x86')
-rw-r--r-- | libc/arch-x86/atom/atom.mk | 1 | ||||
-rw-r--r-- | libc/arch-x86/atom/string/sse2-index-atom.S | 32 | ||||
-rw-r--r-- | libc/arch-x86/generic/generic.mk | 1 | ||||
-rw-r--r-- | libc/arch-x86/silvermont/silvermont.mk | 1 |
4 files changed, 0 insertions, 35 deletions
diff --git a/libc/arch-x86/atom/atom.mk b/libc/arch-x86/atom/atom.mk index abe940d..3f28fb2 100644 --- a/libc/arch-x86/atom/atom.mk +++ b/libc/arch-x86/atom/atom.mk @@ -1,6 +1,5 @@ libc_bionic_src_files_x86 += \ arch-x86/atom/string/sse2-bzero-atom.S \ - arch-x86/atom/string/sse2-index-atom.S \ arch-x86/atom/string/sse2-memchr-atom.S \ arch-x86/atom/string/sse2-memrchr-atom.S \ arch-x86/atom/string/sse2-memset-atom.S \ diff --git a/libc/arch-x86/atom/string/sse2-index-atom.S b/libc/arch-x86/atom/string/sse2-index-atom.S deleted file mode 100644 index d51e1d4..0000000 --- a/libc/arch-x86/atom/string/sse2-index-atom.S +++ /dev/null @@ -1,32 +0,0 @@ -/* -Copyright (c) 2011, Intel Corporation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * Neither the name of Intel Corporation nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define strchr index -#include "sse2-strchr-atom.S" diff --git a/libc/arch-x86/generic/generic.mk b/libc/arch-x86/generic/generic.mk index 62e81b7..4aee5dc 100644 --- a/libc/arch-x86/generic/generic.mk +++ b/libc/arch-x86/generic/generic.mk @@ -1,5 +1,4 @@ libc_bionic_src_files_x86 += \ - arch-x86/atom/string/sse2-index-atom.S \ arch-x86/atom/string/sse2-memchr-atom.S \ arch-x86/atom/string/sse2-memrchr-atom.S \ arch-x86/atom/string/sse2-strchr-atom.S \ diff --git a/libc/arch-x86/silvermont/silvermont.mk b/libc/arch-x86/silvermont/silvermont.mk index 9640a24..176bee3 100644 --- a/libc/arch-x86/silvermont/silvermont.mk +++ b/libc/arch-x86/silvermont/silvermont.mk @@ -17,7 +17,6 @@ libc_bionic_src_files_x86 += \ arch-x86/atom/string/sse2-memrchr-atom.S \ arch-x86/atom/string/sse2-strchr-atom.S \ arch-x86/atom/string/sse2-strrchr-atom.S \ - arch-x86/atom/string/sse2-index-atom.S \ arch-x86/atom/string/sse2-strnlen-atom.S \ arch-x86/atom/string/sse2-wcschr-atom.S \ arch-x86/atom/string/sse2-wcsrchr-atom.S \ |