mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 0/5] reorganize the use of weak symbols
@ 2013-02-15 23:22 Jens Gustedt
  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
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Jens Gustedt @ 2013-02-15 23:22 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-02-16  8:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 23:22 [PATCH 0/5] reorganize the use of weak symbols Jens Gustedt
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

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).