From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2798 Path: news.gmane.org!not-for-mail From: Jens Gustedt Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 0/5] reorganize the use of weak symbols Date: Sat, 16 Feb 2013 00:22:03 +0100 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1360970538 5258 80.91.229.3 (15 Feb 2013 23:22:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 Feb 2013 23:22:18 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2799-gllmg-musl=m.gmane.org@lists.openwall.com Sat Feb 16 00:22:40 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U6Uc2-0007ks-Ko for gllmg-musl@plane.gmane.org; Sat, 16 Feb 2013 00:22:38 +0100 Original-Received: (qmail 9304 invoked by uid 550); 15 Feb 2013 23:22:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9296 invoked from network); 15 Feb 2013 23:22:16 -0000 X-IronPort-AV: E=Sophos;i="4.84,675,1355094000"; d="scan'208";a="3112215" Resent-From: Jens Gustedt Resent-To: musl@lists.openwall.com Resent-Cc: musl X-Mailer: Evolution 3.2.3-0ubuntu6 Xref: news.gmane.org gmane.linux.lib.musl.general:2798 Archived-At: 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