Most linuxes use a libc version named glibc.

The LXR (online cross-reference system) for glibc is e.g. here http://koala.cs.pub.ro/lxr/glibc/ for 2.9 version (link is broken). I must say that something may be not lxr'ed because some sources are generated in the build process, for example - as i can remember - wrappers around a system calls.

Pthreads are in nptl/ folder. Right link to libc sources is http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.bz2 (or change 2.14 to your version)

Update: After closing of koala's lxr, there are:

  1. Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/ (Served with Sun's OpenGrok, which was originally used to generate online x-ref for Solaris/OpenSolaris)

  2. Google code search (I know that it was closed; but I also know it's other version which is up): http://code.google.com/codesearch and try to search something glibc-specific

UPD (march 2013) They killed codesearch again:

404. That’s an error.

The requested URL /codesearch was not found on this server. That’s all we know.

UPD 2017

  1. Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/

  2. There is online git by glibc authors: https://sourceware.org/git/?p=glibc.git (tree is browserable at https://sourceware.org/git/?p=glibc.git;a=tree)

  3. Glibc git is mirrored to github (which has some searching functions) https://github.com/bminor/glibc Buildroot 2018.05 notably uses this mirror.

  4. There is search like google's codesearch in all debian packages: https://codesearch.debian.net/. It can search in glibc sources by "package:glibc request" request and also have file browser: http://sources.debian.net/src/glibc/

Answer from osgx on Stack Overflow
🌐
GitHub
github.com › bminor › glibc
GitHub - bminor/glibc: Unofficial mirror of sourceware glibc repository. · GitHub
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Starred by 1.9K users
Forked by 469 users
Languages   C 71.0% | Assembly 12.4% | C++ 7.2% | Pawn 6.0% | Makefile 1.1% | Python 1.0%
🌐
GitHub
github.com › bminor › glibc › blob › master › malloc › malloc.c
glibc/malloc/malloc.c at master · bminor/glibc
glibc in all parts of the code. Do not look for much commonality · with the ptmalloc2 version. · * Version ptmalloc2-20011215 · based on: VERSION 2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) · * Quickstart · · In order to compile this implementation, a Makefile is provided with ·
Author   bminor
🌐
GitHub
github.com › bminor › glibc › releases
Releases · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor › glibc › blob › master › version.h
glibc/version.h at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor › glibc › commit › 2864e767053317538feafa815046fff89e5a16be
Update. · bminor/glibc@2864e76
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor › glibc › tree › glibc-2.31
GitHub - bminor/glibc at glibc-2.31 · GitHub
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Starred by 1.9K users
Forked by 469 users
Languages   C 71.0% | Assembly 12.4% | C++ 7.2% | Pawn 6.0% | Makefile 1.1% | Python 1.0%
Top answer
1 of 4
27

Most linuxes use a libc version named glibc.

The LXR (online cross-reference system) for glibc is e.g. here http://koala.cs.pub.ro/lxr/glibc/ for 2.9 version (link is broken). I must say that something may be not lxr'ed because some sources are generated in the build process, for example - as i can remember - wrappers around a system calls.

Pthreads are in nptl/ folder. Right link to libc sources is http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.bz2 (or change 2.14 to your version)

Update: After closing of koala's lxr, there are:

  1. Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/ (Served with Sun's OpenGrok, which was originally used to generate online x-ref for Solaris/OpenSolaris)

  2. Google code search (I know that it was closed; but I also know it's other version which is up): http://code.google.com/codesearch and try to search something glibc-specific

UPD (march 2013) They killed codesearch again:

404. That’s an error.

The requested URL /codesearch was not found on this server. That’s all we know.

UPD 2017

  1. Metager with glibc: http://code.metager.de/source/xref/gnu/glibc/

  2. There is online git by glibc authors: https://sourceware.org/git/?p=glibc.git (tree is browserable at https://sourceware.org/git/?p=glibc.git;a=tree)

  3. Glibc git is mirrored to github (which has some searching functions) https://github.com/bminor/glibc Buildroot 2018.05 notably uses this mirror.

  4. There is search like google's codesearch in all debian packages: https://codesearch.debian.net/. It can search in glibc sources by "package:glibc request" request and also have file browser: http://sources.debian.net/src/glibc/

2 of 4
15

Info on the glibc repository: http://sourceware.org/glibc/wiki/GlibcGit

Clone it to get your own copy and search it however you like:

git clone git://sourceware.org/git/glibc.git

I load it up in an IDE project (using whatever preferred IDE) and the code navigation works quite well to let me find what I'm interested in.

Browse the source online http://sourceware.org/git/?p=glibc.git

🌐
GitHub
github.com › bminor › glibc › blob › master › README
glibc/README at master · bminor/glibc
February 15, 2026 - Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitLab
gitlab.com › bminor › glibc
bminor / glibc · GitLab
October 26, 2013 - Unofficial mirror of sourceware glibc repository. Updated daily. Mirror of https://github.com/bminor/glibc. https://sourceware.org/git/gitweb.cgi?p=glibc.git
Find elsewhere
Top answer
1 of 1
1

How can I navigate glibc and find the actual implementation for lib functions?

Type the function in the search bar at https://code.woboq.org/userspace/glibc or at https://github.com/bminor/glibc . Navigate the results manually until you find the definition.

If you want to index the project locally, use cscope, ctags, GLOBAL tags or clangd to index the project and then use that tools specific interface to search for the definition.

As an example, try looking up the definition of hidden_def in glibc

Type hidden_def glibc into google. My first hit is woboq.org https://code.woboq.org/userspace/glibc/include/libc-symbols.h.html#550 .

I use firefox. I type ctrl+f and type hidden_def. Type Enter until I find # define hidden_def at https://code.woboq.org/userspace/glibc/include/libc-symbols.h.html#550 .

Then select __hidden_ver1 and type ctrl+c ctrl+f and ctrl+v and search for it. In the web browser. I type enter until I find https://code.woboq.org/userspace/glibc/include/libc-symbols.h.html#540 . __hidden_ver2 is just below on line 542.

For most cases all you need is a browser, google, coboq.org and github.org.

It's a macro taking you to hidden_def1

There are no such macros as you mentioned, at least at the version hosted at woboq.org.

How does anyone follow it?

While IDE is a powerful help, each project is unique and requires different settings, that take time to figure out. Mostly browsing the source code is grep (or faster alternatives, like ag, very useful for big projects like glibc) and going through the result list.

Not only system dependent things, like setjmp

Developers are (shoudl be :) sane people - in most cases a function named setjmp will be in a file named setjmp.c. or setjmp.S. Or in the same directory as setjmp.h. Or inside directory named stdlib or setjmp.

Type setjmp in github search bar. https://github.com/bminor/glibc/search?q=setjmp You see there are multiple definitions for each architecture powerpc s390 etc. But files are all named setjmp. Go back. Type "Go to file" on https://github.com/bminor/glibc . Search for a file named x86/setjmp. There are 3 implementations, the most standard one seems to be https://github.com/bminor/glibc/blob/master/sysdeps/x86_64/setjmp.S .

even portable functions like fprintf

As above, saerch for file named fprintf . You quickly find https://github.com/bminor/glibc/blob/master/stdio-common/fprintf.c .

🌐
GitHub
github.com › bminor › glibc › tree › glibc-2.29
GitHub - bminor/glibc at glibc-2.29
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Starred by 1.8K users
Forked by 461 users
Languages   C 71.0% | Assembly 12.4% | C++ 7.2% | Pawn 6.0% | Makefile 1.1% | Python 1.0% | C 71.0% | Assembly 12.4% | C++ 7.2% | Pawn 6.0% | Makefile 1.1% | Python 1.0%
🌐
GitHub
github.com › bminor › glibc › blob › master › NEWS
glibc/NEWS at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor
bminor · GitHub
Unofficial mirror of sourceware glibc repository.
🌐
GitHub
github.com › bminor › glibc › commits
Commits · bminor/glibc
Unofficial mirror of sourceware glibc repository. Updated daily. - Commits · bminor/glibc
Author   bminor
🌐
GitHub
github.com › bminor › glibc › branches
Branches · bminor/glibc
Unofficial mirror of sourceware glibc repository. Updated daily. - Branches · bminor/glibc
Author   bminor
🌐
GitHub
github.com › bminor › glibc › blob › master › libio › fileops.c
glibc/libio/fileops.c at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Updated daily. - glibc/libio/fileops.c at master · bminor/glibc
Author   bminor
🌐
GitHub
github.com › bminor › glibc
glibc/ at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Updated daily. - glibc/ at master · bminor/glibc
Author   bminor
🌐
GitHub
github.com › bminor › glibc › blob › master › sysdeps › aarch64 › memcpy.S
glibc/sysdeps/aarch64/memcpy.S at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor › glibc › blob › master › misc › syslog.c
glibc/misc/syslog.c at master · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor
🌐
GitHub
github.com › bminor › glibc › tags
Tags · bminor/glibc
Unofficial mirror of sourceware glibc repository. Contribute to bminor/glibc development by creating an account on GitHub.
Author   bminor