From 7aa320514ebbb20f6c237627bf0bc8e509321f21 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 24 Aug 2015 17:34:28 +0200 Subject: [PATCH] Explain the osl_strerror dance. It's not completely obvious what is going on here and *why* we not just go with a simple pointer array for the messages returned by osl_strerror(). This commit explains why pointer arrays are bad in DSOs. --- osl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osl.c b/osl.c index 6666196..e31811b 100644 --- a/osl.c +++ b/osl.c @@ -13,7 +13,14 @@ #include "util.h" #include "osl_core.h" -/* Taken from Drepper: How to write shared libraries, Appendix B. */ +/* + * Taken from Drepper: How to write shared libraries, Appendix B. + * + * The main reason for this rather fancy implementation of strerror() is to + * avoid having an array of pointers. This is desirable because initialized + * pointer variables increase the startup time of the library due to the + * processing of relocations. + */ #include #define MSGSTRFIELD(line) MSGSTRFIELD1(line) #define MSGSTRFIELD1(line) str##line -- 2.39.2