[TUHS] crt0 -- what's in that name?

Chris Pinnock via TUHS tuhs at tuhs.org
Tue Jun 13 06:28:32 AEST 2023


> On 12 Jun 2023, at 21:22, Dan Cross <crossd at gmail.com> wrote:
> 
> Hmm. The comment at the top of `crt0.s` from 2nd Edition says, "C
> runtime startoff", which seems pretty clear. Whether that has changed
> over time is, of course, another matter (like how GCC changed to "GNU
> Compiler Collection").

Possibly - in this file http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/README?rev=1.6&content-type=text/x-cvsweb-markup&only_with_tag=MAIN, the CSU and related files are referred to as the compiler runtime. But startoff is appropriate - because the file was usually included in the binary at the beginning to initialise stuff. 

These days ELF formats and similar have specific sections for initing and terminating binaries - although I the crt name lives on with start and end:

servalan: {482} ls -la /usr/lib/crt*
-r--r--r--  1 root  wheel  4328 Jan 14 18:18 /usr/lib/crt0.o
-r--r--r--  1 root  wheel  2648 Jan 14 18:18 /usr/lib/crtbegin.o
-r--r--r--  1 root  wheel  2880 Jan 14 18:18 /usr/lib/crtbeginS.o
lrwxr-xr-x  1 root  wheel    10 Jan 14 18:18 /usr/lib/crtbeginT.o -> crtbegin.o
-r--r--r--  1 root  wheel  1264 Jan 14 18:18 /usr/lib/crtend.o
lrwxr-xr-x  1 root  wheel     8 Jan 14 18:18 /usr/lib/crtendS.o -> crtend.o
-r--r--r--  1 root  wheel  1488 Jan 14 18:18 /usr/lib/crti.o
-r--r--r--  1 root  wheel  1152 Jan 14 18:18 /usr/lib/crtn.o

> 
> 
> I thought it was pretty well known that it stands for, "Block Started
> (by) Symbol”?

I wrote a paper on a.out a year or so ago and concluded that I could not find an adequate answer - so avoided the issue with a  non-commital footnote.

C




More information about the TUHS mailing list