[RFC,v8,01/20] Declare and describe the dlmopen RTLD_SHARED flag
Commit Message
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
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.
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.
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.
@@ -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. */
@@ -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. */