| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ucture on Windows To avoid having the debug sections being optimised away by the compiler we use __attribute__((used)) on gcc and clang but in Windows this is not supported by the Microsoft compiler and there is no equivalent flag. Unfortunately Windows offers almost no alternative other than exporting the symbol in the dynamic table or using it somehow.
|
Sorry can't test this out right now, but does dllexport not prevent it from being optimized away? Or are there other reasons we can't use it? |
Sorry, something went wrong.
Check the commit message: we don't want to export the symbol in the dynamic table. This is basically the less intrusive option Windows offers. |
Sorry, something went wrong.
|
Just for completeness, we also get an error if we try to add __declspec(dllexport) to the macro: C:\Users\pablogsal\GitHub\cpython\Python\pylifecycle.c(113,1): error C2370: '_PyRuntime': redefinition; different storage class [C:\Users\pablogsal\GitHub\cpython\PCbuild\_freeze_module.vcxproj] we could have it as an option only for shared modules but then we need to deal with this other error: C:\Users\pablogsal\GitHub\cpython\PCbuild\win32\_freeze_module.exe : fatal error LNK1120: 1 unresolved externals [C:\Users\pablogsal\GitHub\cpython\PCbuild\_freeze_module.vcxproj] |
Sorry, something went wrong.
|
I also tried doing this but doesn't work: #if defined(MS_WINDOWS)
#define _GENERATE_DEBUG_SECTION_WINDOWS(name) \
_Pragma("optimize(\"g\", off)") \
_Pragma(Py_STRINGIFY(section(Py_STRINGIFY(name), read, write))) \
__declspec(allocate(Py_STRINGIFY(name))) \
_Pragma("optimize(\"g\", on)")
#else
#define _GENERATE_DEBUG_SECTION_WINDOWS(name)
#endif
|
Sorry, something went wrong.
|
|
||
| /* Pointer to the asyncio debug offset to avoid it to be optimized away | ||
| by the compiler */ | ||
| void *debug_offsets; |
There was a problem hiding this comment.
Then we'd even do not need the __attribute__((used)) any longer in the GENERATE_DEBUG_SECTION macros.
But it doesn't hurt either - so let's keep it?
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah I still prefer to keep it
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
To avoid having the debug sections being optimised away by the compiler we use attribute((used)) on gcc and clang but in Windows this is not supported by the Microsoft compiler and there is no equivalent flag. Unfortunately Windows offers almost no alternative other than exporting the symbol in the dynamic table or using it somehow.