73 results for "dynamic":

Thumbnail for Dynamic symbol resolution

Dynamic symbol resolution

according to nm, msg should be at 0x2000 in libmsg.so: $ nm ./samples/libmsg.so 0000000000001f40 d _DYNAMIC 0000000000002000 D msg 0000000000002026 d msg.end So, accounting for the base address, we should be able to read it from our freshly-mapped memory… // in `elk/src/process.rs` // in `load_object` // after mapping the memory // only added

A dynamic linker murder mystery

you get it! And that new design is “less fragile” than the previous one because as soon as it compiles, you’re in the clear. There’s no “download” phase, there’s no sockets involved, just function calls. Right! Unless the dynamic linker is unhappy. Unless the dynamic linker is unhappy. Wherein the dynamic linker becomes unhappy The
Thumbnail for Dynamic linker speed and correctness

Dynamic linker speed and correctness

able to find a dynamic entry” is a pretty common error. It seems silly to have 3 variants in ReadRelaError just for this: #[derive(Error, Debug)] pub enum ReadRelaError { #[error("Rela dynamic entry not found")] RelaNotFound, #[error("RelaSz dynamic entry not found")] RelaSzNotFound, #[error("RelaEnt dynamic entry not found
Thumbnail for Windows dynamic libraries, calling conventions, and transmute

Windows dynamic libraries, calling conventions, and transmute

hard way - part 2, we learned about dynamic libraries (like libc), and the Linux kernel, and how syscalls allowed us to ask the Linux kernel to do our bidding. For this series, we’re going to have to look at the Windows equivalents. The Manjaro system we used to read files came with binutils, which provided the ldd command. It listed the dynamic
Thumbnail for The simplest shared library

The simplest shared library

need to do that a lot, so, maybe we should just have a way to get the whole dynamic table, and an iterator of entries with a given dynamic tag. We already have dynamic_entry, like so: // in `delf/src/lib.rs` impl File { pub fn dynamic_entry(&self, tag: DynamicTag) -> Option<Addr> { match self.segment_of_type(SegmentType::Dynamic
Thumbnail for ELF relocations

ELF relocations

used to be directly in the `Self` struct literal, but // we're going to use it in the next block to parse dynamic entries from it. let slice = &full_input[offset.into()..][..filesz.into()]; let (_, contents) = match r#type { SegmentType::Dynamic => { // *if* this is a Dynamic segment, we parse its
Thumbnail for In the bowels of glibc

In the bowels of glibc

for GNU/Linux 3.2.0, with debug_info, not stripped (Newlines added for readability). Okay, it’s dynamically-linked, it relies on /lib64/ld-linux-x86-64.so.2, glibc’s dynamic loader (or dynamic linker, I know, words are confusing). So obviously, it has relocations: $ readelf -Wr ./what Relocation section '.rela.dyn' at offset 0x480 contains 8
Thumbnail for Loading multiple ELF objects

Loading multiple ELF objects

want? What if the object we want contains RPATH dynamic entries? And one of the entries contains $ORIGIN? Then we’d need to replace $ORIGIN with the path of the directory containing the object. For example: if we’re loading ~/rust/elk/samples/hello-dl and it has a RPATH entry of $ORIGIN, we need to add ~/rust/elk/samples to the search path of

So you want to live-reload Rust

11 Ah, it’s loading libdl.so - we asked for that! What’s /etc/ld.so though? Well, libdl.so is a dynamic library, so it’s loaded at runtime, so the dynamic linker has to find it first. There’s a config file at /etc/ld.so.conf: $ cat /etc/ld.so.conf # Dynamic linker/loader configuration. # See ld.so(8) and ldconfig(8) for details. include
Thumbnail for GDB scripting and Indirect functions

GDB scripting and Indirect functions

all the symbols, and .dynsym, which has only the symbols we need when loading a dynamic executable or library. We’ve only ever read the .dynsym segment, by looking for the DYNAMIC segment, which contains dynamic entries, finding the entry with tag SymTab, and reading it. Since the SymTab dynamic entry didn’t include a size, just an address, we