-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Substrate currently uses the -H:+ExitAfterRelocatableImageWrite to take over the compilation/linking process after that. Has there ever been an attempt to use the default -H:NativeLinkerOption=, --native-compiler-options=, --native-compiler-path,.. options to modify linking instead? If so what are the reasons this is not possible, or the reasons why the current approach was chosen?
I have created multiple PR's to expand the list of e.g. windows libs passed to the linker (https://github.com/gluonhq/substrate/blob/master/src/main/java/com/gluonhq/substrate/target/WindowsTargetConfiguration.java#L50-L70). Native-image is capable of figuring out which java libs to include, and equally important which ones not to include based on the required featureset of the application. This distinction is lost in the link
An additional side-effect of using the -H:+ExitAfterRelocatableImageWrite flag is that any required shim dll is not created, which requires for example the workaround described here: #1103 (comment)
Using the default native-image linking would allow these shims to be created as well, including the proper exports on the main executable as well.
Expected Behavior
Additional linker requirements are passed into native-image.
Current Behavior
The -H:+ExitAfterRelocatableImageWrite is passed to native-image and custom linking is performed afterwards.
Context
- The custom linking causes some hard to maintain linking flags to be added as
-H:NativeLinkerOption=arguments through the gluon plugin, when specific features of the JVM are required e.g. fontmanager. - Additional workarounds are needed to create required shim dlls, mainly if awt is used.
I am willing to help with implementation of this, but I want to know a few things first:
- Has this been attempted before? What was the outcome?
- What is the reasoning behind the current approach in the first place?
- Are you interested in this feature request at all?