Only mangle the capability qualifier for pointers in the hybrid ABI #390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the purecap ABI the default pointer representation is capabilities, so
there is no need to add the qualifier to the name mangling. In fact this
can result in difficult-to-debug failures since e.g. version scripts will
no longer export the correct symbols. This problem was discovered in
libcxxrt: the type_info objects for pointer types (e.g. "char*"/"char* const")
were not exported from the purecap library, resulting in linker failures
for C++ programs that use RTTI.
Having all pointers mangled was useful to catch incorrect linker paths
before I added CHERI support to LLD since C++ programs would fail to link
due to missing symbols. However, we now emit errors when attempting to
link purecap and non-purecap libraries so this is no longer useful.
Since the capability mangling is now only used in hybrid mode, I also
changed the mangling to U12__capability:
void test(void *__capability)
now mangles as _Z4testU12__capabilityPvinstead of _Z4testU3capPv and llvm-cxxfilt demangles it to
test(void* __capability)
instead oftest(void* cap)
.This should be a better fix than CTSRD-CHERI/cheribsd#421
This is a flag day for all purecap C++ code but we should't have too much of it. Not sure if we should combine that with other flag days?