1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]

Exporting functions and relying on symbol interposition from libc.so
makes the choice of implementation dependent on DT_NEEDED order, which
is not what some compiler drivers expect.

This commit replaces one magic mechanism (symbol interposition) with
another one (preprocessor-/compiler-based redirection).  This makes
the hand-over from the minimal malloc to the full malloc more
explicit.

Removing the ABI symbols is backwards-compatible because libc.so is
always in scope, and the dynamic loader will find the malloc-related
symbols there since commit f0b2132b35
("ld.so: Support moving versioned symbols between sonames
[BZ #24741]").

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2020-02-08 19:58:43 +01:00
parent 2efa52c880
commit 3a0ecccb59
60 changed files with 202 additions and 266 deletions

View File

@ -1,9 +1,5 @@
GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
GLIBC_2.2 calloc F
GLIBC_2.2 free F
GLIBC_2.2 malloc F
GLIBC_2.2 realloc F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.4 __stack_chk_guard D 0x4

View File

@ -1,9 +1,5 @@
GLIBC_2.2 __libc_stack_end D 0x4
GLIBC_2.2 _dl_mcount F
GLIBC_2.2 _r_debug D 0x14
GLIBC_2.2 calloc F
GLIBC_2.2 free F
GLIBC_2.2 malloc F
GLIBC_2.2 realloc F
GLIBC_2.3 __tls_get_addr F
GLIBC_2.4 __stack_chk_guard D 0x4

View File

@ -12,12 +12,6 @@ libc.so: __errno_location
libm.so: matherr
# Generated by the compiler because there is no trap insn pattern.
libc.so: abort ?
# 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
ld.so: free
# The TLS-enabled version of these functions is interposed from libc.so.
ld.so: _dl_signal_error
ld.so: _dl_catch_error