Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ddprof-lib/src/main/cpp/signalCookie.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "signalCookie.h"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the required Datadog copyright header

This new source file starts directly with #include and has no copyright header, which violates the repository instruction in /workspace/java-profiler/AGENTS.md: “If modifying a file that does not contain Datadog copyright, add one.” Please add the standard Datadog copyright/SPDX header here so the new compilation unit follows the project licensing requirements.

Useful? React with 👍 / 👎.


namespace SignalCookie {
namespace detail {
// Place tags in a named section on Linux to prevent LTO from merging
// or reordering them across TUs (their addresses must be unique per DSO).
#ifdef __linux__
[[gnu::section(".data.signal_cookie")]] char cpu_tag;
[[gnu::section(".data.signal_cookie")]] char wallclock_tag;
#else
char cpu_tag;
char wallclock_tag;
#endif
}
void* cpu() { return &detail::cpu_tag; }
void* wallclock() { return &detail::wallclock_tag; }
}
15 changes: 2 additions & 13 deletions ddprof-lib/src/main/cpp/signalCookie.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,8 @@
// forged by an unrelated in-process sender without reading our symbols, and
// never collide with legitimate user-space pointers in third-party code.
namespace SignalCookie {
namespace detail {
// Place tags in a named section on Linux to prevent LTO from merging
// or reordering them across TUs (their addresses must be unique per DSO).
#ifdef __linux__
[[gnu::section(".data.signal_cookie")]] inline char cpu_tag;
[[gnu::section(".data.signal_cookie")]] inline char wallclock_tag;
#else
inline char cpu_tag;
inline char wallclock_tag;
#endif
}
inline void* cpu() { return &detail::cpu_tag; }
inline void* wallclock() { return &detail::wallclock_tag; }
void* cpu();
void* wallclock();
}

#endif // SIGNAL_COOKIE_H
Loading