Libc

Un article de Haypo.

Retour à la page précédente Retour aux articles de programmation

« libc » ou « bibliothèque standard C ».

Sommaire

[modifier] Implémentations

  • GNU libc
  • Bionic
    • Bionic is the standard C library (including libc, libdl, libm, and libpthread) developed by Google for its Android operating system.
  • uClibc
    • Ne nécessite pas de MMU
    • Écrite pour fonctionner sur un microcontrôleur
    • Écrite depuis zéro, mais inclut du code la GNU libc et autres projets
    • Licence GNU LGPL
  • EGLIBC
    • Variante de la GNU libc destinée à l'embarqué
  • dietlibc
    • Écrite depuis zéro
    • Vise clairement l'embarqué : libc la plus petite possible
    • Licence GNU GPL
    • Dernière version stable (0.31) : août 2007
  • newlib
    • Vise l'embarqué (mais pas forcément Linux)
    • Diverses licences libres (fonctions provenant de divers projets), et une partie sous licence GNU GPL ou GNU LGPL
    • Dernière version stable (1.17) : décembre 2008
  • musl-libc
    • small memory footprint
    • portable
    • fast
    • secure
  • BSD : FreeBSD, OpenBSD, NetBSD, ...
    • Licence BSD

[modifier] Documentation

[modifier] Variables de la GNU libc

Ces informations proviennent de la liste variables d'environnement de la libc écrite pour Scratchbox.

[modifier] liaison des symboles (ld.so)

  • LD_BIND_NOT: Flag: if set, Don't update the GOT (global offset table) and PLT (procedure linkage table) after resolving a symbol
  • LD_BIND_NOW: Flag: Resolve all symbols at program startup, useful with debugger
  • LD_DEBUG: Output verbose debugging information about the dynamic linker. If set to 'all' prints all debugging information it has, if set to 'help' prints a help message
  • LD_DEBUG_PATH: Filename for LD_DEBUG output (otherwise it goes to stdout)
  • LD_LIBRARY_PATH: A colon-separated list of directories in which to search for ELF libraries at execution-time
  • LD_PRELOAD: A whitespace-separated list of additional, user-specified, ELF shared libraries to be loaded before all others. This can be used to selectively override functions in other shared libraries. For setuid/setgid ELF binaries, only libraries in the standard search directories that are also setuid will be loaded
  • LD_ORIGIN_PATH : Path where the binary is found
  • LD_PROFILE : Shared object to be profiled
  • LD_PROFILE_OUTPUT : File where LD_PROFILE output should be stored, default is stdout
  • LD_TRACE_LOADED_OBJECTS Flag: if set, list dependencies instead of running (like ldd!)
  • LD_WARN Flag: if set, warn about about undefined symbols
  • LD_VERBOSE Flag: If set, output symbol versioning information about the program if querying information about it (see LD_TRACE_LOADED_OBJECTS)

Pour plus d'information sur le linker dynamique, lire « man ld.so ».

[modifier] Debug

  • SEGFAULT_SIGNALS: List of signals generating segfault: segv, ill, bus, stkflt, abrt, fpe
  • SEGFAULT_USE_ALTSTACK: Flag: if set, allocate separate stack for segfaults

Note: 'catchsegv' is a shell script coming with glibc which LD_PRELOADs binaries with segfault library understanding above variables.

  • SEGFAULT_OUTPUT_NAME : Name of the output (backtrace etc) file (default is stderr)
  • MALLOC_CHECK_ : Set what to do when corrupt pointer is detected with malloc debugging:
    • 0: do nothing
    • 1: print an error message (default)
    • 2: call abort()
  • MSGVERB SEV_LEVEL : Mask of msgfmt() values to print (label, severity, text, action, tag) and severity level setting for msgfmt()
  • GMON_OUT_PREFIX : Change -pg (gcc profiling option) output file from default 'gmon.out' to"${GMON_OUT_PREFIX}.${PID}"

[modifier] Traduction

  • LC_CTYPE: Character classification and case conversion
  • LC_TIME Date and time formats
  • ...
  • LC_MESSAGES: Formats of informative and diagnostic messages and interactive responses
  • LC_ALL: Overrides the locales selected by other LC_* variables
  • LANG: Which message catalog to use
  • LANGUAGE: Overrides LANG and LC_* settings for message catalogs

[modifier] Chemins

  • HOME: User's home directory
  • IFS: Field separator (e.g. in path lists)
  • PATH: Paths from which executables can be run from
  • PWD: Working directory
  • TMPDIR: Temporary directory path

[modifier] Articles connexes

[modifier] Liens externes