hyperlogic.org
A witty saying proves nothing. -Voltaire

History of the .bss Section

Every once and a while I stumble upon some arcane programming term and I think to myself: Why in the hell did they name it that? To deliberately confuse people? WTF?

Turns out most of the time they're just following in someone else's foot steps. Take the most recent example I ran into while doing work for the PS3 SPU's.

The SPU only has 256K of memory. So, it's very important to know the size of everything, including your code. Sony uses gcc, so it turns out they use a hacked up version of the GNU binutils size program.

Take a look at the output from the size command.

$ size /bin/sh
   text    data     bss     dec     hex filename
 712739   37524   21832  772095   bc7ff /bin/sh

Text I can understand, they're the actual instructions. Data I can understand as well, those are the global variables.

But what the hell is a bss?

After a bit of searching I turned up the answer, it's where the uninitialized globals go. Because they aren't initialized they don't end up in the actual executable file. That's why looking at the actual executable size isn't a good estimate of how much code space your program will take up.

But why bss?

After a google search I turned up this gem of a quote from Dennis Ritchie.

Actually the acronym (in the sense we took it up; it may have other credible etymologies) is "Block Started by Symbol." It was a pseudo-op in FAP (Fortran Assembly [-er?] Program), an assembler for the IBM 704-709-7090-7094 machines. It defined its label and set aside space for a given number of words.

That goes way back. The 704 was introduced in 1954. It still used fucking vacuum tubes. It was the size of a room. Core memory was brand spanking new. Introducing us to such terms as "core dump".

IBM 704, It's HUGE

From the IBM 704 to the Playstation 3, it's humbling to know that even in the fast paced world of computer software, concepts that were coined 50 years ago still apply today.