Skip to content

Commit 42c5824

Browse files
committed
[GR-51086] Introduce --static-nolibc API option.
PullRequest: graal/17161
2 parents 450c25e + b14ebdf commit 42c5824

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

docs/reference-manual/native-image/BuildOptions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Run `native-image --help` for help on build options.
7373
* `--shared`: build a shared library
7474
* `--silent`: silence build output
7575
* `--static`: build a statically-linked executable (requires `libc` and `zlib` static libraries)
76+
* `--static-nolibc`: build statically linked executable with libc dynamically linked
7677
* `--target`: select the compilation target for `native-image` (in the `<OS>-<architecture>` format). It defaults to host's OS-architecture pair.
7778
* `--trace-class-initialization`: provide a comma-separated list of fully-qualified class names that a class initialization is traced for
7879
* `--trace-object-instantiation`: provide a comma-separated list of fully-qualified class names that an object instantiation is traced for

docs/reference-manual/native-image/guides/build-static-and-mostly-static-executable.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ With GraalVM Native Image you can build a mostly-static native executable that s
114114
To build a mostly-static native executable, use this command:
115115
116116
```shell
117-
native-image -H:+StaticExecutableWithDynamicLibC [other arguments] <Class>
117+
native-image --static-nolibc [other arguments] <Class>
118118
```
119119
120120
To build a a mostly-static native executable for the above `EnvMap` demo, run:
121121
122122
```shell
123-
native-image -H:+StaticExecutableWithDynamicLibC EnvMap
123+
native-image --static-nolibc EnvMap
124124
```
125125
126126
This produces a native executable that statically links all involved libraries (including JDK shared libraries) except for `libc`. This includes `zlib`. Also, depending on the user's code, it may link `libstdc+` and `libgcc`.

substratevm/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This changelog summarizes major changes to GraalVM Native Image.
1515
* (GR-51053) Use [`vswhere`](https://github.com/microsoft/vswhere) to find Visual Studio installations more reliably and in non-standard installation locations.
1616
* (GR-47832) Experimental support for upcalls from foreign code and other improvements to our implementation of the [Foreign Function & Memory API](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/ForeignInterface.md) (part of "Project Panama", [JEP 454](https://openjdk.org/jeps/454)) on AMD64. Must be enabled with `-H:+ForeignAPISupport` (requiring `-H:+UnlockExperimentalVMOptions`).
1717
* (GR-52314) `-XX:MissingRegistrationReportingMode` can now be used on program invocation instead of as a build option, to avoid a rebuild when debugging missing registration errors.
18+
* (GR-51086) Introduce a new `--static-nolibc` API option as a replacement for the experimental `-H:±StaticExecutableWithDynamicLibC` option.
1819

1920
## GraalVM for JDK 22 (Internal Version 24.0.0)
2021
* (GR-48304) Red Hat added support for the JFR event ThreadAllocationStatistics.

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
150150
}
151151
};
152152

153-
@Option(help = "Builds a statically linked executable with libc dynamically linked", type = Expert, stability = OptionStability.EXPERIMENTAL)//
153+
@APIOption(name = "static-nolibc")//
154+
@Option(help = "Build statically linked executable with libc dynamically linked", type = Expert, stability = OptionStability.EXPERIMENTAL)//
154155
public static final HostedOptionKey<Boolean> StaticExecutableWithDynamicLibC = new HostedOptionKey<>(false);
155156

156157
@Option(help = "Builds image with libstdc++ statically linked into the image (if needed)", type = Expert, stability = OptionStability.EXPERIMENTAL)//

0 commit comments

Comments
 (0)