Skip to content

Commit

Permalink
Merge pull request #40594 from geoand/march-native
Browse files Browse the repository at this point in the history
Add an 'march' property to native configuration
  • Loading branch information
gsmet authored May 13, 2024
2 parents ee4a4e1 + ebdc223 commit 491cde1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
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

0 comments on commit 491cde1

Please sign in to comment.