Skip to content

Commit cacaaf2

Browse files
committed
Enable RelativeCodePointers for layered images by default.
1 parent e2821cb commit cacaaf2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/HostedImageLayerBuildingSupport.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.oracle.graal.pointsto.util.AnalysisError;
4040
import com.oracle.svm.core.SubstrateOptions;
4141
import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport;
42+
import com.oracle.svm.core.option.HostedOptionKey;
4243
import com.oracle.svm.core.option.HostedOptionValues;
4344
import com.oracle.svm.core.option.LayerVerifiedOption;
4445
import com.oracle.svm.core.option.LocatableMultiOptionValue.ValueWithOrigin;
@@ -200,6 +201,8 @@ public static void processLayerOptions(EconomicMap<OptionKey<?>, Object> values,
200201
* run time and build time.
201202
*/
202203
SubstrateOptions.ApplicationLayerInitializedClasses.update(values, Module.class.getName());
204+
205+
setOptionIfHasNotBeenSet(values, SubstrateOptions.RelativeCodePointers, true);
203206
}
204207

205208
if (isLayerUseOptionEnabled(hostedOptions)) {
@@ -210,6 +213,13 @@ public static void processLayerOptions(EconomicMap<OptionKey<?>, Object> values,
210213
}
211214
enableConservativeUnsafeAccess(values);
212215
SubstrateOptions.ApplicationLayerInitializedClasses.update(values, Module.class.getName());
216+
setOptionIfHasNotBeenSet(values, SubstrateOptions.RelativeCodePointers, true);
217+
}
218+
}
219+
220+
private static void setOptionIfHasNotBeenSet(EconomicMap<OptionKey<?>, Object> values, HostedOptionKey<Boolean> option, boolean boxedValue) {
221+
if (!values.containsKey(option)) {
222+
option.update(values, boxedValue);
213223
}
214224
}
215225

0 commit comments

Comments
 (0)