On 02/02/2021 11:59, Andrey Semashev via Boost wrote:
PPS: I forgot to add that recent gcc versions don't need RTTI to be publicly visible to be able to catch exceptions or compare type_info, as they now perform deep string comparison instead of address comparison. However, older compiler versions are still susceptible to this, and I'm not sure if the deep comparison behavior is used on all platforms.
My memory, which may be wrong, is that older GCCs/binutils shortly after my patch was merged to mainline did do deep string comparisons, but it got reverted in newer GCCs/bintuils. And clang does not do whatever GCC does. I may be confused, and instead am thinking that GCC does the right thing, but clang does not. There also may be separate treatment in each of the linkers. For example, I believe GNU gold always does deep string comparison. And there also may be separate treatment in the stack unwinding implementation which calculates exception catches, than in the linker. Oh, and don't forget the command line linker is not the shared library process loading linker, and both those may be different here as well. It's hard to remember details given the passage of time. I generally assume the worst case possible, and to date I've not had a problem. ELF is borked badly in this area. PE and MachO and indeed any other binary format gets all this stuff right. ELF could be upgraded to not be borked, by someone with infinite patience and better political skills than I have. Niall