Skip to content

Commit e3ae98b

Browse files
clnperezindygreg
authored andcommitted
Add ppc64le support
Closes #165. Signed-off-by: Christy Norman <[email protected]>
1 parent 1da0cd6 commit e3ae98b

File tree

9 files changed

+95
-0
lines changed

9 files changed

+95
-0
lines changed

.github/workflows/linux.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,37 @@ jobs:
325325
py: 'cpython-3.11'
326326
optimizations: 'lto'
327327

328+
# Cross-compiles can't do PGO and require Python 3.9.
329+
- target_triple: 'ppc64le-unknown-linux-gnu'
330+
py: 'cpython-3.9'
331+
optimizations: 'debug'
332+
- target_triple: 'ppc64le-unknown-linux-gnu'
333+
py: 'cpython-3.9'
334+
optimizations: 'noopt'
335+
- target_triple: 'ppc64le-unknown-linux-gnu'
336+
py: 'cpython-3.9'
337+
optimizations: 'lto'
338+
339+
- target_triple: 'ppc64le-unknown-linux-gnu'
340+
py: 'cpython-3.10'
341+
optimizations: 'debug'
342+
- target_triple: 'ppc64le-unknown-linux-gnu'
343+
py: 'cpython-3.10'
344+
optimizations: 'noopt'
345+
- target_triple: 'ppc64le-unknown-linux-gnu'
346+
py: 'cpython-3.10'
347+
optimizations: 'lto'
348+
349+
- target_triple: 'ppc64le-unknown-linux-gnu'
350+
py: 'cpython-3.11'
351+
optimizations: 'debug'
352+
- target_triple: 'ppc64le-unknown-linux-gnu'
353+
py: 'cpython-3.11'
354+
optimizations: 'noopt'
355+
- target_triple: 'ppc64le-unknown-linux-gnu'
356+
py: 'cpython-3.11'
357+
optimizations: 'lto'
358+
328359
# We don't publish noopt builds when PGO is available.
329360
- target_triple: 'x86_64-unknown-linux-gnu'
330361
py: 'cpython-3.8'

cpython-unix/build-cpython.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ mipsel-unknown-linux-gnu)
677677
mips64el-unknown-linux-gnuabi64)
678678
PYTHON_ARCH="mips64el-linux-gnuabi64"
679679
;;
680+
ppc64le-unknown-linux-gnu)
681+
PYTHON_ARCH="powerpc64le-linux-gnu"
682+
;;
680683
s390x-unknown-linux-gnu)
681684
PYTHON_ARCH="s390x-linux-gnu"
682685
;;

cpython-unix/build-libX11.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ if [ -n "${CROSS_COMPILING}" ]; then
6666
mips64el-unknown-linux-gnuabi64)
6767
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
6868
;;
69+
ppc64le-unknown-linux-gnu)
70+
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
71+
;;
6972
s390x-unknown-linux-gnu)
7073
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
7174
;;

cpython-unix/build.cross.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ RUN apt-get install \
5454
gcc-mips-linux-gnu \
5555
gcc-mips64el-linux-gnuabi64 \
5656
gcc-mipsel-linux-gnu \
57+
gcc-powerpc64le-linux-gnu \
5758
gcc-s390x-linux-gnu \
5859
libc6-dev-arm64-cross \
5960
libc6-dev-armel-cross \
6061
libc6-dev-armhf-cross \
6162
libc6-dev-mips-cross \
6263
libc6-dev-mips64el-cross \
6364
libc6-dev-mipsel-cross \
65+
libc6-dev-ppc64el-cross \
6466
libc6-dev-s390x-cross

cpython-unix/extension-modules.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ _decimal:
228228
- define: CONFIG_64=1
229229
targets:
230230
- aarch64-.*
231+
- ppc64le-unknown-linux.*
231232
- s390x-unknown-linux-.*
232233
- x86_64.*
233234
links:

cpython-unix/targets.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,43 @@ mipsel-unknown-linux-gnu:
409409
- zlib
410410
openssl_target: linux-mips32
411411

412+
ppc64le-unknown-linux-gnu:
413+
host_platforms:
414+
- linux64
415+
pythons_supported:
416+
- '3.9'
417+
- '3.10'
418+
- '3.11'
419+
docker_image_suffix: .cross
420+
host_cc: /usr/bin/x86_64-linux-gnu-gcc
421+
host_cxx: /usr/bin/x86_64-linux-gnu-g++
422+
target_cc: /usr/bin/powerpc64le-linux-gnu-gcc
423+
needs:
424+
- autoconf
425+
- bdb
426+
- binutils
427+
- bzip2
428+
- expat
429+
- libedit
430+
- libffi
431+
- libX11
432+
- libXau
433+
- libxcb
434+
- m4
435+
- mpdecimal
436+
- ncurses
437+
- openssl
438+
- patchelf
439+
- sqlite
440+
- tcl
441+
- tk
442+
- tix
443+
- uuid
444+
- xorgproto
445+
- xz
446+
- zlib
447+
openssl_target: linux-ppc64le
448+
412449
s390x-unknown-linux-gnu:
413450
host_platforms:
414451
- linux64

docs/building.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ As are various other targets::
3939
$ ./build-linux.py --target armv7-unknown-linux-gnueabihf
4040
$ ./build-linux.py --target mips-unknown-linux-gnu
4141
$ ./build-linux.py --target mipsel-unknown-linux-gnu
42+
$ ./build-linux.py --target ppc64le-unknown-linux-gnu
4243
$ ./build-linux.py --target s390x-unknown-linux-gnu
4344

4445
macOS

src/release.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ pub static RELEASE_TRIPLES: Lazy<BTreeMap<&'static str, TripleRelease>> = Lazy::
9696
},
9797
);
9898

99+
h.insert(
100+
"ppc64le-unknown-linux-gnu",
101+
TripleRelease {
102+
suffixes: linux_suffixes_nopgo.clone(),
103+
install_only_suffix: "lto",
104+
python_version_requirement: None,
105+
},
106+
);
107+
99108
h.insert(
100109
"i686-unknown-linux-gnu",
101110
TripleRelease {

src/validation.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const RECOGNIZED_TRIPLES: &[&str] = &[
4141
"mips-unknown-linux-gnu",
4242
"mipsel-unknown-linux-gnu",
4343
"mips64el-unknown-linux-gnuabi64",
44+
"ppc64le-unknown-linux-gnu",
4445
"s390x-unknown-linux-gnu",
4546
"thumbv7k-apple-watchos",
4647
"x86_64-apple-darwin",
@@ -155,6 +156,10 @@ static GLIBC_MAX_VERSION_BY_TRIPLE: Lazy<HashMap<&'static str, version_compare::
155156
"mips64el-unknown-linux-gnuabi64",
156157
version_compare::Version::from("2.19").unwrap(),
157158
);
159+
versions.insert(
160+
"ppc64le-unknown-linux-gnu",
161+
version_compare::Version::from("2.17").unwrap(),
162+
);
158163
versions.insert(
159164
"s390x-unknown-linux-gnu",
160165
version_compare::Version::from("2.17").unwrap(),
@@ -212,6 +217,7 @@ static ELF_ALLOWED_LIBRARIES_BY_TRIPLE: Lazy<HashMap<&'static str, Vec<&'static
212217
("mips-unknown-linux-gnu", vec!["ld.so.1"]),
213218
("mipsel-unknown-linux-gnu", vec!["ld.so.1"]),
214219
("mips64el-unknown-linux-gnuabi64", vec![]),
220+
("ppc64le-unknown-linux-gnu", vec!["ld64.so.1"]),
215221
("s390x-unknown-linux-gnu", vec!["ld64.so.1"]),
216222
("x86_64-unknown-linux-gnu", vec!["ld-linux-x86-64.so.2"]),
217223
("x86_64_v2-unknown-linux-gnu", vec!["ld-linux-x86-64.so.2"]),
@@ -426,6 +432,7 @@ static PLATFORM_TAG_BY_TRIPLE: Lazy<HashMap<&'static str, &'static str>> = Lazy:
426432
("mips-unknown-linux-gnu", "linux-mips"),
427433
("mipsel-unknown-linux-gnu", "linux-mipsel"),
428434
("mips64el-unknown-linux-gnuabi64", "todo"),
435+
("ppc64le-unknown-linux-gnu", "linux-powerpc64le"),
429436
("s390x-unknown-linux-gnu", "linux-s390x"),
430437
("x86_64-apple-darwin", "macosx-10.9-x86_64"),
431438
("x86_64-apple-ios", "iOS-x86_64"),
@@ -777,6 +784,7 @@ fn validate_elf<'data, Elf: FileHeader<Endian = Endianness>>(
777784
"mips-unknown-linux-gnu" => object::elf::EM_MIPS,
778785
"mipsel-unknown-linux-gnu" => object::elf::EM_MIPS,
779786
"mips64el-unknown-linux-gnuabi64" => 0,
787+
"ppc64le-unknown-linux-gnu" => object::elf::EM_PPC64,
780788
"s390x-unknown-linux-gnu" => object::elf::EM_S390,
781789
"x86_64-unknown-linux-gnu" => object::elf::EM_X86_64,
782790
"x86_64_v2-unknown-linux-gnu" => object::elf::EM_X86_64,

0 commit comments

Comments
 (0)