Category: Programming
-
GCC Garbage
gcc uses garbage collection internally during the course of a compilation. I wasn’t too involved with gcc at the time that garbage collection was introduced, but I certainly saw the problems that it was trying to solve. Before garbage collection, gcc allocated memory using obstacks. An obstack is a memory allocation pool in which if…
-
GCC vs. CERT
CERT recently issued an unfortunate advisory about gcc. The advisory is about an optimization which gcc introduced in gcc 4.2: given a pointer p, then a comparison of the form p + C1 < p + C2 can be reduced to C1 < C2. This is always valid in standard C and C++, because those…
-
Relational Databases Considered Harmful
My first real job, at the actual company called AIRS and the original owner of the domain airs.com, was working on what was then called a fourth generation language system. Nowadays we would simply call it a database. It was pretty powerful, and we had customers, but we only ran on a system called the…
-
Archive Alignment
gold normally simply mmaps input files and reads the data directly from the mapped memory. In general this requires that all the data structures be properly aligned in the file, which is guaranteed by the ELF standard. The x86, of course, does not require proper alignment for memory loads and stores, so this was never…
-
GCC Exception Frames
When an exception is thrown in C++ and caught by one of the calling functions, the supporting libraries need to unwind the stack. With gcc this is done using a variant of DWARF debugging information. The unwind information is loaded at runtime, but is not read unless an exception is thrown. That means that the…