[PATCH] D56579: sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of writing to stdout.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 11 15:34:19 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT350980: sanitizer_common: Change gen_dynamic_list.py to take a -o argument instead of… (authored by pcc, committed by ).
Herald added a subscriber: Sanitizers.

Changed prior to commit:
  https://reviews.llvm.org/D56579?vs=181211&id=181382#toc

Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56579/new/

https://reviews.llvm.org/D56579

Files:
  cmake/Modules/SanitizerUtils.cmake
  lib/sanitizer_common/scripts/gen_dynamic_list.py


Index: lib/sanitizer_common/scripts/gen_dynamic_list.py
===================================================================
--- lib/sanitizer_common/scripts/gen_dynamic_list.py
+++ 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 @@
   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 @@
     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)
Index: cmake/Modules/SanitizerUtils.cmake
===================================================================
--- cmake/Modules/SanitizerUtils.cmake
+++ cmake/Modules/SanitizerUtils.cmake
@@ -30,7 +30,7 @@
     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 @@
   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}"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56579.181382.patch
Type: text/x-patch
Size: 2466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190111/c1641936/attachment.bin>


More information about the llvm-commits mailing list