RFR: 8282475: SafeFetch should not rely on existence of Thread::current [v7]
Florian Weimer
fweimer at openjdk.java.net
Mon Mar 14 08:22:53 UTC 2022
On Mon, 14 Mar 2022 08:03:39 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> Thanks a lot, Florian! I got it to work under Linux x64.
Great!
> My error was that I had declared the label in C++ as `extern void* SafeFetch_continuation`. Declaring it as `extern char _SafeFetch32_continuation[] __attribute__ ((visibility ("hidden")));` as you suggested does the trick. I'm not sure I understand the difference.
Your approach might have worked as well, but you would have to use `&SafeFetch_continuation` on the C++ side. Arrays work directly because of pointer decay. The actual type does not matter because you just want to create a code address from that, so there's no corresponding object (in the C++ standard sense) at the address anyway.
Anyway, from what I've seen, the array is more idiomatic.
> > It doesn't hurt, but the Itanium ABI does not mangle such global data symbols, so it's not strictly needed.
>
> I don't understand this remark, what does Itanium have to do with this?
The [C++ ABI definition](https://github.com/itanium-cxx-abi/cxx-abi) is probably Itanium's most lasting contribution to computing. I think it's used on most non-Windows systems these days, not just on Linux, and of course on all kinds of CPUs.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7727
More information about the serviceability-dev
mailing list