[PATCH] Windows 32-bit DLL name decoration (original) (raw)

Alexey Ivanov alexey.ivanov at oracle.com
Wed Dec 12 15:43:38 UTC 2018


Hi Bob,

Thank you for the pointers on how the same situation is handled in Hotspot for _OnLoad functions.

At this time, we're dealing with one symbol only. If other symbols are added in the future, we should definitely use this approach.

Regards, Alexey

On 11/12/2018 17:22, Bob Vandette wrote:

Hotspot has had support for decorated and non-decorated names for the JNIOnLoad functions. Perhaps you should just follow the same procedure for the debug library.

#define JNIONLOADSYMBOLS {"JNIOnLoad at 8", "JNIOnLoad"} #define JNIONUNLOADSYMBOLS {"JNIOnUnload at 8", "JNIOnUnload"} #define JVMONLOADSYMBOLS {"JVMOnLoad at 12", "JVMOnLoad"} #define AGENTONLOADSYMBOLS {"AgentOnLoad at 12", "AgentOnLoad"} #define AGENTONUNLOADSYMBOLS {"AgentOnUnload at 4", "AgentOnUnload"} #define AGENTONATTACHSYMBOLS {"AgentOnAttach at 12", “AgentOnAttach”} Bob.

On Dec 11, 2018, at 11:43 AM, Simon Tooke <stooke at redhat.com> wrote: On 2018-12-11 10:05 a.m., Alexey Ivanov wrote: Hi everyone,

I came up with the following patch: http://cr.openjdk.java.net/~aivanov/8214122/webrev.00/ It specifically addresses the problem in JDK-8214122 where on 32 bit Windows jdwpTransportOnLoad can exported with its plain and _stdcall-mangled name. I used conditional compilation so that for other platforms the code remains as it is now. jshell starts successfully with this fix; an IDE debugger works as well. I am not a reviewer, but this patch only works for the specific case under discussion; the '@16' refers to the reserved stack size in the Pascal calling convention. So, the patch only works for 16 bytes of parameters. To be generic, the routine needs to have the stack size passed in by the caller. If a generic fix isn't desired (and I hope it is), I'd prefer to see the caller simply pass the decorated or undecorated name depending on the Win32/64 defines. #if defined(WIN32) && !defined(WIN64) onLoad = (jdwpTransportOnLoadt) dbgsysFindLibraryEntry(handle, "jdwpTransportOnLoad at 16"); #else onLoad = (jdwpTransportOnLoadt) dbgsysFindLibraryEntry(handle, "jdwpTransportOnLoad"); #endif Thanks, -Simon Regards, Alexey https://bugs.openjdk.java.net/browse/JDK-8214122 On 10/12/2018 15:11, Magnus Ihse Bursie wrote: Since removing JNICALL is not an option, there are only two options:

1. Add |/export| option to the Makefile or pragma-comment to the source file; 2. Lookup the decorated name |jdwpTransportOnLoad at 16| for Win32 with fallback to undecorated one. Yes. I think the correct solution here is 2.



More information about the build-dev mailing list