On Mon, 12 Dec 2022 01:29:14 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Justin King has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Remove UBSAN_ENABLED From spec.gmk.in
>
> src/java.base/share/native/launcher/main.c line 37:
> 
>> 35: #include "jni.h"
>> 36: 
>> 37: #ifdef UNDEFINED_BEHAVIOR_SANITIZER
> 
> I really do not like having to make source code changes to accommodate these 
> kinds of tools.

Yeah, it is unfortunate. However there is no other way to actually set the 
defaults nicely. The other alternative is to use environment variables, but 
they are easy to forget when invoking the launcher manually.

> src/java.base/share/native/launcher/main.c line 40:
> 
>> 38: // Override weak symbol exposed by UBSan to override default options. 
>> This is called by UBSan
>> 39: // extremely early during library loading, before main is called.
>> 40: JNIEXPORT const char* __ubsan_default_options() {
> 
> Why would this need `JNIEXPORT`? This is not a JNI function.

Ugh, apparently resolving doesn't add the comment. I thought it did...

So answering, JNIEXPORT is needed so that the symbol is exported and the linker 
doesn't remove it. It adds `__attribute__((visibility("default"))`.

-------------

PR: https://git.openjdk.org/jdk/pull/11604

Reply via email to