diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-21 18:53:53 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-21 18:53:53 +0200 |
commit | 164633f41b62b2a3464dead89e26d261fd6add39 (patch) | |
tree | 7ecb8d64ba13653a60209d4d97bcb5fc1a8ba23e /tools/shared.py | |
parent | a6615bc683a49e60085a05e83a491c7d9af653f9 (diff) |
add all needed parts of archives
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/shared.py b/tools/shared.py index 08fc581b..f6727249 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -541,13 +541,19 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e print >> sys.stderr, 'Warning: Archive %s appears to be empty (recommendation: link an .so instead of .a)' % f else: Popen([LLVM_AR, 'x', f], stdout=PIPE).communicate() # if absolute paths, files will appear there. otherwise, in this directory + needed = False # We add or do not add the entire archive. We let llvm dead code eliminate parts we do not need, instead of + # doing intra-dependencies between archive contents for content in contents: new_symbols = Building.llvm_nm(content) # Link in the .o if it provides symbols, *or* this is a singleton archive (which is apparently an exception in gcc ld) if new_symbols.defs.intersection(unresolved_symbols) or len(files) == 1: + needed = True + if needed: + actual_files += contents + for content in contents: + new_symbols = Building.llvm_nm(content) resolved_symbols = resolved_symbols.union(new_symbols.defs) unresolved_symbols = unresolved_symbols.union(new_symbols.undefs.difference(resolved_symbols)).difference(new_symbols.defs) - actual_files.append(content) finally: os.chdir(cwd) try_delete(target) |