@@ -53,12 +53,7 @@ public class NativeImageDebugInfoStripFeature implements InternalFeature {
53
53
54
54
@ Override
55
55
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 ();
62
57
}
63
58
64
59
@ SuppressWarnings ("try" )
@@ -117,35 +112,20 @@ private static boolean stripLinux(AfterImageWriteAccessImpl accessImpl) {
117
112
try {
118
113
Path outputDirectory = imagePath .getParent ();
119
114
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 );
136
126
} 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 );
149
129
}
150
130
return true ;
151
131
} catch (IOException e ) {
0 commit comments