<div dir="ltr">Hi Douglas (apologies for referring to you by your last name), I'm attempting a reproduction myself locally. I'd be happy to revert, but it would be great if we have some reproduction instructions.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 29, 2017 at 9:03 AM Dean Michael Berris <<a href="mailto:dberris@google.com">dberris@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Yung -- I'm not sure how this change might cause this to break, but can you provide reproduction instructions?</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 29, 2017 at 6:51 AM Yung, Douglas <<a href="mailto:douglas.yung@sony.com" target="_blank">douglas.yung@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dean,<br>
<br>
Your change seems to be causing linking failures on our internal linux bot with tons of errors like this:<br>
<br>
FAILED: cd /home/siadmin/jenkins/w/opensource/opensource_build/build/projects/compiler-rt/lib/xray/tests/unit && /home/siadmin/jenkins/w/opensource/opensource_build/build/./bin/clang TEST_OBJECTS.fdr_logging_test.cc.x86_64.o TEST_OBJECTS.xray_unit_test_main.cc.x86_64.o TEST_OBJECTS.gtest-all.cc.x86_64.o -o /home/siadmin/jenkins/w/opensource/opensource_build/build/projects/compiler-rt/lib/xray/tests/unit/./XRayFDRLoggingTest-x86_64-Test -fuse-ld=gold -Wl,-allow-shlib-undefined -fxray-instrument -lstdc++ -lm -lpthread -lpthread -ldl -lrt -m64<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::getGlobalFd()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::GlobalOptions'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::RecusionGuard'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::basicLoggingInit(unsigned long, unsigned long, void*, unsigned long)'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::basicLoggingFlush()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::getThreadLocalData()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::basicLoggingFinalize()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): multiple definition of '__xray::basicLogDynamicInitializer()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o): previous definition here<br>
...<br>
(many more lines of similar errors)<br>
...<br>
/usr/bin/ld.gold: error: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_utils.cc.o): multiple definition of '__xray::getLogFD()'<br>
/usr/bin/ld.gold: /home/siadmin/jenkins/w/opensource/opensource_build/build/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_utils.cc.o): previous definition here<br>
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)<br>
ninja: build stopped: subcommand failed.<br>
<br>
<br>
This bot simply builds the upstream sources (I would link to the our upstream bot, but they all seem to be having issues at the moment) on linux. Can you please look into this so that we can get the compiler-rt build working again? Thanks!<br>
<br>
Douglas Yung<br>
<br>
> -----Original Message-----<br>
> From: llvm-commits [mailto:<a href="mailto:llvm-commits-bounces@lists.llvm.org" target="_blank">llvm-commits-bounces@lists.llvm.org</a>] On Behalf Of<br>
> Dean Michael Berris via llvm-commits<br>
> Sent: Tuesday, November 28, 2017 3:49<br>
> To: <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> Subject: [compiler-rt] r319165 - [XRay][compiler-rt][Darwin] Minimal XRay<br>
> build support in Darwin<br>
><br>
> Author: dberris<br>
> Date: Tue Nov 28 03:49:22 2017<br>
> New Revision: 319165<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=319165&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=319165&view=rev</a><br>
> Log:<br>
> [XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin<br>
><br>
> This change is the first in a series of changes to get the XRay runtime<br>
> building on macOS. This first allows us to build the minimal parts of XRay to<br>
> get us started on supporting macOS development. These include:<br>
><br>
>   - CMake changes to allow targeting x86_64 initially.<br>
>   - Allowing for building the initialisation routines without<br>
>     `.preinit_array` support.<br>
>   - Use __sanitizer::SleepForMillis() to work around the lack of<br>
>     clock_nanosleep on macOS.<br>
>   - Deprecate the xray_fdr_log_grace_period_us flag, and introduce<br>
>     the xray_fdr_log_grace_period_ms flag instead, to use<br>
>     milliseconds across platforms.<br>
><br>
> Reviewers: kubamracek<br>
><br>
> Subscribers: llvm-commits, krytarowski, nglevin, mgorny<br>
><br>
> Differential Review: <a href="https://reviews.llvm.org/D39114" rel="noreferrer" target="_blank">https://reviews.llvm.org/D39114</a><br>
><br>
> Added:<br>
>     compiler-rt/trunk/lib/xray/weak_symbols.txt<br>
> Modified:<br>
>     compiler-rt/trunk/cmake/config-ix.cmake<br>
>     compiler-rt/trunk/lib/xray/CMakeLists.txt<br>
>     compiler-rt/trunk/lib/xray/xray_fdr_logging.cc<br>
>     compiler-rt/trunk/lib/xray/xray_flags.inc<br>
>     compiler-rt/trunk/lib/xray/xray_init.cc<br>
>     compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S<br>
><br>
> Modified: compiler-rt/trunk/cmake/config-ix.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-</a><br>
> ix.cmake?rev=319165&r1=319164&r2=319165&view=diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/cmake/config-ix.cmake (original)<br>
> +++ compiler-rt/trunk/cmake/config-ix.cmake Tue Nov 28 03:49:22 2017<br>
> @@ -211,7 +211,11 @@ set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86}<br>
> set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS64})<br>
> set(ALL_ESAN_SUPPORTED_ARCH ${X86_64} ${MIPS64})  set(ALL_SCUDO_SUPPORTED_ARCH<br>
> ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64})<br>
> +if(APPLE)<br>
> +set(ALL_XRAY_SUPPORTED_ARCH ${X86_64})<br>
> +else()<br>
>  set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64}<br>
> powerpc64le)<br>
> +endif()<br>
><br>
>  if(APPLE)<br>
>    include(CompilerRTDarwinUtils)<br>
> @@ -256,6 +260,7 @@ if(APPLE)<br>
>    set(SANITIZER_COMMON_SUPPORTED_OS osx)<br>
>    set(PROFILE_SUPPORTED_OS osx)<br>
>    set(TSAN_SUPPORTED_OS osx)<br>
> +  set(XRAY_SUPPORTED_OS osx)<br>
>    if(NOT SANITIZER_MIN_OSX_VERSION)<br>
>      string(REGEX MATCH "-mmacosx-version-min=([.0-9]+)"<br>
>             MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}") @@ -412,12 +417,12<br>
> @@ if(APPLE)<br>
>    list_intersect(SCUDO_SUPPORTED_ARCH<br>
>      ALL_SCUDO_SUPPORTED_ARCH<br>
>      SANITIZER_COMMON_SUPPORTED_ARCH)<br>
> -  list_intersect(XRAY_SUPPORTED_ARCH<br>
> -    ALL_XRAY_SUPPORTED_ARCH<br>
> -    SANITIZER_COMMON_SUPPORTED_ARCH)<br>
>    list_intersect(FUZZER_SUPPORTED_ARCH<br>
>      ALL_FUZZER_SUPPORTED_ARCH<br>
>      ALL_SANITIZER_COMMON_SUPPORTED_ARCH)<br>
> +  list_intersect(XRAY_SUPPORTED_ARCH<br>
> +    ALL_XRAY_SUPPORTED_ARCH<br>
> +    SANITIZER_COMMON_SUPPORTED_ARCH)<br>
><br>
>  else()<br>
>    # Architectures supported by compiler-rt libraries.<br>
> @@ -580,7 +585,7 @@ else()<br>
>  endif()<br>
><br>
>  if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND<br>
> -    OS_NAME MATCHES "Linux")<br>
> +    OS_NAME MATCHES "Darwin|Linux")<br>
>    set(COMPILER_RT_HAS_XRAY TRUE)<br>
>  else()<br>
>    set(COMPILER_RT_HAS_XRAY FALSE)<br>
><br>
> Modified: compiler-rt/trunk/lib/xray/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/CMakeLists.txt?rev=319165&r1=319164&r2=319165&view=diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/CMakeLists.txt (original)<br>
> +++ compiler-rt/trunk/lib/xray/CMakeLists.txt Tue Nov 28 03:49:22 2017<br>
> @@ -65,19 +65,53 @@ append_list_if(<br>
>  append_list_if(<br>
>    COMPILER_RT_BUILD_XRAY_NO_PREINIT XRAY_NO_PREINIT XRAY_COMMON_DEFINITIONS)<br>
><br>
> -add_compiler_rt_object_libraries(RTXray<br>
> -  ARCHS ${XRAY_SUPPORTED_ARCH}<br>
> -  SOURCES ${XRAY_SOURCES} CFLAGS ${XRAY_CFLAGS}<br>
> -  DEFS ${XRAY_COMMON_DEFINITIONS})<br>
> -<br>
>  add_compiler_rt_component(xray)<br>
><br>
>  set(XRAY_COMMON_RUNTIME_OBJECT_LIBS<br>
> +    RTXray<br>
>      RTSanitizerCommon<br>
>      RTSanitizerCommonLibc)<br>
><br>
> +if (APPLE)<br>
> +  set(XRAY_LINK_LIBS ${SANITIZER_COMMON_LINK_LIBS})<br>
> +  set(XRAY_ASM_SOURCES xray_trampoline_x86_64.S)<br>
> +<br>
> +  if (${CMAKE_GENERATOR} STREQUAL "Xcode")<br>
> +    enable_language(ASM)<br>
> +  else()<br>
> +    set_source_files_properties(${XRAY_ASM_SOURCES} PROPERTIES LANGUAGE<br>
> + C)<br>
> +  endif()<br>
> +<br>
> +  add_weak_symbols("sanitizer_common" WEAK_SYMBOL_LINK_FLAGS)<br>
> + add_weak_symbols("xray" WEAK_SYMBOL_LINK_FLAGS)<br>
> +<br>
> +  add_compiler_rt_object_libraries(RTXray<br>
> +    OS ${XRAY_SUPPORTED_OS}<br>
> +    ARCHS ${XRAY_SUPPORTED_ARCH}<br>
> +    SOURCES ${x86_64_SOURCES}<br>
> +    CFLAGS ${XRAY_CFLAGS}<br>
> +    DEFS ${XRAY_COMMON_DEFINITIONS})<br>
> +<br>
> +  # We only support running on osx for now.<br>
> +  add_compiler_rt_runtime(clang_rt.xray<br>
> +    STATIC<br>
> +    OS ${XRAY_SUPPORTED_OS}<br>
> +    ARCHS ${XRAY_SUPPORTED_ARCH}<br>
> +    OBJECT_LIBS RTXray<br>
> +                RTSanitizerCommon<br>
> +                RTSanitizerCommonLibc<br>
> +    CFLAGS ${XRAY_CFLAGS}<br>
> +    DEFS ${XRAY_COMMON_DEFINITIONS}<br>
> +    LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}<br>
> +    LINK_LIBS ${XRAY_LINK_LIBS}<br>
> +    PARENT_TARGET xray)<br>
> +else()<br>
>  foreach(arch ${XRAY_SUPPORTED_ARCH})<br>
>    if(CAN_TARGET_${arch})<br>
> +    add_compiler_rt_object_libraries(RTXray<br>
> +      ARCHS ${XRAY_SUPPORTED_ARCH}<br>
> +      SOURCES ${XRAY_SOURCES} CFLAGS ${XRAY_CFLAGS}<br>
> +      DEFS ${XRAY_COMMON_DEFINITIONS})<br>
>      add_compiler_rt_runtime(clang_rt.xray<br>
>       STATIC<br>
>       ARCHS ${arch}<br>
> @@ -88,6 +122,7 @@ foreach(arch ${XRAY_SUPPORTED_ARCH})<br>
>       PARENT_TARGET xray)<br>
>    endif()<br>
>  endforeach()<br>
> +endif()<br>
><br>
>  if(COMPILER_RT_INCLUDE_TESTS)<br>
>    add_subdirectory(tests)<br>
><br>
> Added: compiler-rt/trunk/lib/xray/weak_symbols.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/weak_symbols.txt?rev=319165&view=auto<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/weak_symbols.txt (added)<br>
> +++ compiler-rt/trunk/lib/xray/weak_symbols.txt Tue Nov 28 03:49:22 2017<br>
> @@ -0,0 +1,4 @@<br>
> +___start_xray_fn_idx<br>
> +___start_xray_instr_map<br>
> +___stop_xray_fn_idx<br>
> +___stop_xray_instr_map<br>
><br>
> Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/xray_fdr_logging.cc?rev=319165&r1=319164&r2=319165&view=diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)<br>
> +++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Tue Nov 28 03:49:22<br>
> +++ 2017<br>
> @@ -70,15 +70,9 @@ XRayLogFlushStatus fdrLoggingFlush() XRA<br>
>      return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;<br>
>    }<br>
><br>
> -  // We wait a number of microseconds to allow threads to see that we've<br>
> +  // We wait a number of milliseconds to allow threads to see that<br>
> + we've<br>
>    // finalised before attempting to flush the log.<br>
> -  struct timespec TS;<br>
> -  TS.tv_sec = flags()->xray_fdr_log_grace_period_us / 1000000;<br>
> -  TS.tv_nsec = (flags()->xray_fdr_log_grace_period_us % 1000000) * 1000;<br>
> -  struct timespec Rem;<br>
> -  while (clock_nanosleep(CLOCK_REALTIME, 0, &TS, &Rem) &&<br>
> -         (Rem.tv_sec != 0 || Rem.tv_nsec != 0))<br>
> -    TS = Rem;<br>
> +  __sanitizer::SleepForMillis(flags()->xray_fdr_log_grace_period_ms);<br>
><br>
>    // We write out the file in the following format:<br>
>    //<br>
> @@ -374,9 +368,7 @@ static auto UNUSED Unused = [] {<br>
>    using namespace __xray;<br>
>    if (flags()->xray_fdr_log) {<br>
>      XRayLogImpl Impl{<br>
> -        fdrLoggingInit,<br>
> -        fdrLoggingFinalize,<br>
> -        fdrLoggingHandleArg0,<br>
> +        fdrLoggingInit, fdrLoggingFinalize, fdrLoggingHandleArg0,<br>
>          fdrLoggingFlush,<br>
>      };<br>
>      __xray_set_log_impl(Impl);<br>
><br>
> Modified: compiler-rt/trunk/lib/xray/xray_flags.inc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/xray_flags.inc?rev=319165&r1=319164&r2=319165&view=diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/xray_flags.inc (original)<br>
> +++ compiler-rt/trunk/lib/xray/xray_flags.inc Tue Nov 28 03:49:22 2017<br>
> @@ -37,7 +37,9 @@ XRAY_FLAG(bool, xray_fdr_log, false,  XRAY_FLAG(int,<br>
> xray_fdr_log_func_duration_threshold_us, 5,<br>
>            "FDR logging will try to skip functions that execute for fewer "<br>
>            "microseconds than this threshold.") -XRAY_FLAG(int,<br>
> xray_fdr_log_grace_period_us, 100000,<br>
> +XRAY_FLAG(int, xray_fdr_log_grace_period_us, 0,<br>
> +          "DEPRECATED: use xray_fdr_log_grace_period_ms instead.")<br>
> +XRAY_FLAG(int, xray_fdr_log_grace_period_ms, 100,<br>
>            "FDR logging will wait this much time in microseconds before "<br>
>            "actually flushing the log; this gives a chance for threads to "<br>
>            "notice that the log has been finalized and clean up.")<br>
><br>
> Modified: compiler-rt/trunk/lib/xray/xray_init.cc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/xray_init.cc?rev=319165&r1=319164&r2=319165&view=diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/xray_init.cc (original)<br>
> +++ compiler-rt/trunk/lib/xray/xray_init.cc Tue Nov 28 03:49:22 2017<br>
> @@ -88,7 +88,8 @@ void __xray_init() XRAY_NEVER_INSTRUMENT  #endif  }<br>
><br>
> -#ifndef XRAY_NO_PREINIT<br>
> +// Only add the preinit array initialization if the sanitizers can.<br>
> +#if !defined(XRAY_NO_PREINIT) && SANITIZER_CAN_USE_PREINIT_ARRAY<br>
>  __attribute__((section(".preinit_array"),<br>
>                 used)) void (*__local_xray_preinit)(void) = __xray_init;<br>
> #endif<br>
><br>
> Modified: compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-</a><br>
> rt/trunk/lib/xray/xray_trampoline_x86_64.S?rev=319165&r1=319164&r2=319165&view<br>
> =diff<br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S (original)<br>
> +++ compiler-rt/trunk/lib/xray/xray_trampoline_x86_64.S Tue Nov 28<br>
> +++ 03:49:22 2017<br>
> @@ -14,10 +14,13 @@<br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
>  #include "../builtins/assembly.h"<br>
> +#include "../sanitizer_common/sanitizer_asm.h"<br>
> +<br>
> +<br>
><br>
>  .macro SAVE_REGISTERS<br>
>       subq $192, %rsp<br>
> -     .cfi_def_cfa_offset 200<br>
> +     CFI_DEF_CFA_OFFSET(200)<br>
>       // At this point, the stack pointer should be aligned to an 8-byte<br>
> boundary,<br>
>       // because any call instructions that come after this will add another 8<br>
>       // bytes and therefore align it to 16-bytes.<br>
> @@ -57,7 +60,7 @@<br>
>       movq    8(%rsp), %r8<br>
>       movq    0(%rsp), %r9<br>
>       addq    $192, %rsp<br>
> -     .cfi_def_cfa_offset 8<br>
> +     CFI_DEF_CFA_OFFSET(8)<br>
>  .endm<br>
><br>
>  .macro ALIGNED_CALL_RAX<br>
> @@ -75,21 +78,25 @@<br>
>  .endm<br>
><br>
>       .text<br>
> +#if !defined(__APPLE__)<br>
> +     .section .text<br>
> +#else<br>
> +     .section __TEXT,__text<br>
> +#endif<br>
>       .file "xray_trampoline_x86.S"<br>
><br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
> -     .globl __xray_FunctionEntry<br>
> +     .globl ASM_TSAN_SYMBOL(__xray_FunctionEntry)<br>
>       .align 16, 0x90<br>
> -     .type __xray_FunctionEntry,@function<br>
> -<br>
> -__xray_FunctionEntry:<br>
> -     .cfi_startproc<br>
> +     ASM_TYPE_FUNCTION(__xray_FunctionEntry)<br>
> +ASM_TSAN_SYMBOL(__xray_FunctionEntry):<br>
> +     CFI_STARTPROC<br>
>       SAVE_REGISTERS<br>
><br>
>       // This load has to be atomic, it's concurrent with __xray_patch().<br>
>       // On x86/amd64, a simple (type-aligned) MOV instruction is enough.<br>
> -     movq    _ZN6__xray19XRayPatchedFunctionE(%rip), %rax<br>
> +     movq    ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax<br>
>       testq   %rax, %rax<br>
>       je      .Ltmp0<br>
><br>
> @@ -101,28 +108,27 @@ __xray_FunctionEntry:<br>
>  .Ltmp0:<br>
>       RESTORE_REGISTERS<br>
>       retq<br>
> -.Ltmp1:<br>
> -     .size __xray_FunctionEntry, .Ltmp1-__xray_FunctionEntry<br>
> -     .cfi_endproc<br>
> +     ASM_SIZE(__xray_FunctionEntry)<br>
> +     CFI_ENDPROC<br>
><br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
> -     .globl __xray_FunctionExit<br>
> +     .globl ASM_TSAN_SYMBOL(__xray_FunctionExit)<br>
>       .align 16, 0x90<br>
> -     .type __xray_FunctionExit,@function<br>
> -__xray_FunctionExit:<br>
> -     .cfi_startproc<br>
> +     ASM_TYPE_FUNCTION(__xray_FunctionExit)<br>
> +ASM_TSAN_SYMBOL(__xray_FunctionExit):<br>
> +     CFI_STARTPROC<br>
>       // Save the important registers first. Since we're assuming that this<br>
>       // function is only jumped into, we only preserve the registers for<br>
>       // returning.<br>
>       subq    $56, %rsp<br>
> -     .cfi_def_cfa_offset 64<br>
> +     CFI_DEF_CFA_OFFSET(64)<br>
>       movq  %rbp, 48(%rsp)<br>
>       movupd  %xmm0, 32(%rsp)<br>
>       movupd  %xmm1, 16(%rsp)<br>
>       movq    %rax, 8(%rsp)<br>
>       movq    %rdx, 0(%rsp)<br>
> -     movq    _ZN6__xray19XRayPatchedFunctionE(%rip), %rax<br>
> +     movq    ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax<br>
>       testq %rax,%rax<br>
>       je      .Ltmp2<br>
><br>
> @@ -138,22 +144,21 @@ __xray_FunctionExit:<br>
>       movq    8(%rsp), %rax<br>
>       movq    0(%rsp), %rdx<br>
>       addq    $56, %rsp<br>
> -     .cfi_def_cfa_offset 8<br>
> +     CFI_DEF_CFA_OFFSET(8)<br>
>       retq<br>
> -.Ltmp3:<br>
> -     .size __xray_FunctionExit, .Ltmp3-__xray_FunctionExit<br>
> -     .cfi_endproc<br>
> +     ASM_SIZE(__xray_FunctionExit)<br>
> +     CFI_ENDPROC<br>
><br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
> -     .global __xray_FunctionTailExit<br>
> +     .globl ASM_TSAN_SYMBOL(__xray_FunctionTailExit)<br>
>       .align 16, 0x90<br>
> -     .type __xray_FunctionTailExit,@function<br>
> -__xray_FunctionTailExit:<br>
> -     .cfi_startproc<br>
> +     ASM_TYPE_FUNCTION(__xray_FunctionTailExit)<br>
> +ASM_TSAN_SYMBOL(__xray_FunctionTailExit):<br>
> +     CFI_STARTPROC<br>
>       SAVE_REGISTERS<br>
><br>
> -     movq    _ZN6__xray19XRayPatchedFunctionE(%rip), %rax<br>
> +     movq    ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax<br>
>       testq %rax,%rax<br>
>       je      .Ltmp4<br>
><br>
> @@ -165,26 +170,25 @@ __xray_FunctionTailExit:<br>
>  .Ltmp4:<br>
>       RESTORE_REGISTERS<br>
>       retq<br>
> -.Ltmp5:<br>
> -     .size __xray_FunctionTailExit, .Ltmp5-__xray_FunctionTailExit<br>
> -     .cfi_endproc<br>
> +     ASM_SIZE(__xray_FunctionTailExit)<br>
> +     CFI_ENDPROC<br>
><br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
> -     .globl __xray_ArgLoggerEntry<br>
> +     .globl ASM_TSAN_SYMBOL(__xray_ArgLoggerEntry)<br>
>       .align 16, 0x90<br>
> -     .type __xray_ArgLoggerEntry,@function<br>
> -__xray_ArgLoggerEntry:<br>
> -     .cfi_startproc<br>
> +     ASM_TYPE_FUNCTION(__xray_ArgLoggerEntry)<br>
> +ASM_TSAN_SYMBOL(__xray_ArgLoggerEntry):<br>
> +     CFI_STARTPROC<br>
>       SAVE_REGISTERS<br>
><br>
>       // Again, these function pointer loads must be atomic; MOV is fine.<br>
> -     movq    _ZN6__xray13XRayArgLoggerE(%rip), %rax<br>
> +     movq    ASM_TSAN_SYMBOL(_ZN6__xray13XRayArgLoggerE)(%rip), %rax<br>
>       testq   %rax, %rax<br>
>       jne     .Larg1entryLog<br>
><br>
>       // If [arg1 logging handler] not set, defer to no-arg logging.<br>
> -     movq    _ZN6__xray19XRayPatchedFunctionE(%rip), %rax<br>
> +     movq    ASM_TSAN_SYMBOL(_ZN6__xray19XRayPatchedFunctionE)(%rip), %rax<br>
>       testq   %rax, %rax<br>
>       je      .Larg1entryFail<br>
><br>
> @@ -203,24 +207,22 @@ __xray_ArgLoggerEntry:<br>
>  .Larg1entryFail:<br>
>       RESTORE_REGISTERS<br>
>       retq<br>
> -<br>
> -.Larg1entryEnd:<br>
> -     .size __xray_ArgLoggerEntry, .Larg1entryEnd-__xray_ArgLoggerEntry<br>
> -     .cfi_endproc<br>
> +     ASM_SIZE(__xray_ArgLoggerEntry)<br>
> +     CFI_ENDPROC<br>
><br>
>  //===----------------------------------------------------------------------<br>
> ===//<br>
><br>
> -     .global __xray_CustomEvent<br>
> +     .global ASM_TSAN_SYMBOL(__xray_CustomEvent)<br>
>       .align 16, 0x90<br>
> -     .type __xray_CustomEvent,@function<br>
> -__xray_CustomEvent:<br>
> -  .cfi_startproc<br>
> +     ASM_TYPE_FUNCTION(__xray_CustomEvent)<br>
> +ASM_TSAN_SYMBOL(__xray_CustomEvent):<br>
> +     CFI_STARTPROC<br>
>       SAVE_REGISTERS<br>
><br>
>       // We take two arguments to this trampoline, which should be in rdi<br>
>       and rsi<br>
>       // already. We also make sure that we stash %rax because we use that<br>
> register<br>
>       // to call the logging handler.<br>
> -     movq _ZN6__xray22XRayPatchedCustomEventE(%rip), %rax<br>
> +     movq ASM_TSAN_SYMBOL(_ZN6__xray22XRayPatchedCustomEventE)(%rip), %rax<br>
>       testq %rax,%rax<br>
>       je .LcustomEventCleanup<br>
><br>
> @@ -229,9 +231,7 @@ __xray_CustomEvent:<br>
>  .LcustomEventCleanup:<br>
>       RESTORE_REGISTERS<br>
>       retq<br>
> -<br>
> -.Ltmp8:<br>
> -     .size __xray_CustomEvent, .Ltmp8-__xray_CustomEvent<br>
> -     .cfi_endproc<br>
> +     ASM_SIZE(__xray_CustomEvent)<br>
> +     CFI_ENDPROC<br>
><br>
>  NO_EXEC_STACK_DIRECTIVE<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></blockquote></div>