Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an 'march' property to native configuration #40594

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ public interface NativeConfig {
*/
Optional<Boolean> pie();

/**
* Generate instructions for a specific machine type. Defaults to {@code x86-64-v3} on AMD64 and {@code armv8-a} on AArch64.
* Use {@code compatibility} for best compatibility, or {@code native} for best performance if a native executable is
* deployed on the same machine or on a machine with the same CPU features.
* A list of all available machine types is available by executing {@code native-image -march=list}
*/
Optional<String> march();

/**
* If this build is done using a remote docker daemon.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,9 @@ public NativeImageInvokerInfo build() {
if (nativeConfig.enableVmInspection()) {
addExperimentalVMOption(nativeImageArgs, "-H:+AllowVMInspection");
}
if (nativeConfig.march().isPresent()) {
nativeImageArgs.add("-march=" + nativeConfig.march().get());
}

List<NativeConfig.MonitoringOption> monitoringOptions = new ArrayList<>();
monitoringOptions.add(NativeConfig.MonitoringOption.HEAPDUMP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public Optional<Boolean> pie() {
return Optional.empty();
}

@Override
public Optional<String> march() {
return Optional.empty();
}

@Override
public boolean remoteContainerBuild() {
return false;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/native-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2255,7 +2255,7 @@ To work around that issue, add the following line to the `application.properties

[source, properties]
----
quarkus.native.additional-build-args=-march=compatibility
quarkus.native.march=compatibility
----

Then, rebuild your native executable.
Expand Down
Loading