[compiler-rt] r350980 - sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing to stdout.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 11 15:30:24 PST 2019
Author: pcc
Date: Fri Jan 11 15:30:24 2019
New Revision: 350980
URL: http://llvm.org/viewvc/llvm-project?rev=350980&view=rev
Log:
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
Modified:
compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
compiler-rt/trunk/lib/sanitizer_common/scripts/gen_dynamic_list.py
Modified: compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake?rev=350980&r1=350979&r2=350980&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake Fri Jan 11 15:30:24 2019
@@ -30,7 +30,7 @@ macro(add_sanitizer_rt_symbols name)
add_custom_command(OUTPUT ${stamp}
COMMAND ${PYTHON_EXECUTABLE}
${SANITIZER_GEN_DYNAMIC_LIST} ${extra_args} $<TARGET_FILE:${target_name}>
- > $<TARGET_FILE:${target_name}>.syms
+ -o $<TARGET_FILE:${target_name}>.syms
COMMAND ${CMAKE_COMMAND} -E touch ${stamp}
DEPENDS ${target_name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -80,7 +80,7 @@ macro(add_sanitizer_rt_version_list name
add_custom_command(OUTPUT ${vers}
COMMAND ${PYTHON_EXECUTABLE}
${SANITIZER_GEN_DYNAMIC_LIST} --version-list ${args}
- > ${vers}
+ -o ${vers}
DEPENDS ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA} ${ARG_LIBS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating version list for ${name}"
Modified: compiler-rt/trunk/lib/sanitizer_common/scripts/gen_dynamic_list.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/scripts/gen_dynamic_list.py?rev=350980&r1=350979&r2=350980&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/scripts/gen_dynamic_list.py (original)
+++ compiler-rt/trunk/lib/sanitizer_common/scripts/gen_dynamic_list.py Fri Jan 11 15:30:24 2019
@@ -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)
More information about the llvm-commits
mailing list