@@ -17,31 +17,34 @@ extern "C" {
17
17
18
18
// Macros to burn global values in custom sections so out-of-process
19
19
// profilers can locate them easily.
20
-
21
20
#define GENERATE_DEBUG_SECTION (name , declaration ) \
22
21
_GENERATE_DEBUG_SECTION_WINDOWS(name) \
23
22
_GENERATE_DEBUG_SECTION_APPLE(name) \
24
23
declaration \
25
- _GENERATE_DEBUG_SECTION_LINUX(name)
24
+ _GENERATE_DEBUG_SECTION_LINUX(name) \
25
+ __attribute__((used))
26
26
27
27
#if defined(MS_WINDOWS )
28
28
#define _GENERATE_DEBUG_SECTION_WINDOWS (name ) \
29
29
_Pragma(Py_STRINGIFY(section(Py_STRINGIFY(name), read, write))) \
30
- __declspec(allocate(Py_STRINGIFY(name)))
30
+ __declspec(allocate(Py_STRINGIFY(name))) \
31
+ __declspec(dllexport)
31
32
#else
32
33
#define _GENERATE_DEBUG_SECTION_WINDOWS (name )
33
34
#endif
34
35
35
36
#if defined(__APPLE__ )
36
37
#define _GENERATE_DEBUG_SECTION_APPLE (name ) \
37
- __attribute__((section(SEG_DATA "," Py_STRINGIFY(name))))
38
+ __attribute__((section(SEG_DATA "," Py_STRINGIFY(name)))) \
39
+ __attribute__((visibility("default")))
38
40
#else
39
41
#define _GENERATE_DEBUG_SECTION_APPLE (name )
40
42
#endif
41
43
42
44
#if defined(__linux__ ) && (defined(__GNUC__ ) || defined(__clang__ ))
43
45
#define _GENERATE_DEBUG_SECTION_LINUX (name ) \
44
- __attribute__((section("." Py_STRINGIFY(name))))
46
+ __attribute__((section("." Py_STRINGIFY(name)))) \
47
+ __attribute__((visibility("default")))
45
48
#else
46
49
#define _GENERATE_DEBUG_SECTION_LINUX (name )
47
50
#endif
0 commit comments