@@ -208,7 +208,7 @@ def handleExecutable(pArgs):
208
208
return 1
209
209
210
210
if pArgs .manifestFlag :
211
- manifestFile = '{0}.wllvm .manifest' .format (pArgs .inputFile )
211
+ manifestFile = '{0}.llvm .manifest' .format (pArgs .inputFile )
212
212
with open (manifestFile , 'w' ) as output :
213
213
for f in fileNames :
214
214
output .write ('{0}\n ' .format (f ))
@@ -293,18 +293,30 @@ def handleArchive(pArgs):
293
293
return buildArchive (pArgs , bitCodeFiles )
294
294
295
295
def buildArchive (pArgs , bitCodeFiles ):
296
- # Pick output file path if outputFile not set
297
- if pArgs .outputFile == None :
298
- if pArgs .inputFile .endswith ('.a' ):
299
- # Strip off .a suffix
300
- pArgs .outputFile = pArgs .inputFile [:- 2 ]
301
- else :
302
- pArgs .outputFile = pArgs .inputFile
303
- pArgs .outputFile += '.' + bitCodeArchiveExtension
304
296
305
- logging . info ( 'Writing output to {0}' . format ( pArgs .outputFile ))
297
+ if pArgs .bitcodeModuleFlag :
306
298
307
- return archiveFiles (pArgs , bitCodeFiles )
299
+ # Pick output file path if outputFile not set
300
+ if pArgs .outputFile == None :
301
+ pArgs .outputFile = pArgs .inputFile
302
+ pArgs .outputFile += '.' + moduleExtension
303
+
304
+ logging .info ('Writing output to {0}' .format (pArgs .outputFile ))
305
+
306
+ return linkFiles (pArgs , bitCodeFiles )
307
+
308
+ else :
309
+
310
+ # Pick output file path if outputFile not set
311
+ if pArgs .outputFile == None :
312
+ if pArgs .inputFile .endswith ('.a' ):
313
+ # Strip off .a suffix
314
+ pArgs .outputFile = pArgs .inputFile [:- 2 ]
315
+ pArgs .outputFile += '.' + bitCodeArchiveExtension
316
+
317
+ logging .info ('Writing output to {0}' .format (pArgs .outputFile ))
318
+
319
+ return archiveFiles (pArgs , bitCodeFiles )
308
320
309
321
310
322
class ExtractedArgs :
@@ -354,9 +366,9 @@ def extract_bc_args(args):
354
366
dest = 'manifestFlag' ,
355
367
help = 'Write a manifest file listing all the .bc files used.' ,
356
368
action = 'store_true' )
357
- parser .add_argument ('--bytecode ' , '-b' ,
358
- dest = 'bytecodeModuleFlag ' ,
359
- help = 'Extract a bytecode module rather than an archive. ' +
369
+ parser .add_argument ('--bitcode ' , '-b' ,
370
+ dest = 'bitcodeModuleFlag ' ,
371
+ help = 'Extract a bitcode module rather than an archive. ' +
360
372
'Only useful when extracting from an archive.' ,
361
373
action = 'store_true' )
362
374
parser .add_argument ('--output' ,'-o' ,
@@ -425,7 +437,10 @@ def process_file_unix(pArgs):
425
437
logging .info ('Generating LLVM Bitcode module' )
426
438
return handleExecutable (pArgs )
427
439
elif ft == FileType .ARCHIVE :
428
- logging .info ('Generating LLVM Bitcode archive' )
440
+ if pArgs .bitcodeModuleFlag :
441
+ logging .info ('Generating LLVM Bitcode module from an archive' )
442
+ else :
443
+ logging .info ('Generating LLVM Bitcode archive from an archive' )
429
444
return handleArchive (pArgs )
430
445
else :
431
446
logging .error ('File "{0}" of type {1} cannot be used' .format (pArgs .inputFile , FileType .revMap [ft ]))
@@ -446,7 +461,10 @@ def process_file_darwin(pArgs):
446
461
logging .info ('Generating LLVM Bitcode module' )
447
462
return handleExecutable (pArgs )
448
463
elif ft == FileType .ARCHIVE :
449
- logging .info ('Generating LLVM Bitcode archive' )
464
+ if pArgs .bitcodeModuleFlag :
465
+ logging .info ('Generating LLVM Bitcode module from an archive' )
466
+ else :
467
+ logging .info ('Generating LLVM Bitcode archive from an archive' )
450
468
return handleArchive (pArgs )
451
469
else :
452
470
logging .error ('File "{0}" of type {1} cannot be used' .format (pArgs .inputFile , FileType .revMap [ft ]))
0 commit comments