Skip to content

Commit 6dd2dbd

Browse files
committed
Output for thin and fat archives during linux kernel build now coincide. Victory?
1 parent dfa1026 commit 6dd2dbd

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

wllvm/extraction.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def linkFiles(pArgs, fileNames):
184184

185185
fileNames = map(getBitcodePath, fileNames)
186186
linkCmd.extend([x for x in fileNames if x != ''])
187-
_logger.info('Writing output to %s', pArgs.outputFile)
187+
188188
try:
189189
linkProc = Popen(linkCmd)
190190
except OSError as e:
@@ -261,8 +261,12 @@ def handleExecutable(pArgs):
261261
if not fileNames:
262262
return 1
263263

264+
if pArgs.sortBitcodeFilesFlag:
265+
fileNames = sorted(fileNames)
266+
267+
264268
if pArgs.manifestFlag:
265-
writeManifest(pArgs, '{0}.llvm.manifest'.format(pArgs.inputFile), fileNames)
269+
writeManifest('{0}.llvm.manifest'.format(pArgs.inputFile), fileNames)
266270

267271
if pArgs.outputFile is None:
268272
pArgs.outputFile = pArgs.inputFile + '.' + moduleExtension
@@ -279,13 +283,15 @@ def handleThinArchive(pArgs):
279283

280284
bcFiles = []
281285
for p in objectPaths:
282-
_logger.info('handleThinArchive: processing %s', p)
286+
_logger.debug('handleThinArchive: processing %s', p)
283287
contents = pArgs.extractor(p)
284288
for c in contents:
285289
if c:
286-
_logger.info('\t including %s', c)
290+
_logger.debug('\t including %s', c)
287291
bcFiles.append(str(c))
288292

293+
294+
289295
return buildArchive(pArgs, bcFiles)
290296

291297
#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):
460466
else:
461467
_logger.info('Generating LLVM Bitcode archive from an archive')
462468

469+
if pArgs.sortBitcodeFilesFlag:
470+
bitCodeFiles = sorted(bitCodeFiles)
471+
463472
#write the manifest file if asked for
464473
if pArgs.manifestFlag:
465-
writeManifest(pArgs, '{0}.llvm.manifest'.format(pArgs.inputFile), bitCodeFiles)
474+
writeManifest('{0}.llvm.manifest'.format(pArgs.inputFile), bitCodeFiles)
466475

467476
if pArgs.bitcodeModuleFlag:
468477

@@ -492,9 +501,7 @@ def buildArchive(pArgs, bitCodeFiles):
492501
return archiveFiles(pArgs, bitCodeFiles)
493502

494503

495-
def writeManifest(pArgs, manifestFile, bitCodeFiles):
496-
if pArgs.sortManifestFlag:
497-
bitCodeFiles = sorted(bitCodeFiles)
504+
def writeManifest(manifestFile, bitCodeFiles):
498505
with open(manifestFile, 'w') as output:
499506
for f in bitCodeFiles:
500507
output.write('{0}\n'.format(f))
@@ -554,9 +561,9 @@ def extract_bc_args():
554561
dest='manifestFlag',
555562
help='Write a manifest file listing all the .bc files used.',
556563
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).',
560567
action='store_true')
561568
parser.add_argument('--bitcode', '-b',
562569
dest='bitcodeModuleFlag',

wllvm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
1.1.5 - 3/14/2018 fixes suggested by Alexander Bakst
6262
6363
1.1.6 - 4/24/2018 fixes suggested by building the Linux kernel and trying to harmonize with gllvm.
64-
4/28/2018 can handle thin archives, can sort manifest via the -s switch.
64+
4/28/2018 can handle thin archives, can sort bitcode input to llvm-{ar, link} and manifest via the -s switch.
6565
5/1/2018 can handle archives correctly (deal with multiple files with the same name in the archive).
6666
6767
"""

0 commit comments

Comments
 (0)