[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov added inline comments. Comment at: compiler-rt/lib/asan/CMakeLists.txt:198 +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} thetruestblue wrote: > Can you explain the motivation here? > > RTAsan_static object library isn't built on Apple & Apple ASAN doesn't > support static libraries. is there a reason why this was added to Apple that > I'm missing? > > I don't believe this actually builds anything on Apple platforms since no OS > is passed and in add_compiler_rt_runtime no libnames get set. > > Even the tests added are not-apple specific. As far as I remember it was because of the __asan_report_(load|store)n functions defined in asan_rtl_static.cpp. They are defined as weak so that we could link the binary without providing the implementation, which was later loaded from asan_rtl DSO. It is possible that we don't need this on Apple, but we will most likely need that on Windows. So if you are planning to make changes here you might have to revisit the 'NOT WIN32 AND NOT APPLE' statements to make sure we don't break the Windows build. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
thetruestblue added inline comments. Herald added a project: All. Comment at: compiler-rt/lib/asan/CMakeLists.txt:198 +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} Can you explain the motivation here? RTAsan_static object library isn't built on Apple & Apple ASAN doesn't support static libraries. is there a reason why this was added to Apple that I'm missing? I don't believe this actually builds anything on Apple platforms since no OS is passed and in add_compiler_rt_runtime no libnames get set. Even the tests added are not-apple specific. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG027ffb173a68: [ASan] Moved optimized callbacks into a separate library. (authored by kstoimenov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_static_rtl.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + list(APPEND ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 397613. kstoimenov added a comment. Removed driver part. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_static_rtl.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + list(APPEND ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG71b3bfde9cd2: [ASan] Moved optimized callbacks into a separate library. (authored by kstoimenov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_static_rtl.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + list(APPEND ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov requested review of this revision. kstoimenov added a comment. Added empty asan_static_rtl.cpp to work around the Windows build problem. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 396083. kstoimenov added a comment. Fixed a comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_static_rtl.cpp ---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + list(APPEND ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_static"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs.
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 396082. kstoimenov added a comment. s/set/append/ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_rtl.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + list(APPEND ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_static"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs.
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 396081. kstoimenov added a comment. Added asan_rtl_static.cpp empty file. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/asan_rtl_static.cpp compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/asan_rtl_static.cpp === --- /dev/null +++ compiler-rt/lib/asan/asan_rtl_static.cpp @@ -0,0 +1,15 @@ +//===-- asan_rtl.cpp --===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Main file of the ASan run-time library. +//===--===// + +// This file is empty for now. Main reason to have it is workaround for Windows +// build, which complains because no files are part of the asan_static lib. Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,16 @@ asan_new_delete.cpp ) +set(ASAN_STATIC_SOURCES + asan_rtl_static.cpp + ) + +if (NOT WIN32 AND NOT APPLE) + set(ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +144,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +191,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +230,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_static"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes
Re: [PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
I got a couple of options myself: adan_instrumentation asan_fast_path asan_mini What do you think? On Wed, Dec 22, 2021, 3:30 PM Evgenii Stepanov via Phabricator < revi...@reviews.llvm.org> wrote: > eugenis added a comment. > > I don't like the name "asan_dso". DSO means "dynamic shared object", and > this is the very opposite of that. Maybe "asan_private" or "asan_helper"? > > > Repository: > rG LLVM Github Monorepo > > CHANGES SINCE LAST ACTION > https://reviews.llvm.org/D116182/new/ > > https://reviews.llvm.org/D116182 > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGab3640aa0e83: [ASan] Moved optimized callbacks into a separate library. (authored by kstoimenov). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,12 @@ asan_new_delete.cpp ) +if (NOT WIN32 AND NOT APPLE) + set(ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +140,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +187,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +226,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_static"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov added a comment. Renamed it 'dso' to 'static'. I know it could be a little bit confusing. I was considering 'static_link' or 'always_static', but it seems too long. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 396031. kstoimenov marked an inline comment as done. kstoimenov added a comment. Remaned dso to static. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,12 @@ asan_new_delete.cpp ) +if (NOT WIN32 AND NOT APPLE) + set(ASAN_STATIC_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +140,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_static +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_STATIC_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -176,6 +187,14 @@ LINK_FLAGS ${WEAK_SYMBOL_LINK_FLAGS} DEFS ${ASAN_DYNAMIC_DEFINITIONS} PARENT_TARGET asan) + + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) else() # Build separate libraries for each target. @@ -207,6 +226,14 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_static +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_static +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the static runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_static"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
eugenis added a comment. Maybe `asan_client` (like `stats_client` above), or `asan_inline`? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
eugenis added a comment. I don't like the name "asan_dso". DSO means "dynamic shared object", and this is the very opposite of that. Maybe "asan_private" or "asan_helper"? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
vitalybuka accepted this revision. vitalybuka added a comment. This revision is now accepted and ready to land. I suspect Driver part is going to be reverted a couple of time. Maybe extract it into a separate patch? Comment at: compiler-rt/lib/asan/CMakeLists.txt:167 if(APPLE) add_weak_symbols("asan" WEAK_SYMBOL_LINK_FLAGS) why no changes for APPLE? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov updated this revision to Diff 395914. kstoimenov added a comment. Updated a comment. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116182/new/ https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,12 @@ asan_new_delete.cpp ) +if (NOT WIN32 AND NOT APPLE) + set(ASAN_DSO_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +140,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_dso +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_DSO_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -207,6 +218,13 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_dso +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_dso +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // Always link the DSO part of the runtime regardless of DSO or executable. + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_dso"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D116182: [ASan] Moved optimized callbacks into a separate library.
kstoimenov created this revision. Herald added a subscriber: mgorny. kstoimenov requested review of this revision. Herald added projects: clang, Sanitizers. Herald added subscribers: Sanitizers, cfe-commits. This will allow linking in the callbacks directly instead of using PLT. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D116182 Files: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/sanitizer-ld.c compiler-rt/lib/asan/CMakeLists.txt compiler-rt/lib/asan/tests/CMakeLists.txt Index: compiler-rt/lib/asan/tests/CMakeLists.txt === --- compiler-rt/lib/asan/tests/CMakeLists.txt +++ compiler-rt/lib/asan/tests/CMakeLists.txt @@ -261,6 +261,7 @@ set(ASAN_TEST_RUNTIME_OBJECTS $ $ +$ $ $ $ @@ -286,6 +287,7 @@ # Test w/o ASan instrumentation. Link it with ASan statically. add_executable(AsanNoinstTest # FIXME: .arch? $ + $ $ $ $ Index: compiler-rt/lib/asan/CMakeLists.txt === --- compiler-rt/lib/asan/CMakeLists.txt +++ compiler-rt/lib/asan/CMakeLists.txt @@ -34,7 +34,6 @@ if (NOT WIN32 AND NOT APPLE) list(APPEND ASAN_SOURCES -asan_rtl_x86_64.S asan_interceptors_vfork.S ) endif() @@ -43,6 +42,12 @@ asan_new_delete.cpp ) +if (NOT WIN32 AND NOT APPLE) + set(ASAN_DSO_SOURCES +asan_rtl_x86_64.S + ) +endif() + set(ASAN_PREINIT_SOURCES asan_preinit.cpp ) @@ -135,6 +140,12 @@ ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} DEFS ${ASAN_COMMON_DEFINITIONS}) + add_compiler_rt_object_libraries(RTAsan_dso +ARCHS ${ASAN_SUPPORTED_ARCH} +SOURCES ${ASAN_DSO_SOURCES} +ADDITIONAL_HEADERS ${ASAN_HEADERS} +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} @@ -207,6 +218,13 @@ DEFS ${ASAN_COMMON_DEFINITIONS} PARENT_TARGET asan) + add_compiler_rt_runtime(clang_rt.asan_dso +STATIC +ARCHS ${ASAN_SUPPORTED_ARCH} +OBJECT_LIBS RTAsan_dso +CFLAGS ${ASAN_CFLAGS} +DEFS ${ASAN_COMMON_DEFINITIONS} +PARENT_TARGET asan) add_compiler_rt_runtime(clang_rt.asan-preinit STATIC ARCHS ${ASAN_SUPPORTED_ARCH} Index: clang/test/Driver/sanitizer-ld.c === --- clang/test/Driver/sanitizer-ld.c +++ clang/test/Driver/sanitizer-ld.c @@ -22,7 +22,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-NO-LINK-RUNTIME-LINUX %s // -// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan +// CHECK-ASAN-NO-LINK-RUNTIME-LINUX-NOT: libclang_rt.asan-x86_64 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux -fuse-ld=ld -fsanitize=address -shared-libsan \ Index: clang/lib/Driver/ToolChains/CommonArgs.cpp === --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -826,6 +826,11 @@ if (SanArgs.needsStatsRt() && SanArgs.linkRuntimes()) StaticRuntimes.push_back("stats_client"); + // ZXCV + if (SanArgs.needsAsanRt()) { +HelperStaticRuntimes.push_back("asan_dso"); + } + // Collect static runtimes. if (Args.hasArg(options::OPT_shared)) { // Don't link static runtimes into DSOs. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits