I’d like to understand a detail of how the dynamic loader creates mappings for ELF segments. Consider a tiny shared library linked with GNU ld. The program headers are: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x00095c 0x00095c R E 0x2000…
Tag: dynamic-loading
Why does loading the libc shared library have “‘LibraryLoader’ object is not callable” error?
From https://en.wikipedia.org/wiki/Foreign_function_interface the ctypes module can load C functions from shared libraries/DLLs on-the-fly and translate simple data types automatically between Python and C semantics as follows: On Lubuntu 18.04 I was wondering why loading the libc shared library has “&#…
How can a shared library know where it resides?
I’m developing a shared library for linux machines, which is dynamically loaded relative to the main executable with rpath. Now, the library itself tries to load other libraries dynamically relative to its location but without rpath (I use scandir to search for shared libraries in a certain folder ̵…
Resolving symbols differently in different dynamically loaded objects
After reading these questions, I’m looking for some more detail about how to control symbol resolution order. In my problem, I have main executable exec. exec dynamically links to a.so and c.so. a.so dynamically links to b.so. b.so calls function foo, which is normally provided by c.so but in this case …
How does elf-loader knows the address of stderr and stdout
I am disassembling a very simple ELF program (Linux x86). With IDA PRO software I see stdout and stderr in .bss-section. And I haven’t found anything that sets the values of stdout or stderr. How does it work? Сan stdout and stderr be null? Answer So you mean stdout and stderr should always be at the sa…