this change is to get the right tags for C++ ABI matching. it should have no other effects.
some of this code should be cleaned up, e.g. using macros for some of the bit flags, masks, etc. nonetheless, the code is believed to be working and correct at this point.