Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 16 Feb 2013 00:22:03 +0100
From: Jens Gustedt <>
Subject: [PATCH 0/5] reorganize the use of weak symbols

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

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


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.