+2017-10-04 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.h.in (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New.
+ * include/libc-symbols.h (__hidden_proto_hiddenattr): Add check
+ for PIC and NO_HIDDEN_EXTERN_FUNC_IN_PIE.
+ * sysdeps/i386/configure.ac (NO_HIDDEN_EXTERN_FUNC_IN_PIE): New
+ AC_DEFINE if multi-arch is enabled.
+ * sysdeps/i386/configure: Regenerated.
+
2017-10-04 H.J. Lu <hongjiu.lu@intel.com>
* Makeconfig (+link-static-before-libc): Use
and does not need relocations. */
#undef PI_STATIC_AND_HIDDEN
+/* Define this to disable the 'hidden_proto' et al macros in
+ include/libc-symbols.h that avoid PLT slots in PIE. */
+#undef NO_HIDDEN_EXTERN_FUNC_IN_PIE
+
/* Define this to disable the 'hidden_proto' et al macros in
include/libc-symbols.h that avoid PLT slots in the shared objects. */
#undef NO_HIDDEN
#else
# ifndef __ASSEMBLER__
# if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
+ && (!defined PIC || !defined NO_HIDDEN_EXTERN_FUNC_IN_PIE) \
&& !defined NO_HIDDEN
# define __hidden_proto_hiddenattr(attrs...) \
__attribute__ ((visibility ("hidden"), ##attrs))
cat > conftest.c <<EOF
int _start (void) { int a, b, c; __sync_val_compare_and_swap (&a, b, c); return 0; }
EOF
-if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+if ! { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
-O0 -nostdlib -nostartfiles
-S conftest.c -o - | fgrep "__sync_val_compare_and_swap"
1>&5'
$as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
+
+if test x"$multi_arch" != xno; then
+ $as_echo "#define NO_HIDDEN_EXTERN_FUNC_IN_PIE 1" >>confdefs.h
+
+fi
dnl It is always possible to access static and hidden symbols in an
dnl position independent way.
AC_DEFINE(PI_STATIC_AND_HIDDEN)
+
+dnl When multi-arch is enabled, all external functions must be called
+dnl via PIC PLT in PIE, which requires setting up EBX register.
+if test x"$multi_arch" != xno; then
+ AC_DEFINE(NO_HIDDEN_EXTERN_FUNC_IN_PIE)
+fi