On Mon, Jul 4, 2016 at 11:49 PM, Tinker <ti...@openmailbox.org> wrote: ... > I guess it's not practically relevant but one last question, what did you > mean by "noopen marking" in this context? (Can't find any documentation > mentioning this. Just want to understand what you meant.)
There are several flags that can be set in the dynamic section of a shared-object that affect how the dynamic linker processes that shared-object when linking. These can be seen in the output of "readelf -d", which dumps the entire dynamic section from the indicated objects. For example, to look at a fairly old libpthread: : vonbek; readelf -d /usr/lib/libpthread.so.18.0 Dynamic section at offset 0xc39c contains 17 entries: Tag Type Name/Value 0x0000000c (INIT) 0x3e70 0x0000000d (FINI) 0xbbb0 0x00000004 (HASH) 0x174 0x00000005 (STRTAB) 0x1fec 0x00000006 (SYMTAB) 0xadc 0x0000000a (STRSZ) 4486 (bytes) 0x0000000b (SYMENT) 16 (bytes) 0x00000003 (PLTGOT) 0x5c5f0 0x00000002 (PLTRELSZ) 1500 (bytes) 0x00000014 (PLTREL) RELA 0x00000017 (JMPREL) 0x3894 0x00000007 (RELA) 0x3174 0x00000008 (RELASZ) 3324 (bytes) 0x00000009 (RELAENT) 12 (bytes) 0x6ffffffb (FLAGS_1) Flags: NODELETE INITFIRST NOOPEN 0x6ffffff9 (RELACOUNT) 86 0x00000000 (NULL) 0x0 : vonbek; See the "Flags: NODELETE INITFIRST NOOPEN" bit? The NODELETE flag tells ld.so that this shared-object must never be unloaded, the INITFIRST flag tells ld.so to order it early in the initializer ordering, and NOOPEN tells ld.so to refuse to initially load it via dlopen(). (Yes, the NODELETE flag is superfluous when NOOPEN is present.) On the -current version of libpthread, the flags are a bit simpler: 0x6ffffffb (FLAGS_1) Flags: NODELETE For more details of what the rest of that means and how its used you would need to dig into the "System V Application Binary Interface", followed by the platform-specific addendum for the CPU involved. Bear in mind that these are living docs, slowly being updated as the larger community figures out better ways to do stuff. Philip Guenther