A completely different approach to EH runtime

Linus Torvalds torvalds@transmeta.com
Wed Feb 21 16:19:00 GMT 2001


In article < 20010220220405.D4509@wolery.stanford.edu >,
Zack Weinberg <zackw@stanford.edu> wrote:
>
>All executables linked with -fexceptions (whether or not that's the
>language default) get crteh.o thrown in right after crtbegin.o, and
>libeh.a at the very beginning of the library list.  Therefore all the
>libraries bind to the copy of the eh routines in the executable.

This sounds like a good idea.

I would suggest that you add _another_ flag than -fexception, something
like -feh.  "-feh" would be implied by "-fexception", but could be used
without it (and -fexceptions could possibly be used with "-fno-eh"). 

Why?

I suspect you'll find potentially lots of cases where the program itself
doesn't necessarily want to have exception handlers and the overhead,
but it wants to be able to link against a library that _does_ use
exceptions internally and thus wants the eh support linked in.. 
   
Also, you might have the reverse be true: a program that _does_ use
exceptions, but knows that it links against an older library (say, the
current Linux glibc) that already has the exception handlers, so
"-fno-eh" would be used there. 
        
So please use two flags: one that implies that the compiler adds
exception handling capabilities (-fexceptions), and the other that says
to please link in the exception handler code. 

                Linus



More information about the Gcc mailing list