This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dlmopen and variables in the dynamic loader


dlmopen carefully replicates the initial ld.so in all namespaces.
Unlike libc.so, ld.so is only loaded once.  This can be used to share
state across all namespaces.

However, it turns out that there is an exception: If ld.so exports a
variable and the main program references it via a copy relocation,
secondary namespaces created via dlopen are bound to the original
definition in ld.so, not the copy in the main program.  This means that
even without static dlopen, two copies of the same variable can exist in
the process.

For my case (__libc_single_threaded), I think I have a workaround.  But
maybe someone else will run into this in a different context, hence this
note.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]