[compiler-rt] r236551 - [asan] Use a version script to limit the symbols exported by the ASan shared runtime library.
Jay Foad
jay.foad at gmail.com
Wed May 6 02:38:13 PDT 2015
Hi,
I'm consistently getting "syntax error in VERSION script" when I try
to build on PowerPC64:
$ ~/ninja -C ~/llvm-project/build/ all
ninja: Entering directory `/home/foad/llvm-project/build/'
[2/2] Linking CXX shared library
lib/clang/3.7.0/lib/linux/libclang_rt.asan-powerpc64le.so
FAILED: : && /usr/bin/g++ -fPIC -fPIC -fvisibility-inlines-hidden
-Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wno-comment -std=c++11 -Wall -std=c++11 -g
-Wl,-z,defs -m64 -fPIC -fno-builtin -fno-exceptions
-fomit-frame-pointer -funwind-tables -fno-stack-protector
-fvisibility=hidden -fno-function-sections -fno-lto -O3 -g
-Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti
-ftls-model=initial-exec
-Wl,--version-script,/home/foad/llvm-project/build/projects/compiler-rt/lib/asan/clang_rt.asan-dynamic-powerpc64le.vers
-shared -Wl,-soname,libclang_rt.asan-powerpc64le.so -o
lib/clang/3.7.0/lib/linux/libclang_rt.asan-powerpc64le.so
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_allocator.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_activation.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_debugging.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_fake_stack.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_flags.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_globals.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_interceptors.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_linux.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_mac.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_malloc_linux.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_malloc_mac.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_malloc_win.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_poisoning.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_posix.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_report.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_rtl.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_stack.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_stats.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_suppressions.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_thread.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_win.cc.o
projects/compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.powerpc64le.dir/asan_new_delete.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_cxx.powerpc64le.dir/ubsan_handlers_cxx.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_cxx.powerpc64le.dir/ubsan_type_hash.cc.o
projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.powerpc64le.dir/interception_linux.cc.o
projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.powerpc64le.dir/interception_mac.cc.o
projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.powerpc64le.dir/interception_win.cc.o
projects/compiler-rt/lib/interception/CMakeFiles/RTInterception.powerpc64le.dir/interception_type_test.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_allocator.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_common.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_deadlock_detector1.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_deadlock_detector2.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_flags.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_flag_parser.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_libc.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_libignore.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_linux.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_mac.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_persistent_allocator.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_platform_limits_linux.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_platform_limits_posix.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_posix.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_printf.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_procmaps_common.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_procmaps_freebsd.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_procmaps_linux.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_procmaps_mac.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_stackdepot.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_stacktrace.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_stacktrace_printer.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_suppressions.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_symbolizer.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_symbolizer_libbacktrace.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_symbolizer_mac.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_symbolizer_win.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_tls_get_addr.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_thread_registry.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.powerpc64le.dir/sanitizer_win.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_common_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_coverage_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_coverage_mapping_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_linux_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_posix_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_stacktrace_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_stoptheworld_linux_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_symbolizer_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_symbolizer_posix_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_symbolizer_process_libcdep.cc.o
projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.powerpc64le.dir/sanitizer_unwind_posix_libcdep.cc.o
projects/compiler-rt/lib/lsan/CMakeFiles/RTLSanCommon.powerpc64le.dir/lsan_common.cc.o
projects/compiler-rt/lib/lsan/CMakeFiles/RTLSanCommon.powerpc64le.dir/lsan_common_linux.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.powerpc64le.dir/ubsan_diag.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.powerpc64le.dir/ubsan_init.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.powerpc64le.dir/ubsan_flags.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.powerpc64le.dir/ubsan_handlers.cc.o
projects/compiler-rt/lib/ubsan/CMakeFiles/RTUbsan.powerpc64le.dir/ubsan_value.cc.o
-lc -ldl -lm -lpthread -lstdc++ -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld:/home/foad/llvm-project/build/projects/compiler-rt/lib/asan/clang_rt.asan-dynamic-powerpc64le.vers:1:
syntax error in VERSION script
collect2: error: ld returned 1 exit status
[2/2] Generating version list for clang_rt.asan-dynamic-powerpc64le
ninja: build stopped: subcommand failed.
However, if I run it again, it seems to work:
$ ~/ninja -C ~/llvm-project/build/ all
ninja: Entering directory `/home/foad/llvm-project/build/'
[1/1] Linking CXX shared library
lib/clang/3.7.0/lib/linux/libclang_rt.asan-powerpc64le.so
I've attached the version script.
Jay.
On 5 May 2015 at 23:51, Evgeniy Stepanov <eugeni.stepanov at gmail.com> wrote:
> Author: eugenis
> Date: Tue May 5 17:51:35 2015
> New Revision: 236551
>
> URL: http://llvm.org/viewvc/llvm-project?rev=236551&view=rev
> Log:
> [asan] Use a version script to limit the symbols exported by the ASan shared runtime library.
>
> Modified:
> compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake
> compiler-rt/trunk/lib/asan/CMakeLists.txt
> 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=236551&r1=236550&r2=236551&view=diff
> ==============================================================================
> --- compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake (original)
> +++ compiler-rt/trunk/cmake/Modules/SanitizerUtils.cmake Tue May 5 17:51:35 2015
> @@ -13,9 +13,13 @@ set(SANITIZER_LINT_SCRIPT
> # add_sanitizer_rt_symbols(<name> <files with extra symbols to export>)
> macro(add_sanitizer_rt_symbols name)
> set(stamp ${CMAKE_CURRENT_BINARY_DIR}/${name}.syms-stamp)
> + set(extra_args)
> + foreach(arg ${ARGN})
> + list(APPEND extra_args "--extra" ${arg})
> + endforeach()
> add_custom_command(OUTPUT ${stamp}
> COMMAND ${PYTHON_EXECUTABLE}
> - ${SANITIZER_GEN_DYNAMIC_LIST} $<TARGET_FILE:${name}> ${ARGN}
> + ${SANITIZER_GEN_DYNAMIC_LIST} ${extra_args} $<TARGET_FILE:${name}>
> > $<TARGET_FILE:${name}>.syms
> COMMAND ${CMAKE_COMMAND} -E touch ${stamp}
> DEPENDS ${name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARGN}
> @@ -44,6 +48,29 @@ macro(add_sanitizer_rt_symbols name)
> endif()
> endmacro()
>
> +macro(add_sanitizer_rt_version_list name)
> + set(vers ${CMAKE_CURRENT_BINARY_DIR}/${name}.vers)
> + parse_arguments(ARG "LIB;EXTRA" "" ${ARGN})
> + set(args)
> + foreach(arg ${ARG_EXTRA})
> + list(APPEND args "--extra" ${arg})
> + endforeach()
> + foreach(arg ${ARG_LIB})
> + list(APPEND args "$<TARGET_FILE:${arg}>")
> + endforeach()
> + add_custom_command(OUTPUT ${vers}
> + COMMAND ${PYTHON_EXECUTABLE}
> + ${SANITIZER_GEN_DYNAMIC_LIST} --version-list ${args}
> + > ${vers}
> + DEPENDS ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA} ${ARG_LIB}
> + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> + COMMENT "Generating version list for ${name}"
> + VERBATIM)
> +
> + add_custom_target(${name}-version-list ALL
> + DEPENDS ${vers})
> +endmacro()
> +
> # Add target to check code style for sanitizer runtimes.
> if(UNIX)
> add_custom_target(SanitizerLintCheck
>
> Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/CMakeLists.txt?rev=236551&r1=236550&r2=236551&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/asan/CMakeLists.txt Tue May 5 17:51:35 2015
> @@ -145,6 +145,15 @@ else()
> DEFS ${ASAN_COMMON_DEFINITIONS})
> add_dependencies(asan clang_rt.asan-preinit-${arch})
>
> + if (UNIX AND NOT ${arch} MATCHES "i386|i686")
> + add_sanitizer_rt_version_list(clang_rt.asan-dynamic-${arch}
> + LIB clang_rt.asan-${arch} clang_rt.asan_cxx-${arch}
> + EXTRA asan.syms.extra)
> + add_dependencies(asan clang_rt.asan-dynamic-${arch}-version-list)
> + list(APPEND ASAN_DYNAMIC_LINK_FLAGS
> + -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/clang_rt.asan-dynamic-${arch}.vers)
> + endif()
> +
> if (WIN32)
> set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}${COMPILER_RT_OS_SUFFIX})
> else()
> @@ -162,6 +171,7 @@ else()
> add_dependencies(asan clang_rt.asan-dynamic-${arch})
>
> if (UNIX AND NOT ${arch} MATCHES "i386|i686")
> + add_dependencies(clang_rt.asan-dynamic-${arch} clang_rt.asan-dynamic-${arch}-version-list)
> add_sanitizer_rt_symbols(clang_rt.asan_cxx-${arch})
> add_dependencies(asan clang_rt.asan_cxx-${arch}-symbols)
> add_sanitizer_rt_symbols(clang_rt.asan-${arch} asan.syms.extra)
>
> 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=236551&r1=236550&r2=236551&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 Tue May 5 17:51:35 2015
> @@ -14,6 +14,7 @@
> # gen_dynamic_list.py libclang_rt.*san*.a [ files ... ]
> #
> #===------------------------------------------------------------------------===#
> +import argparse
> import os
> import re
> import subprocess
> @@ -49,10 +50,17 @@ def get_global_functions(library):
> return functions
>
> def main(argv):
> + parser = argparse.ArgumentParser()
> + parser.add_argument('--version-list', action='store_true')
> + parser.add_argument('--extra', default=[], action='append')
> + parser.add_argument('libraries', default=[], nargs='+')
> + args = parser.parse_args()
> +
> result = []
>
> - library = argv[1]
> - all_functions = get_global_functions(library)
> + all_functions = []
> + for library in args.libraries:
> + all_functions.extend(get_global_functions(library))
> function_set = set(all_functions)
> for func in all_functions:
> # Export new/delete operators.
> @@ -74,15 +82,20 @@ def main(argv):
> result.append(func)
>
> # Additional exported functions from files.
> - for fname in argv[2:]:
> + for fname in args.extra:
> f = open(fname, 'r')
> 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(' ' + f + ';')
> + print(' ' + f.encode('utf-8') + ';')
> + if args.version_list:
> + print('local:')
> + print(' *;')
> print('};')
>
> if __name__ == '__main__':
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_rt.asan-dynamic-powerpc64le.vers
Type: application/octet-stream
Size: 43043 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150506/d80fbc56/attachment.obj>
More information about the llvm-commits
mailing list