+2016-11-30 Florian Weimer <fweimer@redhat.com>
+
+ Remove __libc_memalign from ld.so because it is unused.
+ * elf/dl-minimal.c: Update comment on the malloc implementation.
+ (malloc): Renamed from __libc_memalign, replacing the original
+ malloc implementation. Replace the align parameter with
+ MALLOC_ALIGNMENT.
+ * elf/Versions (ld): Update comment and remove __libc_memalign.
+ * sysdeps/nacl/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/alpha/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/arm/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/hppa/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/i386/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/ia64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/m68k/coldfire/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/m68k/m680x0/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/mips/mips64/n64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/nios2/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sh/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/tile/tilepro/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/64/ld.abilist: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist: Likewise.
+ * sysdeps/generic/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/alpha/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/arm/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/hppa/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/i386/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/ia64/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/m68k/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/microblaze/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/nios2/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/localplt.data
+ (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/localplt.data
+ (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/localplt.data (ld.so):
+ Likewise.
+ * sysdeps/unix/sysv/linux/s390/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/sh/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data (ld.so): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data (ld.so): Likewise.
+ * sysdeps/x86_64/localplt.data (ld.so): Likewise.
+
2016-11-30 Florian Weimer <fweimer@redhat.com>
[BZ #16628]
ld {
GLIBC_2.0 {
- # Function from libc.so which must be shared with libc.
- __libc_memalign; calloc; free; malloc; realloc;
+ # Functions which are interposed from libc.so.
+ calloc; free; malloc; realloc;
_r_debug;
}
#include <assert.h>
-/* Minimal `malloc' allocator for use while loading shared libraries.
- No block is ever freed. */
+/* Minimal malloc allocator for used during initial link. After the
+ initial link, a full malloc implementation is interposed, either
+ the one in libc, or a different one supplied by the user through
+ interposition. */
static void *alloc_ptr, *alloc_end, *alloc_last_block;
/* Allocate an aligned memory block. */
void * weak_function
-__libc_memalign (size_t align, size_t n)
+malloc (size_t n)
{
if (alloc_end == 0)
{
}
/* Make sure the allocation pointer is ideally aligned. */
- alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + align - 1)
- & ~(align - 1));
+ alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + MALLOC_ALIGNMENT - 1)
+ & ~(MALLOC_ALIGNMENT - 1));
if (alloc_ptr + n >= alloc_end || n >= -(uintptr_t) alloc_ptr)
{
return alloc_last_block;
}
-void * weak_function
-malloc (size_t n)
-{
- return __libc_memalign (MALLOC_ALIGNMENT, n);
-}
-
/* We use this function occasionally since the real implementation may
be optimized when it can assume the memory it returns already is
set to NUL. */
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.22 GLIBC_2.22 A
-GLIBC_2.22 __libc_memalign F
GLIBC_2.22 __libc_stack_end D 0x4
GLIBC_2.22 __stack_chk_guard D 0x4
GLIBC_2.22 __tls_get_addr F
GLIBC_2.17 GLIBC_2.17 A
-GLIBC_2.17 __libc_memalign F
GLIBC_2.17 __libc_stack_end D 0x8
GLIBC_2.17 __stack_chk_guard D 0x8
GLIBC_2.17 __tls_get_addr F
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader needs __tls_get_addr for TLS, and uses __libc_memalign
-# internally to allocate aligned TLS storage. The other malloc family of
-# functions are expected to allow user symbol interposition.
+# The dynamic loader needs __tls_get_addr for TLS.
ld.so: __tls_get_addr
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x28
GLIBC_2.0 calloc F
GLIBC_2.0 free F
# We used to offer inline functions that used this, so it must be exported.
# Ought to reorg things such that carg isn't thus forced to use a plt.
libm.so: __atan2
-# The dynamic loader needs __tls_get_addr for TLS, and uses __libc_memalign
-# internally to allocate aligned TLS storage. The other malloc family of
-# functions are expected to allow user symbol interposition.
+# The dynamic loader needs __tls_get_addr for TLS.
ld.so: __tls_get_addr ?
-ld.so: __libc_memalign + RELA R_ALPHA_GLOB_DAT
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc + RELA R_ALPHA_GLOB_DAT
ld.so: calloc + RELA R_ALPHA_GLOB_DAT
ld.so: realloc + RELA R_ALPHA_GLOB_DAT
GLIBC_2.4 GLIBC_2.4 A
-GLIBC_2.4 __libc_memalign F
GLIBC_2.4 __libc_stack_end D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
GLIBC_2.4 __tls_get_addr F
libm.so: matherr
libpthread.so: __errno_location
libpthread.so: raise
-# The dynamic loader needs __tls_get_addr for TLS, and uses __libc_memalign
-# internally to allocate aligned TLS storage. The other malloc family of
-# functions are expected to allow user symbol interposition.
+# The dynamic loader needs __tls_get_addr for TLS.
ld.so: __tls_get_addr
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.2 GLIBC_2.2 A
-GLIBC_2.2 __libc_memalign F
GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
libc.so: __errno_location
libm.so: matherr
libpthread.so: __errno_location
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
libc.so: memalign + REL R_386_GLOB_DAT
libc.so: realloc + REL R_386_GLOB_DAT
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign + REL R_386_GLOB_DAT
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc + REL R_386_GLOB_DAT
ld.so: calloc + REL R_386_GLOB_DAT
ld.so: realloc + REL R_386_GLOB_DAT
GLIBC_2.2 GLIBC_2.2 A
-GLIBC_2.2 __libc_memalign F
GLIBC_2.2 __libc_stack_end D 0x8
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
libm.so: matherr
libm.so: matherrf
libm.so: matherrl
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.4 GLIBC_2.4 A
-GLIBC_2.4 __libc_memalign F
GLIBC_2.4 __libc_stack_end D 0x4
GLIBC_2.4 __stack_chk_guard D 0x4
GLIBC_2.4 __tls_get_addr F
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
GLIBC_2.18 GLIBC_2.18 A
-GLIBC_2.18 __libc_memalign F
GLIBC_2.18 __libc_stack_end D 0x4
GLIBC_2.18 __stack_chk_guard D 0x4
GLIBC_2.18 __tls_get_addr F
libc.so: realloc
libm.so: matherr
libpthread.so: __errno_location
-# The dynamic loader needs __tls_get_addr for TLS, and uses __libc_memalign
-# internally to allocate aligned TLS storage. The other malloc family of
-# functions are expected to allow user symbol interposition.
+# The dynamic loader needs __tls_get_addr for TLS.
ld.so: __tls_get_addr
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x28
GLIBC_2.0 calloc F
GLIBC_2.0 free F
GLIBC_2.21 GLIBC_2.21 A
-GLIBC_2.21 __libc_memalign F
GLIBC_2.21 __libc_stack_end D 0x4
GLIBC_2.21 __stack_chk_guard D 0x4
GLIBC_2.21 __tls_get_addr F
libc.so: __eqdf2
libc.so: __extendsfdf2
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
libm.so: copysignl ?
libm.so: fabsl
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.17 GLIBC_2.17 A
-GLIBC_2.17 __libc_memalign F
GLIBC_2.17 __libc_stack_end D 0x8
GLIBC_2.17 __tls_get_addr F
GLIBC_2.17 _dl_mcount F
GLIBC_2.23 GLIBC_2.23 A
GLIBC_2.23 __parse_hwcap_and_convert_at_platform F
GLIBC_2.3 GLIBC_2.3 A
-GLIBC_2.3 __libc_memalign F
GLIBC_2.3 __libc_stack_end D 0x8
GLIBC_2.3 __tls_get_addr F
GLIBC_2.3 _dl_mcount F
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to
-# allow user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-# It is also allowed to call __libc_memalign via function-pointer loaded from
-# GOT instead of calling via a plt-stub. In this case there is a R_390_GLOB_DAT
-# relocation in section .rela.dyn instead of R_390_JMP_SLOT in .rela.plt.
-# After commit "elf: Do not use memalign for TCB/TLS blocks allocation
-# [BZ #17730]" __libc_memalign is only called in elf/dl-minimal.c: malloc() in
-# ld.so and gcc -O2/-O3 leads to R_390_GLOB_DAT. If build with
-# -fno-optimize-sibling-calls an R_390_JMP_SLOT is generated.
-ld.so: __libc_memalign + RELA R_390_GLOB_DAT
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
GLIBC_2.2 GLIBC_2.2 A
-GLIBC_2.2 __libc_memalign F
GLIBC_2.2 __libc_stack_end D 0x8
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
GLIBC_2.2 GLIBC_2.2 A
-GLIBC_2.2 __libc_memalign F
GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
libc.so: _exit
libc.so: __errno_location
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.0 GLIBC_2.0 A
-GLIBC_2.0 __libc_memalign F
GLIBC_2.0 _r_debug D 0x14
GLIBC_2.0 calloc F
GLIBC_2.0 free F
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate
-# aligned TLS storage. The other malloc family of functions are
-# expected to allow user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.2 GLIBC_2.2 A
-GLIBC_2.2 __libc_memalign F
GLIBC_2.2 __libc_stack_end D 0x8
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x28
libc.so: memalign
libc.so: realloc
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate
-# aligned TLS storage. The other malloc family of functions are
-# expected to allow user symbol interposition.
-ld.so: __libc_memalign
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc
ld.so: calloc
ld.so: realloc
GLIBC_2.12 GLIBC_2.12 A
-GLIBC_2.12 __libc_memalign F
GLIBC_2.12 __libc_stack_end D 0x4
GLIBC_2.12 __tls_get_addr F
GLIBC_2.12 _dl_mcount F
GLIBC_2.12 GLIBC_2.12 A
-GLIBC_2.12 __libc_memalign F
GLIBC_2.12 __libc_stack_end D 0x8
GLIBC_2.12 __tls_get_addr F
GLIBC_2.12 _dl_mcount F
GLIBC_2.12 GLIBC_2.12 A
-GLIBC_2.12 __libc_memalign F
GLIBC_2.12 __libc_stack_end D 0x4
GLIBC_2.12 __tls_get_addr F
GLIBC_2.12 _dl_mcount F
GLIBC_2.2.5 GLIBC_2.2.5 A
-GLIBC_2.2.5 __libc_memalign F
GLIBC_2.2.5 __libc_stack_end D 0x8
GLIBC_2.2.5 _dl_mcount F
GLIBC_2.2.5 _r_debug D 0x28
GLIBC_2.16 GLIBC_2.16 A
-GLIBC_2.16 __libc_memalign F
GLIBC_2.16 __libc_stack_end D 0x4
GLIBC_2.16 __tls_get_addr F
GLIBC_2.16 _dl_mcount F
libc.so: memalign + RELA R_X86_64_GLOB_DAT
libc.so: realloc + RELA R_X86_64_GLOB_DAT
libm.so: matherr
-# The dynamic loader uses __libc_memalign internally to allocate aligned
-# TLS storage. The other malloc family of functions are expected to allow
-# user symbol interposition.
-ld.so: __libc_memalign + RELA R_X86_64_GLOB_DAT
+# The main malloc is interposed into the dynamic linker, for
+# allocations after the initial link (when dlopen is used).
ld.so: malloc + RELA R_X86_64_GLOB_DAT
ld.so: calloc + RELA R_X86_64_GLOB_DAT
ld.so: realloc + RELA R_X86_64_GLOB_DAT