A word from our sponsors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
prog:c:linker [2023/07/19 14:47] – created Frank Fegertprog:c:linker [2024/06/27 06:34] (current) Frank Fegert
Line 9: Line 9:
  
 ====== Links ====== ====== Links ======
 +
 +===== General =====
 +
 +FIXME
 +
 +====== Docs ======
 +
 +FIXME
 +
 +====== Articles ======
  
 [[https://www.heise.de/select/ix/archiv/2022/12/seite-112|iX 12/2022 - Page 112 - Ohne Linker kein Programm]]\\ [[https://www.heise.de/select/ix/archiv/2022/12/seite-112|iX 12/2022 - Page 112 - Ohne Linker kein Programm]]\\
 [[https://www.heise.de/select/ix/archiv/2023/2/seite-136|iX 02/2023 - Page 136 - Mit dem richtigen Linker Zeit sparen]]\\ [[https://www.heise.de/select/ix/archiv/2023/2/seite-136|iX 02/2023 - Page 136 - Mit dem richtigen Linker Zeit sparen]]\\
 +[[https://www.linux-magazin.de/ausgaben/2023/08/ld-preload/|Linux-Magazin 08/2023 - Page 70 - Programmverhalten mit LD_PRELOAD ändern]]\\
 +
 +====== Files and Directories ======
 +
 +FIXME
 +
 +===== General Files and Directories =====
 +
 +FIXME
 +
 +===== Configuration Files =====
 +
 +FIXME
 +
 +====== Getting Help ======
 +
 +//binutils// Manual pages: 
 +
 +<cli>
 +user@host:~$ man 1 ld
 +user@host:~$ man 1 nm
 +user@host:~$ man 1 objdump
 +user@host:~$ man 1 readelf
 +user@host:~$ man 1 strip
 +</cli>
 +
 +//GNU C Library: Binaries// Manual pages: 
 +
 +<cli>
 +user@host:~$ man 1 ldd
 +</cli>
 +
 +//Dynamically linked library call tracer// Manual pages: 
 +
 +<cli>
 +user@host:~$ man 1 ltrace
 +</cli>
 +
 +//System call tracer// Manual pages: 
 +
 +<cli>
 +user@host:~$ man 1 strace
 +</cli>
 +
 +====== Install ======
 +
 +To install the //GNU assembler, linker and binary utilities// on Debian:
 +
 +<cli>
 +root@host:~$ apt-get -y install binutils binutils-common
 +</cli> 
 +
 +To install the documentation for the //GNU assembler, linker and binary utilities// on Debian:
 +
 +<cli>
 +root@host:~$ apt-get -y install binutils-doc
 +</cli> 
 +
 +To install the //Dynamically linked library call tracer// on Debian:
 +
 +<cli>
 +root@host:~$ apt-get -y install ltrace
 +</cli> 
 +
 +To install the //System call tracer// on Debian:
 +
 +<cli>
 +root@host:~$ apt-get -y install strace
 +</cli> 
 +
 +====== Configuration ======
 +
 +FIXME
  
 ====== Usage ====== ====== Usage ======
 +
 +===== Using an alternative Linker =====
  
   * Create a symlink of ''/usr/bin/ld'' to the linker of choice <   * Create a symlink of ''/usr/bin/ld'' to the linker of choice <
   * Use of ''LDFLAGS'' environment variable and there ''-fuse-ld='', but this depends on support for the specific linker in the used compiler (e.g. GCC, Clang, ...) <   * Use of ''LDFLAGS'' environment variable and there ''-fuse-ld='', but this depends on support for the specific linker in the used compiler (e.g. GCC, Clang, ...) <
   * Workaround: Create a directory e.g. ''tools'', create a symlink to the linker of choice in there and use the option ''-Btools'' in the ''LDFLAGS'' environment variable. <   * Workaround: Create a directory e.g. ''tools'', create a symlink to the linker of choice in there and use the option ''-Btools'' in the ''LDFLAGS'' environment variable. <
 +
 +===== Listing all exported symbols of a library =====
 +
 +<cli>
 +root@host:~$ readelf -Ws <LIBRARY_FILE>
 +</cli>
 +
 +===== Changing the loaded shared libraries =====
 +
 +Setting the environment variables ''LD_LIBRARY_PATH'' or ''LD_PRELOAD'' in order to change the search order of the linked shared libraries to be loaded at start of a binary.
 +
 +===== Tracing the system calls of a program =====
 +
 +To trace the system calls (i.e. Linux kernel calls) of a program upon execution: 
 +
 +<cli>
 +root@host:~$ strace -f <PROGRAMM>
 +</cli>
 +
 +===== Tracing the dynamically linked library calls of a program =====
 +
 +To trace the calls to symbols exported by dynamically linked libraries of a program upon execution: 
 +
 +<cli>
 +root@host:~$ ltrace -f <PROGRAM> 
 +</cli>
 +
 +====== Recipies ======
 +
 +FIXME
 +
 +<nspages .:recipies -subns -pagesInNs -simpleList -title -hideNoSubns -hideNoPages -textNS="" -exclude:start>
 +
 +====== Known Issues ======
 +
 +FIXME