diff mbox series

[RFC,v8,01/20] Declare and describe the dlmopen RTLD_SHARED flag

Message ID 20210209171839.7911-2-vivek@collabora.com
State New
Delegated to: Adhemerval Zanella Netto
Headers show
Series Implementation of RTLD_SHARED for dlmopen | expand

Commit Message

Vivek Das Mohapatra Feb. 9, 2021, 5:18 p.m. UTC
This flag will instruct dlmopen to create a shared object present
in the main namespace and accessible from the selected namespace
when supplied in the MODE argument.
---
 bits/dlfcn.h              | 7 +++++++
 sysdeps/mips/bits/dlfcn.h | 7 +++++++
 2 files changed, 14 insertions(+)

Comments

Adhemerval Zanella Feb. 15, 2021, 1:08 p.m. UTC | #1
On 09/02/2021 14:18, Vivek Das Mohapatra via Libc-alpha wrote:
> This flag will instruct dlmopen to create a shared object present
> in the main namespace and accessible from the selected namespace
> when supplied in the MODE argument.

This patch should combined with the 4th of the set (elf/dl-load.c, 
elf-dl-open.c: Implement RTLD_SHARED dlmopen proxying) which is the 
first one that actually uses the RTLD_SHARED flag.

> ---
>  bits/dlfcn.h              | 7 +++++++
>  sysdeps/mips/bits/dlfcn.h | 7 +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/bits/dlfcn.h b/bits/dlfcn.h
> index f3bc63e958..0daa789693 100644
> --- a/bits/dlfcn.h
> +++ b/bits/dlfcn.h
> @@ -32,6 +32,13 @@
>     visible as if the object were linked directly into the program.  */
>  #define RTLD_GLOBAL	0x00100
>  
> +/* If the following bit is set in the MODE argument to dlmopen
> +   then the target object is loaded into the main namespace (if
> +   it is not already there) and a shallow copy (proxy) is placed
> +   in the target namespace: This allows multiple namespaces to
> +   share a single instance of a DSO.  */
> +#define RTLD_SHARED 0x00080
> +
>  /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
>     The implementation does this by default and so we can define the
>     value to zero.  */

I think this should be add as GNU extension for now, which mean within
the __USE_GNU ifdef (even though RTLD_NODELETE, RTLD_NOLOAD, and
RTLD_DEEPBIND now currently exported as GNU extension).

> diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
> index 5cec898de3..1331771a17 100644
> --- a/sysdeps/mips/bits/dlfcn.h
> +++ b/sysdeps/mips/bits/dlfcn.h
> @@ -32,6 +32,13 @@
>     visible as if the object were linked directly into the program.  */
>  #define RTLD_GLOBAL	0x0004
>  
> +/* If the following bit is set in the MODE argument to dlmopen
> +   then the target object is loaded into the main namespace (if
> +   it is not already there) and a shallow copy (proxy) is placed
> +   in the target namespace: This allows multiple namespaces to
> +   share a single instance of a DSO.  */
> +#define RTLD_SHARED 0x00020
> +
>  /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
>     The implementation does this by default and so we can define the
>     value to zero.  */
> 

Same as before.
Andreas Schwab Feb. 15, 2021, 1:29 p.m. UTC | #2
On Feb 15 2021, Adhemerval Zanella via Libc-alpha wrote:

> I think this should be add as GNU extension for now, which mean within
> the __USE_GNU ifdef (even though RTLD_NODELETE, RTLD_NOLOAD, and
> RTLD_DEEPBIND now currently exported as GNU extension).

I don't think this is needed, as all RTLD_ names are reserved for
<dlfcn.h>.

Andreas.
Adhemerval Zanella Feb. 15, 2021, 1:31 p.m. UTC | #3
On 15/02/2021 10:29, Andreas Schwab wrote:
> On Feb 15 2021, Adhemerval Zanella via Libc-alpha wrote:
> 
>> I think this should be add as GNU extension for now, which mean within
>> the __USE_GNU ifdef (even though RTLD_NODELETE, RTLD_NOLOAD, and
>> RTLD_DEEPBIND now currently exported as GNU extension).
> 
> I don't think this is needed, as all RTLD_ names are reserved for
> <dlfcn.h>.

Fair enough.
diff mbox series

Patch

diff --git a/bits/dlfcn.h b/bits/dlfcn.h
index f3bc63e958..0daa789693 100644
--- a/bits/dlfcn.h
+++ b/bits/dlfcn.h
@@ -32,6 +32,13 @@ 
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x00100
 
+/* If the following bit is set in the MODE argument to dlmopen
+   then the target object is loaded into the main namespace (if
+   it is not already there) and a shallow copy (proxy) is placed
+   in the target namespace: This allows multiple namespaces to
+   share a single instance of a DSO.  */
+#define RTLD_SHARED 0x00080
+
 /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
    The implementation does this by default and so we can define the
    value to zero.  */
diff --git a/sysdeps/mips/bits/dlfcn.h b/sysdeps/mips/bits/dlfcn.h
index 5cec898de3..1331771a17 100644
--- a/sysdeps/mips/bits/dlfcn.h
+++ b/sysdeps/mips/bits/dlfcn.h
@@ -32,6 +32,13 @@ 
    visible as if the object were linked directly into the program.  */
 #define RTLD_GLOBAL	0x0004
 
+/* If the following bit is set in the MODE argument to dlmopen
+   then the target object is loaded into the main namespace (if
+   it is not already there) and a shallow copy (proxy) is placed
+   in the target namespace: This allows multiple namespaces to
+   share a single instance of a DSO.  */
+#define RTLD_SHARED 0x00020
+
 /* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
    The implementation does this by default and so we can define the
    value to zero.  */