File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2026, Datadog, Inc.
3+ * SPDX-License-Identifier: Apache-2.0
4+ */
5+
6+ #include " signalCookie.h"
7+
8+ namespace SignalCookie {
9+ namespace detail {
10+ // Place tags in a named section on Linux to prevent LTO from merging
11+ // or reordering them across TUs (their addresses must be unique per DSO).
12+ #ifdef __linux__
13+ [[gnu::section(".data.signal_cookie")]] char cpu_tag;
14+ [[gnu::section(".data.signal_cookie")]] char wallclock_tag;
15+ #else
16+ char cpu_tag;
17+ char wallclock_tag;
18+ #endif
19+ }
20+ void * cpu () { return &detail::cpu_tag; }
21+ void * wallclock () { return &detail::wallclock_tag; }
22+ }
Original file line number Diff line number Diff line change 2121// forged by an unrelated in-process sender without reading our symbols, and
2222// never collide with legitimate user-space pointers in third-party code.
2323namespace SignalCookie {
24- namespace detail {
25- // Place tags in a named section on Linux to prevent LTO from merging
26- // or reordering them across TUs (their addresses must be unique per DSO).
27- #ifdef __linux__
28- [[gnu::section(".data.signal_cookie")]] inline char cpu_tag;
29- [[gnu::section(".data.signal_cookie")]] inline char wallclock_tag;
30- #else
31- inline char cpu_tag;
32- inline char wallclock_tag;
33- #endif
34- }
35- inline void * cpu () { return &detail::cpu_tag; }
36- inline void * wallclock () { return &detail::wallclock_tag; }
24+ void * cpu ();
25+ void * wallclock ();
3726}
3827
3928#endif // SIGNAL_COOKIE_H
You can’t perform that action at this time.
0 commit comments