Skip to content

Avoid newer libgcc_s helper symbols in CPython 3.16 builds - #1391

Merged
jjhelmus merged 3 commits into
mainfrom
jjh/fix_newer_gcc_sym
Oct 23, 2026
Merged

jjhelmus merged 3 commits into
mainfrom
jjh/fix_newer_gcc_sym

Conversation

@jjhelmus

Copy link
Copy Markdown
Contributor

Statically link the helper functions used for half-precision conversions used in Python 3.16 from libgcc.a.

This is not needed when cross-compiling as only an older libgcc is available in the sysroot. Native builds have the newer libgcc that is included in the LLVM bundle.

Include checks for GCC symbol versions during validation.
Cherry-picked from #1376

jjhelmus and others added 2 commits October 23, 2026 08:48
Statically link the helper functions used for half-precision conversions
used in Python 3.16 from libgcc.a.

This is not needed when cross-compiling as only an older libgcc is
available in the sysroot. Native builds have the newer libgcc that is
included in the LLVM bundle.
@jjhelmus

Copy link
Copy Markdown
Contributor Author

See related discussion in #1378 and #1358

Comment thread cpython-unix/build-cpython.sh Outdated
LDFLAGS="${EXTRA_TARGET_LDFLAGS} -L${TOOLS_PATH}/deps/lib"

# LTO can introduce these helpers after the static libgcc archive is scanned.
# Force them from libgcc.a to avoid newer libgcc_s symbol versions on old systems.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A bit confused about "Force them from" meaning

Comment thread cpython-unix/build-cpython.sh Outdated
Comment on lines +1122 to +1124
# These flags are only needed when linking CPython itself.
for flag in os.environ.get("CPYTHON_RUNTIME_LDFLAGS", "").split():
replace_in_all(flag, "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is pretty goofy. Do they not have a first-class variable for doing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LDFLAGS_NODIST is a better location for these, then they do not need cleanup

@jjhelmus
jjhelmus merged commit 0ec743a into main Oct 23, 2026
70 checks passed
@jjhelmus
jjhelmus deleted the jjh/fix_newer_gcc_sym branch October 23, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants