about summary refs log tree commit diff
path: root/include/sys
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2020-02-07 14:07:55 -0600
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2020-03-25 14:34:23 -0500
commit45ae17dd7ed3b9dea0d698d1c37a978d8d0a9aa2 (patch)
tree3bcf36847e060d0af834270805e9cddf76cc178e /include/sys
parent4eda036f5b897fa8bc20ddd2099b5a6ed4239dc9 (diff)
downloadglibc-45ae17dd7ed3b9dea0d698d1c37a978d8d0a9aa2.tar.gz
glibc-45ae17dd7ed3b9dea0d698d1c37a978d8d0a9aa2.tar.xz
glibc-45ae17dd7ed3b9dea0d698d1c37a978d8d0a9aa2.zip
ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally
Tweak the PLT bypass magic when building glibc with long double
redirects.  This is made more difficult by the fact we only get
one chance to redirect functions.  This happens via the public
headers.

There are roughly three classes of redirect we need to attend to
today:

 1. Simple redirects, redirected via cdef macro overrides and
    and new libc_hidden_ldbl_proto macro.
 2. Internal usage of internal API, e.g __snprintf, which has
    no direct analogue.  This is bypassed directly on case-by-
    case basis.
 3. Double redirects, e.g sscanf and related.  These require
    a heavier handed approach of macro renaming to existing
    symbols.

Most simple redirects are handled via 1.  Ideally, the libc_*
macro would live in libc-symbols.h, but in practice the macros
needed for it to do anything useful live in cdefs.h, so they
are defined in the local override.

Notably, the internal name of the asprintf generated for ieee ldbl
redirects is renamed to work with internal prefixed usage.

This resolves the local plt usage introduced when building glibc
with ldbl == ieee128 on ppc64le.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/cdefs.h20
-rw-r--r--include/sys/syslog.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index 524fe57a25..9f44ac5a0a 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -13,6 +13,26 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
 libc_hidden_proto (__chk_fail)
 rtld_hidden_proto (__chk_fail)
 
+/* If we are using redirects internally to support long double,
+   we need to tweak some macros to ensure the PLT bypass tricks
+   continue to work in libc. */
+#if __LONG_DOUBLE_USES_FLOAT128 == 1 && IS_IN (libc) && defined SHARED
+
+# undef __LDBL_REDIR_DECL
+# define __LDBL_REDIR_DECL(func) \
+   extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func));
+
+# undef libc_hidden_ldbl_proto
+# define libc_hidden_ldbl_proto(func, attrs...) \
+   extern __typeof(func) ___ieee128_ ## func; \
+   libc_hidden_proto (___ieee128_ ## func, ##attrs);
+
+# undef __LDBL_REDIR2_DECL
+# define __LDBL_REDIR2_DECL(func) \
+   extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func));
+
 #endif
 
+#endif /* !defined _ISOMAC */
+
 #endif
diff --git a/include/sys/syslog.h b/include/sys/syslog.h
index 89d3479ebc..44422eab13 100644
--- a/include/sys/syslog.h
+++ b/include/sys/syslog.h
@@ -3,7 +3,7 @@
 #include <misc/sys/syslog.h>
 #ifndef _ISOMAC
 
-libc_hidden_proto (syslog)
+libc_hidden_ldbl_proto (syslog)
 
 /* __vsyslog_internal uses the same mode_flags bits as
    __v*printf_internal; see libio/libioP.h.  */