From: Jens Gustedt <Jens.Gustedt@inria.fr>
To: musl@lists.openwall.com
Subject: [PATCH 0/5] reorganize the use of weak symbols
Date: Sat, 16 Feb 2013 00:22:03 +0100 [thread overview]
Message-ID: <cover.1360968989.git.Jens.Gustedt@inria.fr> (raw)
Weak symbols are used for several uses that are in fact quite distinct.
- The first use case is the one that weak symbols were originally
invented for: a symbol that provides some dummy data or function
that replaces some other functionality if that functionality is not
linked into the executable or library. There are only a few clear
cut use cases like that for functions in musl. Mark them clearly as
such by using the new macro _Weak.
- A subcase of the previous one, but where the dummy action that is
performed is a NOP. There are three different function interfaces
that are used all over musl that fall into this category; with void
argument list, with a void* or an int.
- Functions that implement several interfaces at once. The macro
weak_alias provides the additional "names" for the function.
- Data that resides in a different compilation unit and for which a
value that is non-zero indicates the presence of that different
compilation unit in the current executable. We unify the coding of
such weak symbols through one only "meta" weak reandonly symbol
__readonly_dummy that is guaranteed to be wide enough and
initialized by all bits 0.
- A special subcase of the previous one, where the weak symbol also
serves as a guard which would provoke a fault when the symbol
would be written to. There is one such special use case in musl.
Jens Gustedt (5):
Clearly identify the readonly replacement symbols that serve as
'dummies' that could (or could not) be provided by other
compilation units.
Clarify the implementation of the dummy alias used for pthread_self.
identify the weak function symbols that provide a real default action
add three macros for empty dummy functions that do nothing
Use the weak functions that do nothing as aliases for the default
actions
src/aio/aio_readwrite.c | 7 ++-----
src/env/__init_security.c | 6 ++----
src/exit/exit.c | 11 ++++-------
src/exit/quick_exit.c | 4 ++--
src/internal/libc.h | 42 ++++++++++++++++++++++++++++++++++++++++++
src/mman/mmap.c | 8 ++++----
src/mman/munmap.c | 8 ++++----
src/process/fork.c | 7 ++-----
src/process/posix_spawn.c | 8 +++-----
src/process/system.c | 8 +++-----
src/signal/sigaction.c | 4 ++--
src/stdio/__stdio_exit.c | 8 ++++----
src/stdio/__toread.c | 4 ++--
src/stdio/fflush.c | 4 ++--
src/stdio/popen.c | 8 +++-----
src/thread/cancel_dummy.c | 12 ++++--------
src/thread/cancellation.c | 9 ++++++---
src/thread/pthread_create.c | 22 +++++++++-------------
src/thread/pthread_join.c | 6 ++----
src/thread/pthread_self.c | 11 +++++++----
src/time/timer_create.c | 4 ++--
21 files changed, 111 insertions(+), 90 deletions(-)
--
1.7.9.5
next reply other threads:[~2013-02-15 23:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-15 23:22 Jens Gustedt [this message]
2013-02-15 23:23 ` [PATCH 1/5] Clearly identify the readonly replacement symbols that serve as 'dummies' that could (or could not) be provided by other compilation units Jens Gustedt
2013-02-15 23:23 ` [PATCH 2/5] Clarify the implementation of the dummy alias used for pthread_self Jens Gustedt
2013-02-15 23:24 ` [PATCH 3/5] identify the weak function symbols that provide a real default action Jens Gustedt
2013-02-15 23:24 ` [PATCH 4/5] add three macros for empty dummy functions that do nothing Jens Gustedt
2013-02-15 23:25 ` [PATCH 5/5] Use the weak functions that do nothing as aliases for the default actions Jens Gustedt
2013-02-16 5:59 ` [PATCH 0/5] reorganize the use of weak symbols Rich Felker
2013-02-16 8:16 ` Jens Gustedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1360968989.git.Jens.Gustedt@inria.fr \
--to=jens.gustedt@inria.fr \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).