8201226 missing JNIEXPORT / JNICALL at some places in function declarations/implementations - was : RE: missing JNIEXPORT / JNICALL at some places in function declarations/implementations
Alexey Ivanov
alexey.ivanov at oracle.com
Wed Apr 11 12:49:59 UTC 2018
On 11/04/2018 11:38, Magnus Ihse Bursie wrote:
>> 11 apr. 2018 kl. 11:10 skrev Alexey Ivanov <alexey.ivanov at oracle.com>:
>>
>> On 11/04/2018 08:44, Baesken, Matthias wrote:
>>>> JIMAGE_FindResource doesn't have JNICALL modifier now, does it?
>>> Hi Alexey, yes that's true .
>>>
>>>> Please remove JNIEXPORT from main():
>>>> src/java.base/share/native/launcher/main.c
>>>> src/jdk.pack/share/native/unpack200/main.cpp
>>> I would prefer to keep it for now .
>>> I notice some comments in our SAPJVM code base about needing JNIEXPORT for main for Solaris (we were running in SAPJVM without mapfiles in the past already).
>>> Maybe that’s related to
>>>
>>> src/java.base/unix/native/libjli/java_md_solinux.c
>>>
>>> where main is dlsym-ed : fptr = (int (*)())dlsym(RTLD_DEFAULT, "main");
>>> but I am not sure about this.
>>> So I better keep the JNIEXPORT for the main functions, could be removed in another cleanup if really needed.
>> OK. Let them stay then.
>> Was main() exported via map files?
> Yes. You cannot remove the export of main! Since we hide symbols by default even for executables, it would not be possible to execute if the main function is not visible.
Actually it works without JNIEXPORT modifier at main function declared in
src/java.base/share/native/launcher/main.c
src/jdk.pack/share/native/unpack200/main.cpp
at least for all 64 bit platforms built at Oracle, all tier3 tests pass.
I wouldn't have suggested removing JNIEXPORT if it hadn't.
Usually main is not exported.
Yet it was exported via map files and the code snippet provided by
Matthias hints something may break if main is not exported.
Regards,
Alexey
>
>
> /Magnus
>
>>
>> The change looks good to me.
>>
>> Regards,
>> Alexey
>>
>>>> You can reference both yourself and me as
>>>> Contributed-by: mbaesken, aivanov
>>>> when pushing the changeset if you don't mind.
>>>>
>>> Sure .
>>>
>>> Best regards, Matthias
>>>
>>>
>>>> -----Original Message-----
>>>> From: Alexey Ivanov [mailto:alexey.ivanov at oracle.com]
>>>> Sent: Dienstag, 10. April 2018 21:34
>>>> To: Baesken, Matthias <matthias.baesken at sap.com>; Magnus Ihse Bursie
>>>> <magnus.ihse.bursie at oracle.com>
>>>> Cc: build-dev <build-dev at openjdk.java.net>; Doerr, Martin
>>>> <martin.doerr at sap.com>
>>>> Subject: Re: 8201226 missing JNIEXPORT / JNICALL at some places in function
>>>> declarations/implementations - was : RE: missing JNIEXPORT / JNICALL at
>>>> some places in function declarations/implementations
>>>>
>>>> Hi Matthias,
>>>>
>>>>> On 10/04/2018 11:14, Baesken, Matthias wrote:
>>>>> Hello, I had to do another small adjustment to make jimage.hpp/cpp match. Please review :
>>>>>
>>>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8201226.2/
>>>> JIMAGE_FindResource doesn't have JNICALL modifier now, does it?
>>>>
>>>> I've successfully built 32 bit Windows with your patch.
>>>>
>>>>
>>>> Please remove JNIEXPORT from main():
>>>> src/java.base/share/native/launcher/main.c
>>>> src/jdk.pack/share/native/unpack200/main.cpp
>>>>
>>>>> With the latest webrev I could finally build jdk/jdk successfully on both win32bit and win64 bit.
>>>>>
>>>>> Thanks again to Alexey to provide the incorporated patch .
>>>> You can reference both yourself and me as
>>>> Contributed-by: mbaesken, aivanov
>>>> when pushing the changeset if you don't mind.
>>>>
>>>>
>>>> Regards,
>>>> Alexey
>>>>
>>>>> Best regards, Matthias
More information about the build-dev
mailing list