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+ #include " signalCookie.h"
2+
3+ namespace SignalCookie {
4+ namespace detail {
5+ // Place tags in a named section on Linux to prevent LTO from merging
6+ // or reordering them across TUs (their addresses must be unique per DSO).
7+ #ifdef __linux__
8+ [[gnu::section(".data.signal_cookie")]] char cpu_tag;
9+ [[gnu::section(".data.signal_cookie")]] char wallclock_tag;
10+ #else
11+ char cpu_tag;
12+ char wallclock_tag;
13+ #endif
14+ }
15+ void * cpu () { return &detail::cpu_tag; }
16+ void * wallclock () { return &detail::wallclock_tag; }
17+ }
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