@@ -184,7 +184,7 @@ def linkFiles(pArgs, fileNames):
184
184
185
185
fileNames = map (getBitcodePath , fileNames )
186
186
linkCmd .extend ([x for x in fileNames if x != '' ])
187
- _logger . info ( 'Writing output to %s' , pArgs . outputFile )
187
+
188
188
try :
189
189
linkProc = Popen (linkCmd )
190
190
except OSError as e :
@@ -261,8 +261,12 @@ def handleExecutable(pArgs):
261
261
if not fileNames :
262
262
return 1
263
263
264
+ if pArgs .sortBitcodeFilesFlag :
265
+ fileNames = sorted (fileNames )
266
+
267
+
264
268
if pArgs .manifestFlag :
265
- writeManifest (pArgs , '{0}.llvm.manifest' .format (pArgs .inputFile ), fileNames )
269
+ writeManifest ('{0}.llvm.manifest' .format (pArgs .inputFile ), fileNames )
266
270
267
271
if pArgs .outputFile is None :
268
272
pArgs .outputFile = pArgs .inputFile + '.' + moduleExtension
@@ -279,13 +283,15 @@ def handleThinArchive(pArgs):
279
283
280
284
bcFiles = []
281
285
for p in objectPaths :
282
- _logger .info ('handleThinArchive: processing %s' , p )
286
+ _logger .debug ('handleThinArchive: processing %s' , p )
283
287
contents = pArgs .extractor (p )
284
288
for c in contents :
285
289
if c :
286
- _logger .info ('\t including %s' , c )
290
+ _logger .debug ('\t including %s' , c )
287
291
bcFiles .append (str (c ))
288
292
293
+
294
+
289
295
return buildArchive (pArgs , bcFiles )
290
296
291
297
#iam: do we want to preserve the order in the archive? if so we need to return both the list and the dict.
@@ -460,9 +466,12 @@ def buildArchive(pArgs, bitCodeFiles):
460
466
else :
461
467
_logger .info ('Generating LLVM Bitcode archive from an archive' )
462
468
469
+ if pArgs .sortBitcodeFilesFlag :
470
+ bitCodeFiles = sorted (bitCodeFiles )
471
+
463
472
#write the manifest file if asked for
464
473
if pArgs .manifestFlag :
465
- writeManifest (pArgs , '{0}.llvm.manifest' .format (pArgs .inputFile ), bitCodeFiles )
474
+ writeManifest ('{0}.llvm.manifest' .format (pArgs .inputFile ), bitCodeFiles )
466
475
467
476
if pArgs .bitcodeModuleFlag :
468
477
@@ -492,9 +501,7 @@ def buildArchive(pArgs, bitCodeFiles):
492
501
return archiveFiles (pArgs , bitCodeFiles )
493
502
494
503
495
- def writeManifest (pArgs , manifestFile , bitCodeFiles ):
496
- if pArgs .sortManifestFlag :
497
- bitCodeFiles = sorted (bitCodeFiles )
504
+ def writeManifest (manifestFile , bitCodeFiles ):
498
505
with open (manifestFile , 'w' ) as output :
499
506
for f in bitCodeFiles :
500
507
output .write ('{0}\n ' .format (f ))
@@ -554,9 +561,9 @@ def extract_bc_args():
554
561
dest = 'manifestFlag' ,
555
562
help = 'Write a manifest file listing all the .bc files used.' ,
556
563
action = 'store_true' )
557
- parser .add_argument ('--sortmanifest ' , '-s' ,
558
- dest = 'sortManifestFlag ' ,
559
- help = 'Sort the manifest file (if written ).' ,
564
+ parser .add_argument ('--sort ' , '-s' ,
565
+ dest = 'sortBitcodeFilesFlag ' ,
566
+ help = 'Sort the list of bitcode files (for debugging ).' ,
560
567
action = 'store_true' )
561
568
parser .add_argument ('--bitcode' , '-b' ,
562
569
dest = 'bitcodeModuleFlag' ,
0 commit comments