================ @@ -0,0 +1,62 @@ +//===-- xray_init.cpp -------------------------------------------*- C++ -*-===// +// +// 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 XRay, a dynamic runtime instrumentation system. +// +// XRay initialisation logic for DSOs. +//===----------------------------------------------------------------------===// + +#include "sanitizer_common/sanitizer_atomic.h" +#include "xray_defs.h" +#include "xray_flags.h" +#include "xray_interface_internal.h" + +using namespace __sanitizer; + +extern "C" { +extern const XRaySledEntry __start_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRaySledEntry __stop_xray_instr_map[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __start_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); +extern const XRayFunctionSledIndex __stop_xray_fn_idx[] __attribute__((weak)) +__attribute__((visibility("hidden"))); ---------------- androm3da wrote:
These symbols are declared `weak` - so can you help me understand how this would behave in different cases like `RTLD_GLOBAL` vs `RTLD_LOCAL`? How would these be resolved? Is the behavior acceptable in both cases? Say for example I have explicitly linked against liba, libb->libc - all built with `-fxray-enable-shared` and IIRC the loader will load all three libraries with `RTLD_GLOBAL`. Some time later, my program loads libd (built with `-fxray-enable-shared`) via an explicit `dlopen(..., RTLD_LOCAL)` and the loader resolves one of libd's DT_NEEDED to libe (built with `-fxray-enable-shared`). In these cases, do we write to these maps, indices such that the patching, unpatching would work as expected? Can we cover them with tests? https://github.com/llvm/llvm-project/pull/90959 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits