Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functions
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Tue, 27 Dec 2022 21:11:42 +0000 (18:11 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 27 Mar 2023 16:57:55 +0000 (13:57 -0300)
commit88677348b4de73874ca7d5a47451f42880f65f07
tree9ebe22b88c2487331521737dfdf089f9e3e2439f
parente4d336f1ace7c7ca535f7f85485373752bc76ed5
Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functions

They are both used by __libc_freeres to free all library malloc
allocated resources to help tooling like mtrace or valgrind with
memory leak tracking.

The current scheme uses assembly markers and linker script entries
to consolidate the free routine function pointers in the RELRO segment
and to be freed buffers in BSS.

This patch changes it to use specific free functions for
libc_freeres_ptrs buffers and call the function pointer array directly
with call_function_static_weak.

It allows the removal of both the internal macros and the linker
script sections.

Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
90 files changed:
Makerules
crypt/md5-crypt.c
crypt/sha256-crypt.c
crypt/sha512-crypt.c
dlfcn/dlerror.h
elf/dl-libc.c
grp/fgetgrent.c
gshadow/fgetsgent.c
iconv/gconv_cache.c
iconv/gconv_conf.c
iconv/gconv_db.c
iconv/gconv_dl.c
include/libc-symbols.h
include/set-freeres.h [new file with mode: 0644]
inet/getnameinfo.c
inet/getnetgrent.c
inet/rcmd.c
inet/rexec.c
intl/dcigettext.c
intl/finddomain.c
intl/loadmsgcat.c
intl/localealias.c
libio/fcloseall.c
libio/genops.c
libio/libioP.h
locale/loadarchive.c
locale/localeinfo.h
locale/setlocale.c
login/getutent.c
login/getutid.c
login/getutline.c
malloc/set-freeres.c
malloc/thread-freeres.c
misc/efgcvt-template.c
misc/efgcvt.c
misc/fstab.c
misc/hsearch.c
misc/mntent.c
misc/qefgcvt.c
misc/unwind-link.c
nptl/nptlfreeres.c
nscd/nscd_getgr_r.c
nscd/nscd_gethst_r.c
nscd/nscd_getpw_r.c
nscd/nscd_getserv_r.c
nscd/nscd_netgroup.c
nss/getXXbyYY.c
nss/getXXent.c
nss/nss_action.c
nss/nss_action.h
nss/nss_database.c
nss/nss_database.h
nss/nss_module.c
nss/nss_module.h
posix/regcomp.c
posix/register-atfork.c
pwd/fgetpwent.c
resolv/gai_misc.c
resolv/res-close.c
resolv/res_hconf.c
resolv/resolv-internal.h
resolv/resolv_conf.c
resolv/tst-leaks2.c
rt/aio_misc.c
shadow/fgetspent.c
stdio-common/reg-modifier.c
stdio-common/reg-printf.c
stdio-common/reg-type.c
stdlib/exit.c
stdlib/fmtmsg.c
stdlib/setenv.c
sunrpc/clnt_perr.c
sunrpc/rpc_thread.c
sunrpc/tst-svc_register.c
sysdeps/generic/set-freeres-fp.h [new file with mode: 0644]
sysdeps/generic/set-freeres-os.h [new file with mode: 0644]
sysdeps/generic/set-freeres-system.h [new file with mode: 0644]
sysdeps/ieee754/ldbl-128ibm-compat/ieee128-qefgcvt.c
sysdeps/ieee754/ldbl-128ibm-compat/set-freeres-fp.h [new file with mode: 0644]
sysdeps/mach/hurd/bits/errno.h
sysdeps/posix/getaddrinfo.c
sysdeps/posix/ttyname.c
sysdeps/unix/sysv/linux/check_pf.c
sysdeps/unix/sysv/linux/s390/s390-32/getutent.c
sysdeps/unix/sysv/linux/s390/s390-32/getutid.c
sysdeps/unix/sysv/linux/s390/s390-32/getutline.c
sysdeps/unix/sysv/linux/set-freeres-os.h [new file with mode: 0644]
sysdeps/unix/sysv/linux/ttyname.c
time/tzfile.c
time/tzset.c