What library does ld option -lrt refer to (Bionic libc)? What library does ld option -lrt refer to (Bionic libc)? c c

What library does ld option -lrt refer to (Bionic libc)?


When you see a -lsomething, the library name is libsomething. Doing a man librt says the following:

NAME     librt, libposix4 - POSIX.1b Realtime Extensions librarySYNOPSIS     cc [ flag... ] file... -lrt [ library... ]DESCRIPTION     Functions in this library provide  most  of  the  interfaces     specified  by  the  POSIX.1b  Realtime Extension.  See stan-     dards(5). Specifically, this includes the interfaces defined     under   the   Asynchronous  I/O,  Message  Passing,  Process     Scheduling, Realtime Signals Extension,  Semaphores,  Shared     Memory  Objects,  Synchronized  I/O, and Timers options. The     interfaces defined under the Memory  Mapped  Files,  Process     Memory  Locking,  and  Range Memory Locking options are pro-     vided in libc(3LIB)     See the man pages for the individual interfaces  in  section     3RT for information on required headers.     The name libposix4 is maintained for backward  compatibility     and  should be avoided. librt is the preferred name for this     library.


-l is the flag used to link a library into your final executable. In this case, the library in question is librt.a (or librt.so or librt.dylib, depending on your system). librt is the realtime extensions library.


Answering my own question: it was hardcoded into gdc/d/d-spec.c