@@ -53,12 +53,7 @@ public class NativeImageDebugInfoStripFeature implements InternalFeature {
5353
5454 @ Override
5555 public boolean isInConfiguration (IsInConfigurationAccess access ) {
56- /*
57- * Make sure this feature always runs for ELF object files to fix the object file's
58- * alignment with objcopy. This is a temporary workaround; a proper fix will be provided
59- * with GR-68594.
60- */
61- return SubstrateOptions .StripDebugInfo .getValue () || ObjectFile .getNativeFormat () == ObjectFile .Format .ELF ;
56+ return SubstrateOptions .StripDebugInfo .getValue ();
6257 }
6358
6459 @ SuppressWarnings ("try" )
@@ -117,35 +112,20 @@ private static boolean stripLinux(AfterImageWriteAccessImpl accessImpl) {
117112 try {
118113 Path outputDirectory = imagePath .getParent ();
119114 String imageFilePath = outputDirectory .resolve (imageName ).toString ();
120- if (SubstrateOptions .StripDebugInfo .getValue ()) {
121- if (SubstrateOptions .useDebugInfoGeneration ()) {
122- /* Generate a separate debug file before stripping the executable. */
123- String debugInfoName = imageName + debugExtension ;
124- Path debugInfoFilePath = outputDirectory .resolve (debugInfoName );
125- FileUtils .executeCommand (objcopyExe , "--only-keep-debug" , imageFilePath , debugInfoFilePath .toString ());
126- BuildArtifacts .singleton ().add (ArtifactType .DEBUG_INFO , debugInfoFilePath );
127- FileUtils .executeCommand (objcopyExe , "--add-gnu-debuglink=" + debugInfoFilePath , imageFilePath );
128- }
129- if (SubstrateOptions .DeleteLocalSymbols .getValue ()) {
130- /* Strip debug info and local symbols. */
131- FileUtils .executeCommand (objcopyExe , "--strip-all" , imageFilePath );
132- } else {
133- /* Strip debug info only. */
134- FileUtils .executeCommand (objcopyExe , "--strip-debug" , imageFilePath );
135- }
115+ if (SubstrateOptions .useDebugInfoGeneration ()) {
116+ /* Generate a separate debug file before stripping the executable. */
117+ String debugInfoName = imageName + debugExtension ;
118+ Path debugInfoFilePath = outputDirectory .resolve (debugInfoName );
119+ FileUtils .executeCommand (objcopyExe , "--only-keep-debug" , imageFilePath , debugInfoFilePath .toString ());
120+ BuildArtifacts .singleton ().add (ArtifactType .DEBUG_INFO , debugInfoFilePath );
121+ FileUtils .executeCommand (objcopyExe , "--add-gnu-debuglink=" + debugInfoFilePath , imageFilePath );
122+ }
123+ if (SubstrateOptions .DeleteLocalSymbols .getValue ()) {
124+ /* Strip debug info and local symbols. */
125+ FileUtils .executeCommand (objcopyExe , "--strip-all" , imageFilePath );
136126 } else {
137- /*
138- * Make sure the object file is properly aligned. This step creates a temporary
139- * file and then destructively renames it to the original image file name. In
140- * effect, the original native image object file is copied and replaced with the
141- * output of objcopy.
142- *
143- * This is a temporary workaround; a proper fix will be provided with GR-68594.
144- */
145- FileUtils .executeCommand (objcopyExe , imageFilePath );
146-
147- /* Nothing was actually stripped here. */
148- return false ;
127+ /* Strip debug info only. */
128+ FileUtils .executeCommand (objcopyExe , "--strip-debug" , imageFilePath );
149129 }
150130 return true ;
151131 } catch (IOException e ) {
0 commit comments