@@ -150,9 +150,19 @@ def handleExecutable(inputFile, outputFile, extractor, llvmLinker):
150
150
151
151
linkCmd .extend ([x for x in fileNames if x != '' ])
152
152
logging .info ('Writing output to {0}' .format (outputFile ))
153
- linkProc = Popen (linkCmd )
154
- exitCode = linkProc .wait ()
155
- logging .info ('{0} returned {1}' .format (llvmLinker , str (exitCode )))
153
+ try :
154
+ linkProc = Popen (linkCmd )
155
+ except OSError as e :
156
+ if e .errno == 2 :
157
+ errorMsg = "Your llvm-link doesn't seem to be easy to find.\n Either install it or use the -l llvmLinker option."
158
+ else :
159
+ errorMsg = "OS error({0}): {1}" .format (e .errno , e .strerror )
160
+ logging .error (errorMsg )
161
+ raise Exception (errorMsg )
162
+
163
+ else :
164
+ exitCode = linkProc .wait ()
165
+ logging .info ('{0} returned {1}' .format (llvmLinker , str (exitCode )))
156
166
return exitCode
157
167
158
168
@@ -173,7 +183,16 @@ def handleArchive(inputFile, outputFile, arCmd, fileType, extractor, llvmArchive
173
183
os .chdir (tempDir )
174
184
175
185
# Extract objects from archive
176
- arP = Popen (arCmd )
186
+ try :
187
+ arP = Popen (arCmd )
188
+ except OSError as e :
189
+ if e .errno == 2 :
190
+ errorMsg = "Your llvm-ar doesn't seem to be easy to find.\n Either install it or use the -a llvmArchiver option."
191
+ else :
192
+ errorMsg = "OS error({0}): {1}" .format (e .errno , e .strerror )
193
+ logging .error (errorMsg )
194
+ raise Exception (errorMsg )
195
+
177
196
arPE = arP .wait ()
178
197
179
198
if arPE != 0 :
@@ -294,6 +313,7 @@ def extract_bc_args(args):
294
313
295
314
inputFile = parsedArgs .wllvm_binary
296
315
llvmLinker = parsedArgs .linker
316
+ llvmArchiver = parsedArgs .archiver
297
317
verboseFlag = parsedArgs .verbose
298
318
299
319
# Check file exists
0 commit comments