------- Comment #4 from arnold-j at t-online dot de 2005-11-14 23:16 ------- How do you mean, it seems like a hack? Obviously we can't put the asm in a different file, because then the symbols would clearly be defined in a different translation unit. As-is they are not, but gcc 4.0.x errors because it doesn't see the symbols in the inline asm.
There are two main points which require the code to work like it does: (1) As mentioned, the exception number can only be derived from the called address. UIE() is there to catch all unexpected interrupts and exceptions, i.e. those for which there are no specific handlers. That's why all _UIE##number symbols are defined in the asm block, in a regular structure that allows to compute the vector number from the called address easily. (2) We need to weak-alias these asm symbols because they should only be used when there is no dedicated handler for the specific interrupt or exception defined in any other source file. Perhaps it would be possible to hard code which handlers are implemented elsewhere and which are not, but that would be rather hard to maintain. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863