Support exception handling on statically-linked binaries
authorJohn Marino <draco@marino.st>
Sun, 5 Feb 2012 16:21:27 +0000 (17:21 +0100)
committerJohn Marino <draco@marino.st>
Sun, 5 Feb 2012 16:49:40 +0000 (17:49 +0100)
commitd4cce2160341f99fcf56cb691c56b2475250c044
tree0ad06b79aa8e8221461a118d64a8a2a0e9696b0a
parentbac3c6349f25de315ae41c036e5dd310d23e6482
Support exception handling on statically-linked binaries

The real-time dynamic linker handles exceptions on dynamically-linked
binaries through the dl_iterate_phdr function.  The RTLD isn't invoked
on statically-built executables so thrown exceptions weren't getting
handled.  There was a dummy dl_iterate_phdr function in libc with a
weak symbol that gets looked at when the rtld version isn't present.
This function was populated and gets called when the statically-linked
executable throws an exception.

It requires the GNU_EH_FRAME program header to be present.  The base
gcc 4.4 spec file was modified to emit this header for statically-built
binaries in addition to the dynamically lined ones.
contrib/gcc-4.4/gcc/config/dragonfly.h
lib/libc/gen/dlfcn.c