forked from OSchip/llvm-project
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
This commit is contained in:
parent
d37af68ef3
commit
c1fde4fa94
|
@ -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}"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue