Merge "Don't use the overloadable attribute if we're not fortified."

This commit is contained in:
Elliott Hughes 2017-06-15 15:06:34 +00:00 committed by Gerrit Code Review
commit 112581a5e0
1 changed files with 15 additions and 5 deletions

View File

@ -303,13 +303,23 @@
#define __pass_object_size __pass_object_size_n(__bos_level)
#define __pass_object_size0 __pass_object_size_n(0)
/* Used to support clangisms with FORTIFY. This isn't in the FORTIFY section
* because these change how symbols are emitted. The linker must be kept happy.
/*
* Used to support clangisms with FORTIFY. Because these change how symbols are
* emitted, we need to ensure that bionic itself is built fortified. But lots
* of external code (especially stuff using configure) likes to declare
* functions directly, and they can't know that the overloadable attribute
* exists. This leads to errors like:
*
* dcigettext.c:151:7: error: redeclaration of 'getcwd' must have the 'overloadable' attribute
* char *getcwd ();
* ^
*
* To avoid this and keep such software building, don't use overloadable if
* we're not using fortify.
*/
#ifdef __clang__
#if defined(__clang__) && defined(__BIONIC_FORTIFY)
# define __overloadable __attribute__((overloadable))
// Don't use __RENAME directly because on gcc, this could result in a number of
// unnecessary renames.
/* We don't use __RENAME directly because on gcc this could result in unnecessary renames. */
# define __RENAME_CLANG(x) __RENAME(x)
#else
# define __overloadable