Skip to content

Commit 9234225

Browse files
Update GCC (ps3dev#121)
1 parent f8e8abc commit 9234225

15 files changed

+1750
-187
lines changed

Dockerfile

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
1-
# FROM ubuntu:xenial
2-
FROM debian:12-slim
3-
LABEL maintainer="[email protected]"
4-
1+
FROM ubuntu:22.04 as base
2+
# Set the default shell to Bash
3+
SHELL ["/bin/bash", "-c"]
54
ENV PS3DEV /usr/local/ps3dev
65
ENV PSL1GHT ${PS3DEV}
7-
ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin
8-
6+
ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin
7+
ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig
98
ENV DEBIAN_FRONTEND=noninteractive
9+
# last python version with diskutils module support
10+
ENV PYTHON_VERSION=3.10
11+
ENV PYENV_ROOT ${HOME}/.pyenv
12+
ENV PIP_ROOT_USER_ACTION=ignore
13+
ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:$PATH
14+
RUN apt update -y && \
15+
apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \
16+
ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \
17+
libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \
18+
# Fixes certificate errors with letsencrypt in ARMv7
19+
echo 'ca_certificate=/etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc && \
20+
# Install dependencies specific for amd64 architecture
21+
if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi && \
22+
# pyenv
23+
apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \
24+
llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \
25+
echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc && \
26+
git config --global http.sslverify 'false' && \
27+
curl https://pyenv.run | bash && \
28+
pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \
29+
pip install pycrypto && \
30+
# pyenv
31+
apt -y clean autoclean autoremove
1032

11-
RUN \
12-
apt-get -y update && \
13-
apt-get -y install \
14-
autoconf bison build-essential ca-certificates flex git libelf-dev\
15-
libgmp-dev libncurses5-dev libssl-dev libtool-bin pkg-config python-dev-is-python3 \
16-
texinfo wget zlib1g-dev && \
17-
apt-get -y clean autoclean autoremove && \
18-
rm -rf /var/lib/{apt,dpkg,cache,log}/
19-
33+
FROM base as builder
2034
RUN mkdir /build
2135
WORKDIR /build
2236
COPY . /build
37+
RUN /build/toolchain.sh
2338

24-
# Fixes certificate errors with letsencrypt in ARMv7
25-
# RUN echo "\nca_certificate=/etc/ssl/certs/ca-certificates.crt" | tee -a /etc/wgetrc
26-
# RUN /build/toolchain.sh
39+
FROM base as runtime
40+
ENV PS3DEV /usr/local/ps3dev
41+
ENV PSL1GHT ${PS3DEV}
42+
ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin
43+
ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig
44+
COPY --from=builder ${PS3DEV} ${PS3DEV}
2745

46+
# How to build and run a multi platform image
47+
# Tested platforms: linux/amd64 or linux/arm64
48+
# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker build . -t ps3dev
49+
# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker run -it -v `pwd`:/build -w /build ps3dev

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ For Debian based distros:
2626
libtool libtool-bin python-dev bzip2 libgmp3-dev pkg-config g++ libssl-dev clang
2727
```
2828

29-
For Debian 11 and 12:
30-
31-
> Install `python-is-python3` and `python-dev-is-python3` instead of
32-
`python` and `python-dev`.
33-
34-
For Debian 13:
35-
36-
> In addition to the above, also install `python3-setuptools`.
37-
38-
3929
For RedHat distros:
4030

4131
```bash
File renamed without changes.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Original from https://github.com/ps3dev/ps3toolchain
2+
# Updated for binutils 2.40 by Darjan Krijan [https://disc-kuraudo.eu]
3+
diff '--color=auto' -urN a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh
4+
--- a/ld/emulparams/elf32_spu.sh 2022-07-08 11:46:48.000000000 +0200
5+
+++ b/ld/emulparams/elf32_spu.sh 2023-01-04 22:15:19.310575828 +0100
6+
@@ -6,6 +6,8 @@
7+
ARCH=spu
8+
MACHINE=
9+
ALIGNMENT=16
10+
+GENERATE_PIE_SCRIPT=yes
11+
+GENERATE_COMBRELOC_SCRIPT=yes
12+
TEXT_START_ADDR=0
13+
INITIAL_READONLY_SECTIONS='.interrupt : { KEEP(*(.interrupt)) }'
14+
if test -z "${CREATE_SHLIB}"; then
15+
diff '--color=auto' -urN a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
16+
--- a/ld/emultempl/spuelf.em 2022-07-08 11:46:48.000000000 +0200
17+
+++ b/ld/emultempl/spuelf.em 2023-01-04 22:17:32.998687355 +0100
18+
@@ -258,6 +258,14 @@
19+
return total;
20+
}
21+
22+
+static void
23+
+spu_before_parse (void)
24+
+{
25+
+ gld${EMULATION_NAME}_before_parse ();
26+
+
27+
+ config.has_pie = `if test -n "$GENERATE_PIE_SCRIPT" ; then echo true ; else echo false ; fi`;
28+
+}
29+
+
30+
/* Go find if we need to do anything special for overlays. */
31+
32+
static void
33+
@@ -851,5 +859,6 @@
34+
35+
LDEMUL_AFTER_OPEN=spu_after_open
36+
LDEMUL_BEFORE_ALLOCATION=spu_before_allocation
37+
+LDEMUL_BEFORE_PARSE=spu_before_parse
38+
LDEMUL_FINISH=gld${EMULATION_NAME}_finish
39+
LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target
40+
diff '--color=auto' -urN a/ld/ld.h b/ld/ld.h
41+
--- a/ld/ld.h 2022-07-08 11:46:48.000000000 +0200
42+
+++ b/ld/ld.h 2023-01-04 22:24:33.832738444 +0100
43+
@@ -229,6 +229,9 @@
44+
parameter. */
45+
bool has_shared;
46+
47+
+ /* If TRUE, -pie is supported. */
48+
+ bool has_pie;
49+
+
50+
/* If TRUE, build constructors. */
51+
bool build_constructors;
52+
53+
diff '--color=auto' -urN a/ld/ldmain.c b/ld/ldmain.c
54+
--- a/ld/ldmain.c 2022-07-08 11:46:48.000000000 +0200
55+
+++ b/ld/ldmain.c 2023-01-04 22:16:46.319346843 +0100
56+
@@ -315,6 +315,7 @@
57+
config.make_executable = true;
58+
config.magic_demand_paged = true;
59+
config.text_read_only = true;
60+
+ config.has_pie = false;
61+
config.print_map_discarded = true;
62+
link_info.disable_target_specific_optimizations = -1;
63+
64+
diff '--color=auto' -urN a/ld/lexsup.c b/ld/lexsup.c
65+
--- a/ld/lexsup.c 2022-07-08 11:46:48.000000000 +0200
66+
+++ b/ld/lexsup.c 2023-01-04 22:17:19.218882047 +0100
67+
@@ -1286,6 +1286,8 @@
68+
if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET)
69+
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
70+
}
71+
+ else if (config.has_pie)
72+
+ link_info.type = type_pie;
73+
else
74+
einfo (_("%F%P: -shared not supported\n"));
75+
break;

0 commit comments

Comments
 (0)