@@ -17,31 +17,34 @@ extern "C" {
1717
1818// Macros to burn global values in custom sections so out-of-process
1919// profilers can locate them easily.
20-
2120#define GENERATE_DEBUG_SECTION (name , declaration ) \
2221 _GENERATE_DEBUG_SECTION_WINDOWS(name) \
2322 _GENERATE_DEBUG_SECTION_APPLE(name) \
2423 declaration \
25- _GENERATE_DEBUG_SECTION_LINUX(name)
24+ _GENERATE_DEBUG_SECTION_LINUX(name) \
25+ __attribute__((used))
2626
2727#if defined(MS_WINDOWS )
2828#define _GENERATE_DEBUG_SECTION_WINDOWS (name ) \
2929 _Pragma(Py_STRINGIFY(section(Py_STRINGIFY(name), read, write))) \
30- __declspec(allocate(Py_STRINGIFY(name)))
30+ __declspec(allocate(Py_STRINGIFY(name))) \
31+ __declspec(dllexport)
3132#else
3233#define _GENERATE_DEBUG_SECTION_WINDOWS (name )
3334#endif
3435
3536#if defined(__APPLE__ )
3637#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")))
3840#else
3941#define _GENERATE_DEBUG_SECTION_APPLE (name )
4042#endif
4143
4244#if defined(__linux__ ) && (defined(__GNUC__ ) || defined(__clang__ ))
4345#define _GENERATE_DEBUG_SECTION_LINUX (name ) \
44- __attribute__((section("." Py_STRINGIFY(name))))
46+ __attribute__((section("." Py_STRINGIFY(name)))) \
47+ __attribute__((visibility("default")))
4548#else
4649#define _GENERATE_DEBUG_SECTION_LINUX (name )
4750#endif
0 commit comments