mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
45ae17dd7e
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>
39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
#ifndef _SYS_CDEFS_H
|
|
|
|
#include <misc/sys/cdefs.h>
|
|
|
|
#ifndef _ISOMAC
|
|
/* The compiler will optimize based on the knowledge the parameter is
|
|
not NULL. This will omit tests. A robust implementation cannot allow
|
|
this so when compiling glibc itself we ignore this attribute. */
|
|
# undef __nonnull
|
|
# define __nonnull(params)
|
|
|
|
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
|