GNU C Library

From Infinity Wiki
Revision as of 23:08, 20 June 2016 by Gary Benson (talk | contribs)
Jump to navigation Jump to search

The GNU C Library, also known as glibc, is the C library in the GNU system and in GNU/Linux systems, as well as many other systems that use Linux as the kernel. Its homepage is https://www.gnu.org/software/libc/.

Included with the GNU C Library are two libraries of note to Infinity developers:

Programs wishing to become multithreaded load libpthread.so and make calls into it. Software development tools wishing to understand multithreaded programs load libthread_db.so and make calls into that. This works fine if the program being analyzed and the tool doing the analysis are built with the same ABI.

It grew from a need for GDB to be able to debug multithreaded applications without requiring libthread_db. In Infinity, the thread-debugging code is stored as platform-independent Infinity notes in libpthread.so; libthread_db.so is not used at all.

The TL;DR of all this is that if you're developing Infinity you will very likely need to be making glibc test builds. You can find out how to do that at https://sourceware.org/glibc/wiki/Testing/Builds.

Supported platforms

This table details how the various platforms glibc supports locate the current thread descriptor and what ELF binaries look like on those platforms.

glibc platform name libthread_db wordsize THREAD_SELF type elf.h e_machine thread register prgregset_t offset
name DWARF number
aarch64 64 CTA EM_AARCH64
alpha 64 register EM_ALPHA unique 66 32 * 8
arm 32 CTA EM_ARM
hppa 32 register EM_PARISC cr27 not allocated 53 * 4
i386 32 RTA EM_386 gs 45 offsetof (struct user_regs_struct, xgs) == 10 * 4
i386 64 RTA EM_386 gs 45 26 * 8
ia64 64 register EM_IA_64 r13 13 13 * 8
m68k 32 CTA EM_68K
microblaze 32 CTA unknown
mips 32 CTA unknown
nios2 32 register EM_ALTERA_NIOS2 (113) r23 23 23 * 4
powerpc 32 register EM_PPC r13 13 PT_R13 * 4 (== 13 * 4)
powerpc 64 register EM_PPC64 r2 2 PT_R2 * 8 (== 2 * 8)
s390 32 register EM_S390 ar0 48 18 * 4
s390 64 register EM_S390 ar0 and ar1 48 and 49 18 * 8
sh 32 register EM_SH gbr 19 REG_GBR * 4 (== unknown)
sparc 32 register EM_SPARC{,V9,32PLUS} g7 7 10 * 4
sparc 64 register EM_SPARC{,V9,32PLUS} g7 7 (6 * 8) + (__WORDSIZE==64 ? 0 : 4)
tile 32 register EM_TILEGX tp 53 REG_TP * 4 (== unknown)
tile 64 register EM_TILEGX tp 53 REG_TP * 8 (== unknown)
x86_64 64 CTA EM_X86_64