aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2019-01-11 23:30:24 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2019-01-11 23:30:24 +0000
commitc1fde4fa943fd03a3d40bc5d32b9e0045fd29208 (patch)
tree5c1e01d21d17015343e1e66ccf4682cd9b499f78 /compiler-rt/lib/sanitizer_common
parentgn build: Add a stage2 toolchain for Android. (diff)
downloadllvm-project-c1fde4fa943fd03a3d40bc5d32b9e0045fd29208.tar.gz
llvm-project-c1fde4fa943fd03a3d40bc5d32b9e0045fd29208.tar.bz2
llvm-project-c1fde4fa943fd03a3d40bc5d32b9e0045fd29208.zip
sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing to stdout.
This makes the script a little more gn friendly; gn does not support redirecting the output of a script. Differential Revision: https://reviews.llvm.org/D56579 llvm-svn: 350980
Diffstat (limited to 'compiler-rt/lib/sanitizer_common')
-rwxr-xr-xcompiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py b/compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py
index 25632ed77b94..4a9c7af95548 100755
--- a/compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py
+++ b/compiler-rt/lib/sanitizer_common/scripts/gen_dynamic_list.py
@@ -14,6 +14,7 @@
# gen_dynamic_list.py libclang_rt.*san*.a [ files ... ]
#
#===------------------------------------------------------------------------===#
+from __future__ import print_function
import argparse
import os
import re
@@ -84,6 +85,7 @@ def main(argv):
parser.add_argument('--version-list', action='store_true')
parser.add_argument('--extra', default=[], action='append')
parser.add_argument('libraries', default=[], nargs='+')
+ parser.add_argument('-o', '--output', required=True)
args = parser.parse_args()
result = []
@@ -117,16 +119,17 @@ def main(argv):
for line in f:
result.append(line.rstrip())
# Print the resulting list in the format recognized by ld.
- print('{')
- if args.version_list:
- print('global:')
- result.sort()
- for f in result:
- print(u' %s;' % f)
- if args.version_list:
- print('local:')
- print(' *;')
- print('};')
+ with open(args.output, 'w') as f:
+ print('{', file=f)
+ if args.version_list:
+ print('global:', file=f)
+ result.sort()
+ for sym in result:
+ print(u' %s;' % sym, file=f)
+ if args.version_list:
+ print('local:', file=f)
+ print(' *;', file=f)
+ print('};', file=f)
if __name__ == '__main__':
main(sys.argv)