-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-91048: Prevent optimizing away the asyncio debug offsets structure on Windows #132963
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…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 |
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. |
Just for completeness, we also get an error if we try to add
we could have it as an option only for shared modules but then we need to deal with this other error:
|
I also tried doing this but doesn't work:
|
@@ -185,6 +185,10 @@ typedef struct { | |||
/* Counter for autogenerated Task names */ | |||
uint64_t task_name_counter; | |||
|
|||
/* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I still prefer to keep it
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.