Skip to content

Cross compile with LLVM and a sysroot for riscv64#1101

Open
jjhelmus wants to merge 6 commits into
astral-sh:mainfrom
jjhelmus:llvm_cross_riscv
Open

Cross compile with LLVM and a sysroot for riscv64#1101
jjhelmus wants to merge 6 commits into
astral-sh:mainfrom
jjhelmus:llvm_cross_riscv

Conversation

@jjhelmus

Copy link
Copy Markdown
Contributor

Use LLVM 22 and a Debian buster sysroot to cross-compile for riscv64.

Use LLVM 22 and a Debian buster sysroot to cross-compile for riscv64.
Both the native and cross linking is done by lld which is a native cross
linker.
@jjhelmus

Copy link
Copy Markdown
Contributor Author

validating dist/cpython-3.14.4-riscv64-unknown-linux-gnu-lto-20260422T1228.tar.zst
Error: errors found
error: python/install/bin/python3.14 loads illegal library libgcc_s.so.1
error: python/install/lib/libpython3.14.so.1.0 loads illegal library libgcc_s.so.1
error: python/install/lib/python3.14/lib-dynload/_ctypes_test.cpython-314-riscv64-linux-gnu.so loads illegal library libgcc_s.so.1

libgcc_s.so.1 can be added to the allowed libraries, similar to armv7 targets. I am interested in why this occurs with LLVM and only when LTO is enabled.

@jjhelmus

Copy link
Copy Markdown
Contributor Author

Locally python in including symbols that do come from libgcc_s:

# readelf -sW ./python_lto/install/bin/python | grep "GCC"
   596: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __extenddftf2@GCC_3.0 (9)
   597: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __trunctfdf2@GCC_3.0 (9)

These are coming from a few different places, Modules/mathmodule.o is one example. My guess is that without LTO these are inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch:riscv64 platform:linux Specific to the Linux platform python:3.14

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant