Linux ELF analysis

ldd prints the shared objects (shared libraries) required by each program or shared object specified on the command line.

readelf command to list RPATH or RUNPATH

readelf -d binary-or-library | head -20

Intel, How To Write Shared Libraries 2011
https://linux.die.net/man/1/objdump
-p
—private-headers
Print information that is specific to the object file format. The exact information printed depends upon the object file format. For some object file formats, no additional information is printed.

  objdump -p <bin>
executable:     file format elf64-x86-64
Program Header:
PHDR off    0x0000000000000040 vaddr 0x00000000003ff040 paddr 0x00000000003ff040 align 2**3
     filesz 0x0000000000000230 memsz 0x0000000000000230 flags r-x
STACK off    0x0000000000001000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
     filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
LOAD off    0x0000000000000000 vaddr 0x00000000003ff000 paddr 0x00000000003ff000 align 2**12
....

Dynamic Section:
RUNPATH              .
NEEDED               libQt5Gui.so.5
...

Version References:
required from libgcc_s.so.1:
0x0b792650 0x00 11 GCC_3.0
...

https://linux.die.net/man/1/readelf
readelf - Displays information about ELF files.
https://linux.die.net/man/1/chrpath
chrpath - change the rpath or runpath in binaries

https://github.com/NixOS/patchelf

rpath-and-runpath

LD Linux man page
gcc link-options

-Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example, -Wl,-Map,output.map passes -Map output.map to the linker. When using the GNU linker, you can also get the same effect with -Wl,-Map=output.map.