Skip to content
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

gh-131591: Fix GENERATE_DEBUG_SECTION for clangcl on Windows #132112

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Include/internal/pycore_debug_offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ extern "C" {
declaration \
_GENERATE_DEBUG_SECTION_LINUX(name)

#if defined(MS_WINDOWS) && !defined(__clang__)
// Please note that section names are truncated to eight bytes
// on Windows!
#if defined(MS_WINDOWS)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fidget-Spinner: clang-cl actually understands the __declspec and now we have the same section name without the . like for MSVC.

#define _GENERATE_DEBUG_SECTION_WINDOWS(name) \
_Pragma(Py_STRINGIFY(section(Py_STRINGIFY(name), read, write))) \
__declspec(allocate(Py_STRINGIFY(name)))
Expand Down
2 changes: 1 addition & 1 deletion Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ typedef struct _Py_AsyncioModuleDebugOffsets {
} asyncio_thread_state;
} Py_AsyncioModuleDebugOffsets;

GENERATE_DEBUG_SECTION(AsyncioDebug, Py_AsyncioModuleDebugOffsets AsyncioDebug)
GENERATE_DEBUG_SECTION(AsyncioDebug, Py_AsyncioModuleDebugOffsets _AsyncioDebug)
Copy link
Member Author

@chris-eibl chris-eibl Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is the reason why clangcl failed with

error: symbol 'AsyncioDebug' is already defined

https://github.com/python/cpython/actions/runs/13288425017/job/37102791006#step:4:243

This also "syncs" with

GENERATE_DEBUG_SECTION(PyRuntime, _PyRuntimeState _PyRuntime)

where _PyRuntime has a leading underscore, too.

= {.asyncio_task_object = {
.size = sizeof(TaskObj),
.task_name = offsetof(TaskObj, task_name),
Expand Down
2 changes: 1 addition & 1 deletion Tools/c-analyzer/cpython/ignored.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Python/pyhash.c - _Py_HashSecret -
Python/parking_lot.c - buckets -

## data needed for introspecting asyncio state from debuggers and profilers
Modules/_asynciomodule.c - AsyncioDebug -
Modules/_asynciomodule.c - _AsyncioDebug -


##################################
Expand Down
Loading