diff mbox series

dlfcn: Move RTLD_DEFAULT/RTLD_NEXT outside __USE_GNU

Message ID 20220522193642.3598646-1-maskray@google.com
State New
Headers show
Series dlfcn: Move RTLD_DEFAULT/RTLD_NEXT outside __USE_GNU | expand

Commit Message

Fangrui Song May 22, 2022, 7:36 p.m. UTC
RTLD_DEFAULT and RTLD_NEXT appear in IEEE Std 1003.1-2004.  (RTLD_NEXT
even appears in the 1997 SUS version 2.)  Many systems (e.g. FreeBSD, musl)
just define the two macros unconditionally.

Let's do the same, as if the state before
commit 70b2845f71c1fb6bd5ec3ef325974b6a90cdb45c.
---
 dlfcn/dlfcn.h | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

Comments

Florian Weimer May 23, 2022, 3:21 p.m. UTC | #1
* Fangrui Song via Libc-alpha:

> RTLD_DEFAULT and RTLD_NEXT appear in IEEE Std 1003.1-2004.  (RTLD_NEXT
> even appears in the 1997 SUS version 2.)  Many systems (e.g. FreeBSD, musl)
> just define the two macros unconditionally.
>
> Let's do the same, as if the state before
> commit 70b2845f71c1fb6bd5ec3ef325974b6a90cdb45c.

Please de-indent the #defines for RTLD_NEXT and RTLD_DEFAULT because
they now unconditional.  No need to post a new version.

POSIX reserves the RTLD_ namespace, and this is already reflected in our
conform tests.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Tested-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian
Andreas Schwab May 23, 2022, 3:42 p.m. UTC | #2
On Mai 23 2022, Florian Weimer via Libc-alpha wrote:

> POSIX reserves the RTLD_ namespace, and this is already reflected in our
> conform tests.

That information should be part of the commit message.  It is the only
reason that matters.
diff mbox series

Patch

diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h
index a3af6051d4..6be06241d1 100644
--- a/dlfcn/dlfcn.h
+++ b/dlfcn/dlfcn.h
@@ -30,6 +30,14 @@ 
 #ifdef __USE_GNU
 #include <bits/dl_find_object.h>
 
+/* Type for namespace indices.  */
+typedef long int Lmid_t;
+
+/* Special namespace ID values.  */
+# define LM_ID_BASE	0	/* Initial namespace.  */
+# define LM_ID_NEWLM	-1	/* For dlmopen: request new namespace.  */
+#endif
+
 /* If the first argument of `dlsym' or `dlvsym' is set to RTLD_NEXT
    the run-time address of the symbol called NAME in the next shared
    object is returned.  The "next" relation is defined by the order
@@ -41,16 +49,6 @@ 
    is returned.  */
 # define RTLD_DEFAULT	((void *) 0)
 
-
-/* Type for namespace indices.  */
-typedef long int Lmid_t;
-
-/* Special namespace ID values.  */
-# define LM_ID_BASE	0	/* Initial namespace.  */
-# define LM_ID_NEWLM	-1	/* For dlmopen: request new namespace.  */
-#endif
-
-
 __BEGIN_DECLS
 
 /* Open the shared object FILE and map it in; return a handle that can be