Skip to content

Commit

Permalink
Ignore any potential undefined references caused by inlining in base …
Browse files Browse the repository at this point in the history
…layer.
  • Loading branch information
cstancu committed Apr 26, 2024
1 parent da291fe commit dd58510
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ public static boolean useLIRBackend() {
public static final HostedOptionKey<Boolean> RemoveUnusedSymbols = new HostedOptionKey<>(OS.getCurrent() != OS.DARWIN);
@Option(help = "Keep all undefined symbols.")//
public static final HostedOptionKey<Boolean> PreserveUndefinedSymbols = new HostedOptionKey<>(false);
@Option(help = "Ignore undefined symbols referenced from the built image.")//
public static final HostedOptionKey<Boolean> IgnoreUndefinedReferences = new HostedOptionKey<>(false);
@Option(help = "Use linker option to remove all local symbols from image.")//
public static final HostedOptionKey<Boolean> DeleteLocalSymbols = new HostedOptionKey<>(true);
@Option(help = "Compatibility option to make symbols used for the image heap global. " +
Expand Down Expand Up @@ -1143,6 +1145,8 @@ public void update(EconomicMap<OptionKey<?>, Object> values, Object boxedValue)
super.update(values, boxedValue);
ClosedTypeWorld.update(values, false);
PreserveUndefinedSymbols.update(values, true);
/* Ignore any potential undefined references caused by inlining in base layer. */
IgnoreUndefinedReferences.update(values, true);
AOTTrivialInline.update(values, false);
if (imageLayerEnabledHandler != null) {
imageLayerEnabledHandler.onOptionEnabled(values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ private static class BinutilsCCLinkerInvocation extends CCLinkerInvocation {
/* Perform garbage collection of unused input sections. */
additionalPreOptions.add("-Wl,--gc-sections");
}
if (SubstrateOptions.IgnoreUndefinedReferences.getValue()) {
/* Ignore references to undefined symbols from the object files. */
additionalPreOptions.add("-Wl,--unresolved-symbols=ignore-in-object-files");
}

/* Use --version-script to control the visibility of image symbols. */
try {
Expand Down

0 comments on commit dd58510

Please sign in to comment.