diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-02-11 20:57:40 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-02-11 20:57:40 +0100 |
commit | d77576bb523bac542b06621794f26a18efde4fb1 (patch) | |
tree | 6be2702a6d58bcbe12ca468ad0c1b69d07b283f6 /04_dynld_nostd | |
parent | b70697488d0cd858569a5d7d977a89b8637d1020 (diff) | |
download | dynld-d77576bb523bac542b06621794f26a18efde4fb1.tar.gz dynld-d77576bb523bac542b06621794f26a18efde4fb1.zip |
Diffstat (limited to '04_dynld_nostd')
-rw-r--r-- | 04_dynld_nostd/README.md | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/04_dynld_nostd/README.md b/04_dynld_nostd/README.md index fc5c338..9c284ec 100644 --- a/04_dynld_nostd/README.md +++ b/04_dynld_nostd/README.md @@ -638,10 +638,11 @@ Shared libraries on the other hand that also reference the same symbol will go though a `GOT` entry that is patched by the dynamic linker to point to the location in the `.bss` section of the main program. Below this can be seen by the `mov` instruction at address `1024` that the -relative address `3ff8` is dereferenced to get the value of the `gCalled` -variable. In the `readelf` dump above it can be seen that there is a relocation -of type `R_X86_64_GLOB_DAT` for symbol `gCalled` affecting the relative address -`3ff8` in the shared library. +relative address `3ff8` is dereferenced, which is the GOT entry for `gCalled`, +to get the address of `gCalled`. The next instruction at `102b` then loads the +value of `gCalled` iteself. In the `readelf` dump above it can be seen that +there is a relocation of type `R_X86_64_GLOB_DAT` for symbol `gCalled` +affecting the relative address `3ff8` in the shared library. ```bash > objdump -M intel -d -j .text -j .got libgreet.so @@ -653,7 +654,7 @@ Disassembly of section .text: 1020: 55 push rbp 1021: 48 89 e5 mov rbp,rsp 1024: 48 8b 05 cd 2f 00 00 mov rax,QWORD PTR [rip+0x2fcd] # 3ff8 <gCalled-0x28> - + 102b: 8b 00 mov eax,DWORD PTR [rax] # load gCalled ... Disassembly of section .got: |