From 1a930c00ae28f20fbacca20c50540023e95e1fff Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:16:09 -0300 Subject: [PATCH 001/159] add gcc-ppu-spu v13.2.0 --- ...c-7.2.0-PS3.patch => gcc-13.2.0-PS3.patch} | 135 +++++++----------- scripts/002-gcc-newlib-PPU.sh | 4 +- scripts/006-gcc-newlib-SPU.sh | 8 +- 3 files changed, 51 insertions(+), 96 deletions(-) rename patches/{gcc-7.2.0-PS3.patch => gcc-13.2.0-PS3.patch} (87%) diff --git a/patches/gcc-7.2.0-PS3.patch b/patches/gcc-13.2.0-PS3.patch similarity index 87% rename from patches/gcc-7.2.0-PS3.patch rename to patches/gcc-13.2.0-PS3.patch index 28be00208..2bc8eeb59 100644 --- a/patches/gcc-7.2.0-PS3.patch +++ b/patches/gcc-13.2.0-PS3.patch @@ -1,8 +1,11 @@ +# Original from https://github.com/ps3dev/ps3toolchain +# Updated to gcc 9.5.0 by Darjan Krijan [https://disc-kuraudo.eu] +# Updated to gcc 13.2.0 by luizfernandonb diff --git a/Makefile.in b/Makefile.in -index b824e0a0c..5bf0da25e 100644 +index 06a9398e172..7419f7ed67a 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -25734,7 +25734,6 @@ check-libiberty: +@@ -28118,7 +28118,6 @@ check-libiberty: .PHONY: install-libiberty maybe-install-libiberty maybe-install-libiberty: @if libiberty @@ -11,15 +14,15 @@ index b824e0a0c..5bf0da25e 100644 install-libiberty: installdirs @: $(MAKE); $(unstage) diff --git a/gcc/config.gcc b/gcc/config.gcc -index a9196cd26..f2a94403d 100644 +index 648b3dc2110..650d65fe28d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc -@@ -2330,6 +2330,15 @@ pdp11-*-*) +@@ -2863,6 +2863,15 @@ pdp11-*-*) # tmake_file="${tmake_file} rs6000/t-fprules" # extra_headers= # ;; +powerpc64-ps3-elf) -+ tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" ++ tm_file="${tm_file} elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" + tm_file="rs6000/biarch64.h ${tm_file} rs6000/cell64lv2.h" + if test x${enable_secureplt} = xyes; then + tm_file="rs6000/secureplt.h ${tm_file}" @@ -28,14 +31,14 @@ index a9196cd26..f2a94403d 100644 + tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + ;; powerpc-*-darwin*) - extra_options="${extra_options} rs6000/darwin.opt" + extra_options="${extra_options} ${cpu_type}/darwin.opt" case ${target} in diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h new file mode 100644 -index 000000000..86da868b5 +index 00000000000..79a09605757 --- /dev/null +++ b/gcc/config/rs6000/cell64lv2.h -@@ -0,0 +1,587 @@ +@@ -0,0 +1,583 @@ +/* Definitions of target machine for GNU compiler, + for 64 bit PowerPC linux. + Copyright (C) 2000-2017 Free Software Foundation, Inc. @@ -330,11 +333,9 @@ index 000000000..86da868b5 +/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ +#undef ADJUST_FIELD_ALIGN +#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ -+ (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ -+ ? 128 \ -+ : (TARGET_64BIT \ -+ && TARGET_ALIGN_NATURAL == 0 \ -+ && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ ++ ((TARGET_64BIT \ ++ && TARGET_ALIGN_NATURAL == 0 \ ++ && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ? MIN ((COMPUTED), 32) \ + : (COMPUTED)) + @@ -377,7 +378,7 @@ index 000000000..86da868b5 + registers and memory. FIRST is nonzero if this is the only + element. */ +#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ -+ (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE)) ++ (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE)) + +/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit + process. */ @@ -596,8 +597,6 @@ index 000000000..86da868b5 +#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) +#endif + -+#define POWERPC_CELL64LV2 -+ +#define POINTERS_EXTEND_UNSIGNED 1 + +/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */ @@ -623,54 +622,48 @@ index 000000000..86da868b5 + enabling the __float128 keyword. */ +#undef TARGET_FLOAT128_ENABLE_TYPE +#define TARGET_FLOAT128_ENABLE_TYPE 1 -diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c -index db9136f26..3a29d4723 100644 ---- a/gcc/config/rs6000/rs6000.c -+++ b/gcc/config/rs6000/rs6000.c -@@ -1349,6 +1349,12 @@ rtl_opt_pass *make_pass_analyze_swaps (gcc::context*); - static bool rs6000_keep_leaf_when_profiled () __attribute__ ((unused)); - static tree rs6000_fold_builtin (tree, int, tree *, bool); - -+#ifdef POWERPC_CELL64LV2 -+ -+static bool rs6000_cell64lv2_valid_pointer_mode(enum machine_mode); -+ -+#endif -+ - /* Hash table stuff for keeping track of TOC entries. */ +\ No newline at end of file +diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc +index e5ceff3a61b..152b1191490 100644 +--- a/gcc/config/rs6000/rs6000.cc ++++ b/gcc/config/rs6000/rs6000.cc +@@ -1762,6 +1762,17 @@ static const struct attribute_spec rs6000_attribute_table[] = + #define TARGET_UPDATE_IPA_FN_TARGET_INFO rs6000_update_ipa_fn_target_info + - struct GTY((for_user)) toc_hash_struct -@@ -43333,7 +43339,19 @@ rs6000_optab_supported_p (int op, machine_mode mode1, machine_mode, - return true; - } - } -- -+ -+#ifdef POWERPC_CELL64LV2 ++static bool rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode); + -+#undef TARGET_VALID_POINTER_MODE -+#define TARGET_VALID_POINTER_MODE rs6000_cell64lv2_valid_pointer_mode -+ -+static bool rs6000_cell64lv2_valid_pointer_mode(enum machine_mode mode) ++static bool ++rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode mode) +{ -+ return (mode == SImode || (TARGET_64BIT && mode == DImode) || mode == ptr_mode || mode == Pmode); ++ return (mode == SImode || (TARGET_64BIT && mode == DImode) || mode == ptr_mode || mode == Pmode); +} + -+#endif ++#undef TARGET_VALID_POINTER_MODE ++#define TARGET_VALID_POINTER_MODE rs6000_cell64lv2_valid_pointer_mode + - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-rs6000.h" + /* Processor table. */ + struct rs6000_ptt + { +@@ -3491,7 +3502,7 @@ rs6000_linux64_override_options () + { + if (TARGET_PROFILE_KERNEL) + { +- profile_kernel = 0; ++ //profile_kernel = 0; Why??? + error (INVALID_32BIT, "profile-kernel"); + } + if (OPTION_SET_P (rs6000_current_cmodel)) diff --git a/gcc/configure b/gcc/configure -index 50ccc2a0f..6b503988a 100755 +index dec2eca1a45..bcfdcffb950 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -28598,12 +28598,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h +@@ -30853,12 +30853,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h esac case "$target:$tm_file" in -- powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) -+ powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) +- powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) ++ powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) case "$target" in *le-*-linux*) emul_name="-melf64lppc" @@ -679,44 +672,12 @@ index 50ccc2a0f..6b503988a 100755 + *-*-linux* | *-ps3-elf*) emul_name="-melf64ppc" ;; - *-*-freebsd*) -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 1d5a9d7c6..e568cb3f8 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -5462,12 +5462,12 @@ EOF - esac - - case "$target:$tm_file" in -- powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) -+ powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) - case "$target" in - *le-*-linux*) - emul_name="-melf64lppc" - ;; -- *-*-linux*) -+ *-*-linux* | *-ps3-elf*) - emul_name="-melf64ppc" - ;; - *-*-freebsd*) -diff --git a/libcpp/lex.c b/libcpp/lex.c -index 9edd2a6af..15585ff93 100644 ---- a/libcpp/lex.c -+++ b/libcpp/lex.c -@@ -568,7 +568,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) - { - vc m_nl, m_cr, m_bs, m_qm; - -- data = *((const vc *)s); -+ data = __builtin_vec_vsx_ld (0, s); - s += 16; - - m_nl = (vc) __builtin_vec_cmpeq(data, repl_nl); + *le-*-freebsd*) diff --git a/libgcc/config.host b/libgcc/config.host -index bedcf1017..8d6c8feff 100644 +index 9d7212028d0..c2b3bb8ac28 100644 --- a/libgcc/config.host +++ b/libgcc/config.host -@@ -1043,6 +1043,8 @@ powerpc-*-rtems*) +@@ -1224,6 +1224,8 @@ powerpc-*-rtems*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" ;; diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index b63da30d2..4b1dc90b4 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # gcc-newlib-PPU.sh by Naomi Peori (naomi@peori.ca) -GCC="gcc-7.2.0" +GCC="gcc-13.2.0" NEWLIB="newlib-1.20.0" if [ ! -d ${GCC} ]; then @@ -58,8 +58,6 @@ cd ${GCC}/build-ppu --enable-threads \ --with-cpu="cell" \ --with-newlib \ - --enable-newlib-multithread \ - --enable-newlib-hw-fp \ --with-system-zlib ## Compile and install. diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index c51f73786..ef21f3b61 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # gcc-newlib-SPU.sh by Naomi Peori (naomi@peori.ca) -GCC="gcc-7.2.0" +GCC="gcc-13.2.0" NEWLIB="newlib-1.20.0" if [ ! -d ${GCC} ]; then @@ -44,7 +44,6 @@ fi cd ${GCC}/build-spu ## Configure the build. -CFLAGS_FOR_TARGET="-Os -fpic -ffast-math -ftree-vectorize -funroll-loops -fschedule-insns -mdual-nops -mwarn-reloc" \ ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-dependency-tracking \ --disable-libcc1 \ @@ -56,10 +55,7 @@ CFLAGS_FOR_TARGET="-Os -fpic -ffast-math -ftree-vectorize -funroll-loops -fsched --enable-languages="c,c++" \ --enable-lto \ --enable-threads \ - --with-newlib \ - --enable-newlib-multithread \ - --enable-newlib-hw-fp \ - --with-pic + --with-newlib ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? From 868e7f8041ed98541747820102675b9472da0f53 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:18:21 -0300 Subject: [PATCH 002/159] ignore mac .DS_Store --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ae20c71b3..c9f22d9d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ build/ .idea/** +.DS_Store From d044950c66ebf6ff54c3117026b345e1f98dc9ad Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:26:17 -0300 Subject: [PATCH 003/159] [fix] github actions --- .github/workflows/deploy.yaml | 124 ++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 57 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 42302dcda..df08445ad 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,68 +1,78 @@ -name: Build toolchain docker image +name: CI on: push: - branches: - - '*' pull_request: - branches: - - '*' + repository_dispatch: + types: [run_build] jobs: - Docker: - runs-on: ubuntu-latest + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 1 - persist-credentials: false - - name: Set up Docker Buildx - if: success() - id: buildx - uses: crazy-max/ghaction-docker-buildx@v3 - with: - buildx-version: latest - qemu-version: latest - - name: Prepare - if: success() - id: prepare - run: | - echo ::set-output name=docker_platforms::linux/amd64,linux/386 - echo ::set-output name=docker_username::miigotu - echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3dev - VERSION_TAG=${GITHUB_REF#refs/*/} - echo ::set-output name=version::${VERSION_TAG%/merge} - - name: Available platforms - if: success() - run: echo ${{ steps.buildx.outputs.platforms }} - - name: Docker Login and set build command - if: success() - id: login - env: - GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + + - name: Install Ubuntu requirements + if: matrix.os == 'ubuntu-latest' run: | - echo "${GITHUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin docker.pkg.github.com - echo ::set-output name=buildx::$(echo docker buildx build --output type=image,name=${{ steps.prepare.outputs.github_image }},push=true \ - --platform ${{ steps.prepare.outputs.docker_platforms }} --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" \ - --tag "${{ steps.prepare.outputs.github_image }}:${{ steps.prepare.outputs.version }}") - - name: Cache Docker layers - uses: actions/cache@v2 - id: cache - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ steps.prepare.outputs.version }} - restore-keys: | - ${{ runner.os }}-buildx- - - name: Run Buildx (master) - if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request' + sudo apt-get update + sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python subversion wget zlib1g-dev libtool-bin python-dev bzip2 libgmp3-dev pkg-config + + - name: Install macOS requirements + if: matrix.os == 'macos-latest' run: | - ${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.github_image }}:latest" --file Dockerfile . - - name: Run Buildx (non-master) - if: success() && steps.prepare.outputs.version != 'master' && github.event_name != 'pull_request' + brew update + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config + + - name: Runs all the stages in the shell run: | - ${{ steps.login.outputs.buildx }} --file Dockerfile . - - name: Clear - if: always() + mkdir $PWD/ps3dev + export PS3DEV=$PWD/ps3dev + export PSL1GHT=$PS3DEV + export PATH=$PATH:$PS3DEV/bin + export PATH=$PATH:$PS3DEV/ppu/bin + export PATH=$PATH:$PS3DEV/spu/bin + ./toolchain.sh + + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + + - name: Compress ps3dev folder run: | - rm -rf ${HOME}/.docker/config.json + tar -zcvf ps3dev.tar.gz ps3dev + +# - uses: actions/upload-artifact@v2 +# with: +# name: ps3dev-${{ steps.slug.outputs.sha8 }}-${{matrix.os}} +# path: ps3dev.tar.gz + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{matrix.os}}-${{ steps.slug.outputs.sha8 }} + release_name: ps3dev ${{matrix.os}} (${{steps.date.outputs.date}}) + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./ps3dev.tar.gz + asset_name: ps3dev-${{matrix.os}}-${{steps.date.outputs.date}}.tar.gz + asset_content_type: application/gzip \ No newline at end of file From b237a9a497173e9f6559d2a5c5fc447bb0d38e1e Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:32:16 -0300 Subject: [PATCH 004/159] [gha] python dependency name fixed for ubuntu-latest --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index df08445ad..95a8c6ce9 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,7 +20,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python subversion wget zlib1g-dev libtool-bin python-dev bzip2 libgmp3-dev pkg-config + sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config - name: Install macOS requirements if: matrix.os == 'macos-latest' From 57d3d7a59d4f619711a8a512ed66229bd2a762a2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:40:19 -0300 Subject: [PATCH 005/159] [gha] install python2 manually --- .github/workflows/deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 95a8c6ce9..579749319 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -27,6 +27,9 @@ jobs: run: | brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config + # python2 + curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg + installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From de37a375b7293b60c5dd7b23e900f89b31a34f44 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 22:41:52 -0300 Subject: [PATCH 006/159] [gha] sudo required --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 579749319..0df625b71 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -29,7 +29,7 @@ jobs: brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg - installer -pkg python-2.7.18-macosx10.9.pkg -target / + sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From eac7e4fc090bd07ea6cea2a0f9adb3989c6305c3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 4 Mar 2024 23:18:15 -0300 Subject: [PATCH 007/159] [gha] add g++ with c11 support --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0df625b71..407086e8c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,7 +20,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config + sudo apt-get -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config - name: Install macOS requirements if: matrix.os == 'macos-latest' From 2f2633fa1df28825e1447af1116618f53d8e5f3a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 00:12:15 -0300 Subject: [PATCH 008/159] specific patch file for gcc ppu --- ...2.0-PS3.patch => gcc-13.2.0-PS3-PPU.patch} | 0 scripts/002-gcc-newlib-PPU.sh | 35 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) rename patches/{gcc-13.2.0-PS3.patch => gcc-13.2.0-PS3-PPU.patch} (100%) diff --git a/patches/gcc-13.2.0-PS3.patch b/patches/gcc-13.2.0-PS3-PPU.patch similarity index 100% rename from patches/gcc-13.2.0-PS3.patch rename to patches/gcc-13.2.0-PS3-PPU.patch diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 4b1dc90b4..942ac8904 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -15,7 +15,7 @@ if [ ! -d ${GCC} ]; then rm -Rf ${NEWLIB} && tar xfvz ${NEWLIB}.tar.gz ## Patch the source code. - cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} + cat ../patches/${GCC}-PS3-PPU.patch | patch -p1 -d ${GCC} cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} ## Enter the source code directory. @@ -44,21 +44,26 @@ fi cd ${GCC}/build-ppu ## Configure the build. + +# Avoid breakage +CFLAGS="$CFLAGS -Werror=format-security" +CXXFLAGS="$CXXFLAGS -Werror=format-security" ../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ - --disable-dependency-tracking \ - --disable-libcc1 \ - --disable-libstdcxx-pch \ - --disable-multilib \ - --disable-nls \ - --disable-shared \ - --disable-win32-registry \ - --enable-languages="c,c++" \ - --enable-long-double-128 \ - --enable-lto \ - --enable-threads \ - --with-cpu="cell" \ - --with-newlib \ - --with-system-zlib + --with-cpu="cell" \ + --with-newlib \ + --with-system-zlib \ + --enable-languages="c,c++" \ + --enable-long-double-128 \ + --enable-lto \ + --enable-threads \ + --enable-newlib-multithread \ + --enable-newlib-hw-fp \ + --disable-dependency-tracking \ + --disable-libcc1 \ + --disable-multilib \ + --disable-nls \ + --disable-shared \ + --disable-win32-registry ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? From afb604ffa8128115a34e41f026feae5353b09f70 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 00:13:04 -0300 Subject: [PATCH 009/159] [gha] unnecessary -get --- .github/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 407086e8c..3e3e68a21 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -19,8 +19,8 @@ jobs: - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' run: | - sudo apt-get update - sudo apt-get -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config + sudo apt update + sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config - name: Install macOS requirements if: matrix.os == 'macos-latest' From 66979e99f1ebf383b072082488cbf9a39282fa46 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 00:18:28 -0300 Subject: [PATCH 010/159] gcc 9.5.0 for spu --- patches/gcc-9.5.0-PS3-SPU.patch | 705 ++++++++++++++++++++++++++++++++ scripts/006-gcc-newlib-SPU.sh | 29 +- 2 files changed, 721 insertions(+), 13 deletions(-) create mode 100644 patches/gcc-9.5.0-PS3-SPU.patch diff --git a/patches/gcc-9.5.0-PS3-SPU.patch b/patches/gcc-9.5.0-PS3-SPU.patch new file mode 100644 index 000000000..1292e356d --- /dev/null +++ b/patches/gcc-9.5.0-PS3-SPU.patch @@ -0,0 +1,705 @@ +# Original from https://github.com/ps3dev/ps3toolchain +# Updated to gcc 9.5.0 by Darjan Krijan [https://disc-kuraudo.eu] +diff '--color=auto' -urN a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h +--- a/gcc/config/rs6000/cell64lv2.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/gcc/config/rs6000/cell64lv2.h 2023-01-01 17:58:23.274094209 +0100 +@@ -0,0 +1,587 @@ ++/* Definitions of target machine for GNU compiler, ++ for 64 bit PowerPC linux. ++ Copyright (C) 2000-2017 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ . */ ++ ++#ifndef RS6000_BI_ARCH ++ ++#undef TARGET_64BIT ++#define TARGET_64BIT 1 ++ ++#define DEFAULT_ARCH64_P 1 ++#define RS6000_BI_ARCH_P 0 ++ ++#else ++ ++#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT) ++#define RS6000_BI_ARCH_P 1 ++ ++#endif ++ ++#ifdef IN_LIBGCC2 ++#undef TARGET_64BIT ++#ifdef __powerpc64__ ++#define TARGET_64BIT 1 ++#else ++#define TARGET_64BIT 0 ++#endif ++#endif ++ ++#undef TARGET_AIX ++#define TARGET_AIX TARGET_64BIT ++ ++#ifdef HAVE_LD_NO_DOT_SYMS ++/* New ABI uses a local sym for the function entry point. */ ++extern int dot_symbols; ++#undef DOT_SYMBOLS ++#define DOT_SYMBOLS dot_symbols ++#endif ++ ++#undef TARGET_KEEP_LEAF_WHEN_PROFILED ++#define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled ++ ++#define TARGET_USES_LINUX64_OPT 1 ++#ifdef HAVE_LD_LARGE_TOC ++#undef TARGET_CMODEL ++#define TARGET_CMODEL rs6000_current_cmodel ++#define SET_CMODEL(opt) rs6000_current_cmodel = opt ++#else ++#define SET_CMODEL(opt) do {} while (0) ++#endif ++ ++#undef PROCESSOR_DEFAULT ++#define PROCESSOR_DEFAULT PROCESSOR_CELL ++#undef PROCESSOR_DEFAULT64 ++#define PROCESSOR_DEFAULT64 PROCESSOR_CELL ++ ++/* We don't need to generate entries in .fixup, except when ++ -mrelocatable or -mrelocatable-lib is given. */ ++#undef RELOCATABLE_NEEDS_FIXUP ++#define RELOCATABLE_NEEDS_FIXUP \ ++ (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE) ++ ++#undef RS6000_ABI_NAME ++#define RS6000_ABI_NAME "linux" ++ ++#define INVALID_64BIT "-m%s not supported in this configuration" ++#define INVALID_32BIT INVALID_64BIT ++ ++#ifdef LINUX64_DEFAULT_ABI_ELFv2 ++#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1) ++#else ++#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2) ++#endif ++ ++#undef SUBSUBTARGET_OVERRIDE_OPTIONS ++#define SUBSUBTARGET_OVERRIDE_OPTIONS \ ++ do \ ++ { \ ++ if (!global_options_set.x_rs6000_alignment_flags) \ ++ rs6000_alignment_flags = MASK_ALIGN_NATURAL; \ ++ if (rs6000_isa_flags & OPTION_MASK_64BIT) \ ++ { \ ++ if (DEFAULT_ABI != ABI_AIX) \ ++ { \ ++ rs6000_current_abi = ABI_AIX; \ ++ error (INVALID_64BIT, "call"); \ ++ } \ ++ dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \ ++ if (ELFv2_ABI_CHECK) \ ++ { \ ++ rs6000_current_abi = ABI_ELFv2; \ ++ if (dot_symbols) \ ++ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \ ++ } \ ++ if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ ++ { \ ++ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ ++ error (INVALID_64BIT, "relocatable"); \ ++ } \ ++ if (rs6000_isa_flags & OPTION_MASK_EABI) \ ++ { \ ++ rs6000_isa_flags &= ~OPTION_MASK_EABI; \ ++ error (INVALID_64BIT, "eabi"); \ ++ } \ ++ if (TARGET_PROTOTYPE) \ ++ { \ ++ target_prototype = 0; \ ++ error (INVALID_64BIT, "prototype"); \ ++ } \ ++ if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \ ++ { \ ++ rs6000_isa_flags |= OPTION_MASK_POWERPC64; \ ++ error ("-m64 requires a PowerPC64 cpu"); \ ++ } \ ++ if ((rs6000_isa_flags_explicit \ ++ & OPTION_MASK_MINIMAL_TOC) != 0) \ ++ { \ ++ if (global_options_set.x_rs6000_current_cmodel \ ++ && rs6000_current_cmodel != CMODEL_SMALL) \ ++ error ("-mcmodel incompatible with other toc options"); \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ } \ ++ else \ ++ { \ ++ if (!global_options_set.x_rs6000_current_cmodel) \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ if (rs6000_current_cmodel != CMODEL_SMALL) \ ++ { \ ++ if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \ ++ TARGET_NO_FP_IN_TOC \ ++ = rs6000_current_cmodel == CMODEL_MEDIUM; \ ++ if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \ ++ TARGET_NO_SUM_IN_TOC = 0; \ ++ } \ ++ } \ ++ } \ ++ else \ ++ { \ ++ if (!RS6000_BI_ARCH_P) \ ++ error (INVALID_32BIT, "32"); \ ++ if (global_options_set.x_rs6000_current_cmodel) \ ++ { \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ error (INVALID_32BIT, "cmodel"); \ ++ } \ ++ } \ ++ } \ ++ while (0) ++ ++#undef ASM_DEFAULT_SPEC ++#undef ASM_SPEC ++#undef LINK_SECURE_PLT_SPEC ++ ++#ifndef RS6000_BI_ARCH ++#define ASM_DEFAULT_SPEC "-mcell" ++#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%(link_os_lv2_spec64)" ++#define LINK_SECURE_PLT_SPEC "" ++#else ++#if DEFAULT_ARCH64_P ++#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" ++#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%{m32:%(link_os_lv2_spec32)}%{!m32:%(link_os_lv2_spec64)}" ++#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}" ++#else ++#define ASM_DEFAULT_SPEC "-mppc%{m64:64}" ++#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%{!m64:%(link_os_lv2_spec32)}%{m64:%(link_os_lv2_spec64)}" ++#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}" ++#endif ++#endif ++ ++#define ASM_SPEC32 "-a32 \ ++%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ ++%{memb|msdata=eabi: -memb}" ++ ++#define ASM_SPEC64 "-a64" ++ ++#define ASM_SPEC_COMMON "%(asm_cpu) \ ++%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ ++ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) ++ ++#undef SUBSUBTARGET_EXTRA_SPECS ++#define SUBSUBTARGET_EXTRA_SPECS \ ++ { "asm_spec_common", ASM_SPEC_COMMON }, \ ++ { "asm_spec32", ASM_SPEC32 }, \ ++ { "asm_spec64", ASM_SPEC64 }, \ ++ { "link_os_lv2_spec32", LINK_OS_LV2_SPEC32 }, \ ++ { "link_os_lv2_spec64", LINK_OS_LV2_SPEC64 }, \ ++ { "lib_lv2", LIB_LV2_SPEC }, \ ++ { "startfile_lv2", STARTFILE_LV2_SPEC }, \ ++ { "endfile_lv2", ENDFILE_LV2_SPEC }, \ ++ { "link_start_lv2", LINK_START_LV2_SPEC }, \ ++ { "link_os_lv2", LINK_OS_LV2_SPEC }, \ ++ { "cpp_os_lv2", CPP_OS_LV2_SPEC }, \ ++ { "link_os_extra_spec32", LINK_OS_EXTRA_SPEC32 }, \ ++ { "link_os_extra_spec64", LINK_OS_EXTRA_SPEC64 }, \ ++ { "link_os_new_dtags", LINK_OS_NEW_DTAGS_SPEC }, \ ++ { "include_extra", INCLUDE_EXTRA_SPEC }, \ ++ { "dynamic_linker_prefix", DYNAMIC_LINKER_PREFIX } ++ ++/* Optional specs used for overriding the system include directory, default ++ -rpath links, and prefix for the dynamic linker. Normally, there are not ++ defined, but if the user configure with the --with-advance-toolchain= ++ option, the advance-toolchain.h file will override these. */ ++#ifndef INCLUDE_EXTRA_SPEC ++#define INCLUDE_EXTRA_SPEC "" ++#endif ++ ++#ifndef LINK_OS_EXTRA_SPEC32 ++#define LINK_OS_EXTRA_SPEC32 "" ++#endif ++ ++#ifndef LINK_OS_EXTRA_SPEC64 ++#define LINK_OS_EXTRA_SPEC64 "" ++#endif ++ ++#ifndef LINK_OS_NEW_DTAGS_SPEC ++#define LINK_OS_NEW_DTAGS_SPEC "" ++#endif ++ ++#ifndef DYNAMIC_LINKER_PREFIX ++#define DYNAMIC_LINKER_PREFIX "" ++#endif ++ ++#undef MULTILIB_DEFAULTS ++#if DEFAULT_ARCH64_P ++#define MULTILIB_DEFAULTS { "m64" } ++#else ++#define MULTILIB_DEFAULTS { "m32" } ++#endif ++ ++/* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ ++#if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018 ++# ifndef RS6000_BI_ARCH ++# define TARGET_CAN_SPLIT_STACK ++# else ++# if DEFAULT_ARCH64_P ++/* Supported, and the default is -m64 */ ++# define TARGET_CAN_SPLIT_STACK_64BIT 1 ++# else ++/* Supported, and the default is -m32 */ ++# define TARGET_CAN_SPLIT_STACK_64BIT 0 ++# endif ++# endif ++#endif ++ ++#ifndef RS6000_BI_ARCH ++ ++/* 64-bit PowerPC Linux always has a TOC. */ ++#undef TARGET_TOC ++#define TARGET_TOC 1 ++ ++/* Some things from sysv4.h we don't do when 64 bit. */ ++#undef OPTION_RELOCATABLE ++#define OPTION_RELOCATABLE 0 ++#undef OPTION_EABI ++#define OPTION_EABI 0 ++#undef OPTION_PROTOTYPE ++#define OPTION_PROTOTYPE 0 ++#undef RELOCATABLE_NEEDS_FIXUP ++#define RELOCATABLE_NEEDS_FIXUP 0 ++ ++#endif ++ ++// TODO: Need to remove ? ++/* We use glibc _mcount for profiling. */ ++#define NO_PROFILE_COUNTERS 1 ++#define PROFILE_HOOK(LABEL) \ ++ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) ++ ++/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ ++#undef ADJUST_FIELD_ALIGN ++#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ ++ (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ ++ ? 128 \ ++ : (TARGET_64BIT \ ++ && TARGET_ALIGN_NATURAL == 0 \ ++ && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ ++ ? MIN ((COMPUTED), 32) \ ++ : (COMPUTED)) ++ ++/* PowerPC64 Linux increases natural record alignment to doubleword if ++ the first field is an FP double, only if in power alignment mode. */ ++#undef ROUND_TYPE_ALIGN ++#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ ++ ((TARGET_64BIT \ ++ && (TREE_CODE (STRUCT) == RECORD_TYPE \ ++ || TREE_CODE (STRUCT) == UNION_TYPE \ ++ || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ ++ && TARGET_ALIGN_NATURAL == 0) \ ++ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ ++ : MAX ((COMPUTED), (SPECIFIED))) ++ ++/* Use the default for compiling target libs. */ ++#ifdef IN_TARGET_LIBS ++#undef TARGET_ALIGN_NATURAL ++#define TARGET_ALIGN_NATURAL 1 ++#endif ++ ++/* Indicate that jump tables go in the text section. */ ++#undef JUMP_TABLES_IN_TEXT_SECTION ++#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT ++ ++/* The linux ppc64 ABI isn't explicit on whether aggregates smaller ++ than a doubleword should be padded upward or downward. You could ++ reasonably assume that they follow the normal rules for structure ++ layout treating the parameter area as any other block of memory, ++ then map the reg param area to registers. i.e. pad upward. ++ Setting both of the following defines results in this behavior. ++ Setting just the first one will result in aggregates that fit in a ++ doubleword being padded downward, and others being padded upward. ++ Not a bad idea as this results in struct { int x; } being passed ++ the same way as an int. */ ++#define AGGREGATE_PADDING_FIXED TARGET_64BIT ++#define AGGREGATES_PAD_UPWARD_ALWAYS 0 ++ ++/* Specify padding for the last element of a block move between ++ registers and memory. FIRST is nonzero if this is the only ++ element. */ ++#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ ++ (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE)) ++ ++/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit ++ process. */ ++#define OS_MISSING_POWERPC64 !TARGET_64BIT ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ if (TARGET_64BIT) \ ++ { \ ++ builtin_define ("__PPU__"); \ ++ builtin_define ("__PPC__"); \ ++ builtin_define ("__PPC64__"); \ ++ builtin_define ("__lv2ppu__"); \ ++ builtin_define ("__powerpc__"); \ ++ builtin_define ("__powerpc64__"); \ ++ if (!DOT_SYMBOLS) \ ++ builtin_define ("_CALL_LINUX"); \ ++ builtin_assert ("cpu=powerpc64"); \ ++ builtin_assert ("machine=powerpc64"); \ ++ } \ ++ else \ ++ { \ ++ builtin_define_std ("PPC"); \ ++ builtin_define_std ("powerpc"); \ ++ builtin_assert ("cpu=powerpc"); \ ++ builtin_assert ("machine=powerpc"); \ ++ TARGET_OS_SYSV_CPP_BUILTINS (); \ ++ } \ ++ } \ ++ while (0) ++ ++#undef CPP_OS_DEFAULT_SPEC ++#define CPP_OS_DEFAULT_SPEC "%(cpp_os_lv2) %(include_extra)" ++ ++#undef LINK_SHLIB_SPEC ++#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" ++ ++#undef LIB_DEFAULT_SPEC ++#define LIB_DEFAULT_SPEC "%(lib_lv2)" ++ ++#undef STARTFILE_DEFAULT_SPEC ++#define STARTFILE_DEFAULT_SPEC "%(startfile_lv2)" ++ ++#undef ENDFILE_DEFAULT_SPEC ++#define ENDFILE_DEFAULT_SPEC "%(endfile_lv2)" ++ ++#undef LINK_START_DEFAULT_SPEC ++#define LINK_START_DEFAULT_SPEC "%(link_start_lv2)" ++ ++#undef LINK_OS_DEFAULT_SPEC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_lv2)" ++ ++#define LIB_LV2_SPEC "-L %:getenv(PSL1GHT /ppu/lib) --start-group -lsysbase -lc -lrt -llv2 --end-group" ++ ++#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1" ++ ++#define STARTFILE_LV2_SPEC "lv2-crti.o%s crtbegin.o%s lv2-crt0.o%s lv2-sprx.o%s" ++ ++#define ENDFILE_LV2_SPEC "crtend.o%s lv2-crtn.o%s" ++ ++#define LINK_START_LV2_SPEC "-T lv2.ld%s" ++ ++#define LINK_OS_LV2_SPEC32 "-m elf32ppc" ++#define LINK_OS_LV2_SPEC64 "-m elf64ppc" ++ ++#define CPP_OS_LV2_SPEC "-D__lv2ppu__ -ffunction-sections -fdata-sections" ++ ++#undef DEFAULT_ASM_ENDIAN ++#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) ++#define DEFAULT_ASM_ENDIAN " -mlittle" ++#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ ++ " -m elf32lppclinux", \ ++ " -m elf32lppclinux") ++#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ ++ " -m elf64lppc", \ ++ " -m elf64lppc") ++#else ++#define DEFAULT_ASM_ENDIAN " -mbig" ++#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ ++ " -m elf32lppclinux", \ ++ " -m elf32ppclinux") ++#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ ++ " -m elf64lppc", \ ++ " -m elf64ppc") ++#endif ++ ++#undef TOC_SECTION_ASM_OP ++#define TOC_SECTION_ASM_OP \ ++ (TARGET_64BIT \ ++ ? "\t.section\t\".toc\",\"aw\"" \ ++ : "\t.section\t\".got\",\"aw\"") ++ ++#undef MINIMAL_TOC_SECTION_ASM_OP ++#define MINIMAL_TOC_SECTION_ASM_OP \ ++ (TARGET_64BIT \ ++ ? "\t.section\t\".toc1\",\"aw\"" \ ++ : (flag_pic \ ++ ? "\t.section\t\".got2\",\"aw\"" \ ++ : "\t.section\t\".got1\",\"aw\"")) ++ ++/* Must be at least as big as our pointer type. */ ++#undef SIZE_TYPE ++#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") ++ ++#undef PTRDIFF_TYPE ++#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") ++ ++#undef WCHAR_TYPE ++#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") ++#undef WCHAR_TYPE_SIZE ++#define WCHAR_TYPE_SIZE 32 ++ ++#undef RS6000_MCOUNT ++#define RS6000_MCOUNT "_mcount" ++ ++#ifdef __powerpc64__ ++/* _init and _fini functions are built from bits spread across many ++ object files, each potentially with a different TOC pointer. For ++ that reason, place a nop after the call so that the linker can ++ restore the TOC pointer if a TOC adjusting call stub is needed. */ ++#if DOT_SYMBOLS ++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ ++ asm (SECTION_OP "\n" \ ++" bl ." #FUNC "\n" \ ++" nop\n" \ ++" .previous"); ++#else ++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ ++ asm (SECTION_OP "\n" \ ++" bl " #FUNC "\n" \ ++" nop\n" \ ++" .previous"); ++#endif ++#endif ++ ++/* FP save and restore routines. */ ++#undef SAVE_FP_PREFIX ++#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") ++#undef SAVE_FP_SUFFIX ++#define SAVE_FP_SUFFIX "" ++#undef RESTORE_FP_PREFIX ++#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") ++#undef RESTORE_FP_SUFFIX ++#define RESTORE_FP_SUFFIX "" ++ ++/* Dwarf2 debugging. */ ++#undef PREFERRED_DEBUGGING_TYPE ++#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG ++ ++/* This is how to declare the size of a function. */ ++#undef ASM_DECLARE_FUNCTION_SIZE ++#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ ++ do \ ++ { \ ++ if (!flag_inhibit_size_directive) \ ++ { \ ++ fputs ("\t.size\t", (FILE)); \ ++ if (TARGET_64BIT && DOT_SYMBOLS) \ ++ putc ('.', (FILE)); \ ++ assemble_name ((FILE), (FNAME)); \ ++ fputs (",.-", (FILE)); \ ++ rs6000_output_function_entry (FILE, FNAME); \ ++ putc ('\n', (FILE)); \ ++ } \ ++ } \ ++ while (0) ++ ++/* Return nonzero if this entry is to be written into the constant ++ pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF ++ or a CONST containing one of them. If -mfp-in-toc (the default), ++ we also do this for floating-point constants. We actually can only ++ do this if the FP formats of the target and host machines are the ++ same, but we can't check that since not every file that uses ++ the macros includes real.h. We also do this when we can write the ++ entry into the TOC and the entry is not larger than a TOC entry. */ ++ ++#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P ++#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ ++ (TARGET_TOC \ ++ && (GET_CODE (X) == SYMBOL_REF \ ++ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ ++ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \ ++ || GET_CODE (X) == LABEL_REF \ ++ || (GET_CODE (X) == CONST_INT \ ++ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ ++ || (GET_CODE (X) == CONST_DOUBLE \ ++ && ((TARGET_64BIT \ ++ && (TARGET_MINIMAL_TOC \ ++ || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ ++ && ! TARGET_NO_FP_IN_TOC))) \ ++ || (!TARGET_64BIT \ ++ && !TARGET_NO_FP_IN_TOC \ ++ && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ ++ && BITS_PER_WORD == HOST_BITS_PER_INT))))) ++ ++/* Select a format to encode pointers in exception handling data. CODE ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is ++ true if the symbol may be affected by dynamic relocations. */ ++#undef ASM_PREFERRED_EH_DATA_FORMAT ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ ++ (TARGET_64BIT || flag_pic \ ++ ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ ++ | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ ++ : DW_EH_PE_absptr) ++ ++/* For backward compatibility, we must continue to use the AIX ++ structure return convention. */ ++#undef DRAFT_V4_STRUCT_RET ++#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) ++ ++#ifdef TARGET_LIBC_PROVIDES_SSP ++/* ppc32 glibc provides __stack_chk_guard in -0x7008(2), ++ ppc64 glibc provides it at -0x7010(13). */ ++#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) ++#endif ++ ++#define POWERPC_CELL64LV2 ++ ++#define POINTERS_EXTEND_UNSIGNED 1 ++ ++/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */ ++#ifdef TARGET_DEFAULT_LONG_DOUBLE_128 ++#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 ++#endif ++ ++/* Static stack checking is supported by means of probes. */ ++#define STACK_CHECK_STATIC_BUILTIN 1 ++ ++/* The default value isn't sufficient in 64-bit mode. */ ++#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) ++ ++/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends ++ on glibc 2.19 or greater. */ ++#if TARGET_GLIBC_MAJOR > 2 \ ++ || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19) ++#define RS6000_GLIBC_ATOMIC_FENV 1 ++#endif ++ ++/* The IEEE 128-bit emulator is only built on Linux systems. Flag that we ++ should enable the type handling for KFmode on VSX systems even if we are not ++ enabling the __float128 keyword. */ ++#undef TARGET_FLOAT128_ENABLE_TYPE ++#define TARGET_FLOAT128_ENABLE_TYPE 1 +diff '--color=auto' -urN a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c +--- a/gcc/config/rs6000/rs6000.c 2022-05-27 09:21:11.000000000 +0200 ++++ b/gcc/config/rs6000/rs6000.c 2023-01-01 18:00:32.742783224 +0100 +@@ -1424,6 +1424,10 @@ + static bool rs6000_keep_leaf_when_profiled () __attribute__ ((unused)); + static tree rs6000_fold_builtin (tree, int, tree *, bool); + ++#ifdef POWERPC_CELL64LV2 ++static bool rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode); ++#endif ++ + /* Hash table stuff for keeping track of TOC entries. */ + + struct GTY((for_user)) toc_hash_struct +@@ -39732,7 +39736,18 @@ + return id; + } + +- ++#ifdef POWERPC_CELL64LV2 ++#undef TARGET_VALID_POINTER_MODE ++#define TARGET_VALID_POINTER_MODE rs6000_cell64lv2_valid_pointer_mode ++ ++static bool ++rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode mode) ++{ ++ return (mode == SImode || (TARGET_64BIT && mode == DImode) || mode == ptr_mode || mode == Pmode); ++} ++ ++#endif ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-rs6000.h" +diff '--color=auto' -urN a/gcc/config.gcc b/gcc/config.gcc +--- a/gcc/config.gcc 2022-05-27 09:21:10.000000000 +0200 ++++ b/gcc/config.gcc 2023-01-01 14:28:35.684278963 +0100 +@@ -2587,6 +2587,15 @@ + # tmake_file="${tmake_file} rs6000/t-fprules" + # extra_headers= + # ;; ++powerpc64-ps3-elf) ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" ++ tm_file="rs6000/biarch64.h ${tm_file} rs6000/cell64lv2.h" ++ if test x${enable_secureplt} = xyes; then ++ tm_file="rs6000/secureplt.h ${tm_file}" ++ fi ++ extra_options="${extra_options} rs6000/sysv4.opt" ++ tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" ++ ;; + powerpc-*-darwin*) + extra_options="${extra_options} ${cpu_type}/darwin.opt" + case ${target} in +diff '--color=auto' -urN a/gcc/configure b/gcc/configure +--- a/gcc/configure 2022-05-27 09:21:46.000000000 +0200 ++++ b/gcc/configure 2023-01-01 14:52:19.312078588 +0100 +@@ -28944,12 +28944,12 @@ + esac + + case "$target:$tm_file" in +- powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) ++ powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) + case "$target" in + *le-*-linux*) + emul_name="-melf64lppc" + ;; +- *-*-linux*) ++ *-*-linux* | *-ps3-elf*) + emul_name="-melf64ppc" + ;; + *le-*-freebsd*) +diff '--color=auto' -urN a/gcc/configure.ac b/gcc/configure.ac +--- a/gcc/configure.ac 2022-05-27 09:21:11.000000000 +0200 ++++ b/gcc/configure.ac 2023-01-01 14:51:42.742384668 +0100 +@@ -5671,12 +5671,12 @@ + esac + + case "$target:$tm_file" in +- powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) ++ powerpc64*-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) + case "$target" in + *le-*-linux*) + emul_name="-melf64lppc" + ;; +- *-*-linux*) ++ *-*-linux* | *-ps3-elf*) + emul_name="-melf64ppc" + ;; + *le-*-freebsd*) +diff '--color=auto' -urN a/libgcc/config.host b/libgcc/config.host +--- a/libgcc/config.host 2022-05-27 09:21:12.000000000 +0200 ++++ b/libgcc/config.host 2023-01-01 14:29:07.913987821 +0100 +@@ -1134,6 +1134,8 @@ + tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" + extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" + ;; ++powerpc64-ps3-elf) ++ ;; + powerpc*-*-linux*) + tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc" + tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" +diff '--color=auto' -urN a/Makefile.in b/Makefile.in +--- a/Makefile.in 2022-05-27 09:21:10.000000000 +0200 ++++ b/Makefile.in 2023-01-01 14:54:20.241067239 +0100 +@@ -27294,7 +27294,6 @@ + .PHONY: install-libiberty maybe-install-libiberty + maybe-install-libiberty: + @if libiberty +-maybe-install-libiberty: install-libiberty + + install-libiberty: installdirs + @: $(MAKE); $(unstage) diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index ef21f3b61..22aafa443 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # gcc-newlib-SPU.sh by Naomi Peori (naomi@peori.ca) -GCC="gcc-13.2.0" +GCC="gcc-9.5.0" NEWLIB="newlib-1.20.0" if [ ! -d ${GCC} ]; then @@ -15,7 +15,7 @@ if [ ! -d ${GCC} ]; then rm -Rf ${NEWLIB} && tar xfvz ${NEWLIB}.tar.gz ## Patch the source code. - cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} + cat ../patches/${GCC}-PS3-SPU.patch | patch -p1 -d ${GCC} cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} ## Enter the source code directory. @@ -44,18 +44,21 @@ fi cd ${GCC}/build-spu ## Configure the build. +unset CFLAGS CXXFLAGS LDFLAGS ../configure --prefix="$PS3DEV/spu" --target="spu" \ - --disable-dependency-tracking \ - --disable-libcc1 \ - --disable-libssp \ - --disable-multilib \ - --disable-nls \ - --disable-shared \ - --disable-win32-registry \ - --enable-languages="c,c++" \ - --enable-lto \ - --enable-threads \ - --with-newlib + --enable-languages="c" \ + --enable-lto \ + --enable-threads \ + --enable-newlib-multithread \ + --enable-newlib-hw-fp \ + --enable-obsolete \ + --disable-dependency-tracking \ + --disable-libcc1 \ + --disable-libssp \ + --disable-multilib \ + --disable-nls \ + --disable-shared \ + --disable-win32-registry ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? From 3445df8e26f747e77d06b20ae28076eb8933b5f2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 00:18:53 -0300 Subject: [PATCH 011/159] ppu only for c lang --- scripts/002-gcc-newlib-PPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 942ac8904..8b74ef551 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -52,7 +52,7 @@ CXXFLAGS="$CXXFLAGS -Werror=format-security" --with-cpu="cell" \ --with-newlib \ --with-system-zlib \ - --enable-languages="c,c++" \ + --enable-languages="c" \ --enable-long-double-128 \ --enable-lto \ --enable-threads \ From 319554bbf82bcae8cdb2e8c3078146b0809600aa Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 02:24:37 -0300 Subject: [PATCH 012/159] [ppu] add c++ --- scripts/002-gcc-newlib-PPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 8b74ef551..942ac8904 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -52,7 +52,7 @@ CXXFLAGS="$CXXFLAGS -Werror=format-security" --with-cpu="cell" \ --with-newlib \ --with-system-zlib \ - --enable-languages="c" \ + --enable-languages="c,c++" \ --enable-long-double-128 \ --enable-lto \ --enable-threads \ From c48e4e12227a3717f46587a06d9b19badac905e3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 02:25:00 -0300 Subject: [PATCH 013/159] [ppu] fix for _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE=0 --- scripts/002-gcc-newlib-PPU.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 942ac8904..5d77adeec 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -45,6 +45,9 @@ cd ${GCC}/build-ppu ## Configure the build. +## TODO - Move it to patch file +sed -i 's/#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1/#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 0/' powerpc64-ps3-elf/libstdc++-v3/include/powerpc64-ps3-elf/bits/c++config.h + # Avoid breakage CFLAGS="$CFLAGS -Werror=format-security" CXXFLAGS="$CXXFLAGS -Werror=format-security" From 6c44881b0f1dbbd031b7bc06a7ae3c73284852d5 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 03:31:54 -0300 Subject: [PATCH 014/159] [ppu] HAVE_STRUCT_DIRENT_D_TYPE=0 --- scripts/002-gcc-newlib-PPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 5d77adeec..e6d69c626 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -46,7 +46,7 @@ cd ${GCC}/build-ppu ## Configure the build. ## TODO - Move it to patch file -sed -i 's/#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 1/#define _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE 0/' powerpc64-ps3-elf/libstdc++-v3/include/powerpc64-ps3-elf/bits/c++config.h +sed -i 's/AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1/AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 0/' ../libstdc++-v3/acinclude.m4 # Avoid breakage CFLAGS="$CFLAGS -Werror=format-security" From 5af633b61503695ace38d91abee9af07ef1e26ca Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 12:54:15 -0300 Subject: [PATCH 015/159] [ppu] HAVE_STRUCT_DIRENT_D_TYPE=0 --- scripts/002-gcc-newlib-PPU.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index e6d69c626..d75fcbe29 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -45,8 +45,6 @@ cd ${GCC}/build-ppu ## Configure the build. -## TODO - Move it to patch file -sed -i 's/AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1/AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 0/' ../libstdc++-v3/acinclude.m4 # Avoid breakage CFLAGS="$CFLAGS -Werror=format-security" @@ -68,6 +66,9 @@ CXXFLAGS="$CXXFLAGS -Werror=format-security" --disable-shared \ --disable-win32-registry +## TODO - Move it to patch file +sed -i 's/ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE/if 0/' ../libstdc++-v3/src/filesystem/dir-common.h + ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? if [ ! -z $ret ]; then PROCS=4; fi From 5e818ab5ecf02bbc99fc9c9128123db9730542ba Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 15:02:29 -0300 Subject: [PATCH 016/159] spu-gcc 7.20 --- ...-PS3.patch => binutils-2.22-PS3-SPU.patch} | 0 patches/binutils-2.42-PS3-PPU.patch | 75 ++ patches/gcc-7.2.0-PS3.patch | 727 ++++++++++++++++++ scripts/001-binutils-PPU.sh | 5 +- scripts/005-binutils-SPU.sh | 5 +- scripts/006-gcc-newlib-SPU.sh | 4 +- 6 files changed, 810 insertions(+), 6 deletions(-) rename patches/{binutils-2.22-PS3.patch => binutils-2.22-PS3-SPU.patch} (100%) create mode 100644 patches/binutils-2.42-PS3-PPU.patch create mode 100644 patches/gcc-7.2.0-PS3.patch diff --git a/patches/binutils-2.22-PS3.patch b/patches/binutils-2.22-PS3-SPU.patch similarity index 100% rename from patches/binutils-2.22-PS3.patch rename to patches/binutils-2.22-PS3-SPU.patch diff --git a/patches/binutils-2.42-PS3-PPU.patch b/patches/binutils-2.42-PS3-PPU.patch new file mode 100644 index 000000000..e90893b99 --- /dev/null +++ b/patches/binutils-2.42-PS3-PPU.patch @@ -0,0 +1,75 @@ +# Original from https://github.com/ps3dev/ps3toolchain +# Updated for binutils 2.40 by Darjan Krijan [https://disc-kuraudo.eu] +diff '--color=auto' -urN a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh +--- a/ld/emulparams/elf32_spu.sh 2022-07-08 11:46:48.000000000 +0200 ++++ b/ld/emulparams/elf32_spu.sh 2023-01-04 22:15:19.310575828 +0100 +@@ -6,6 +6,8 @@ + ARCH=spu + MACHINE= + ALIGNMENT=16 ++GENERATE_PIE_SCRIPT=yes ++GENERATE_COMBRELOC_SCRIPT=yes + TEXT_START_ADDR=0 + INITIAL_READONLY_SECTIONS='.interrupt : { KEEP(*(.interrupt)) }' + if test -z "${CREATE_SHLIB}"; then +diff '--color=auto' -urN a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em +--- a/ld/emultempl/spuelf.em 2022-07-08 11:46:48.000000000 +0200 ++++ b/ld/emultempl/spuelf.em 2023-01-04 22:17:32.998687355 +0100 +@@ -258,6 +258,14 @@ + return total; + } + ++static void ++spu_before_parse (void) ++{ ++ gld${EMULATION_NAME}_before_parse (); ++ ++ config.has_pie = `if test -n "$GENERATE_PIE_SCRIPT" ; then echo true ; else echo false ; fi`; ++} ++ + /* Go find if we need to do anything special for overlays. */ + + static void +@@ -851,5 +859,6 @@ + + LDEMUL_AFTER_OPEN=spu_after_open + LDEMUL_BEFORE_ALLOCATION=spu_before_allocation ++LDEMUL_BEFORE_PARSE=spu_before_parse + LDEMUL_FINISH=gld${EMULATION_NAME}_finish + LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target +diff '--color=auto' -urN a/ld/ld.h b/ld/ld.h +--- a/ld/ld.h 2022-07-08 11:46:48.000000000 +0200 ++++ b/ld/ld.h 2023-01-04 22:24:33.832738444 +0100 +@@ -229,6 +229,9 @@ + parameter. */ + bool has_shared; + ++ /* If TRUE, -pie is supported. */ ++ bool has_pie; ++ + /* If TRUE, build constructors. */ + bool build_constructors; + +diff '--color=auto' -urN a/ld/ldmain.c b/ld/ldmain.c +--- a/ld/ldmain.c 2022-07-08 11:46:48.000000000 +0200 ++++ b/ld/ldmain.c 2023-01-04 22:16:46.319346843 +0100 +@@ -315,6 +315,7 @@ + config.make_executable = true; + config.magic_demand_paged = true; + config.text_read_only = true; ++ config.has_pie = false; + config.print_map_discarded = true; + link_info.disable_target_specific_optimizations = -1; + +diff '--color=auto' -urN a/ld/lexsup.c b/ld/lexsup.c +--- a/ld/lexsup.c 2022-07-08 11:46:48.000000000 +0200 ++++ b/ld/lexsup.c 2023-01-04 22:17:19.218882047 +0100 +@@ -1286,6 +1286,8 @@ + if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET) + link_info.unresolved_syms_in_shared_libs = RM_IGNORE; + } ++ else if (config.has_pie) ++ link_info.type = type_pie; + else + einfo (_("%F%P: -shared not supported\n")); + break; diff --git a/patches/gcc-7.2.0-PS3.patch b/patches/gcc-7.2.0-PS3.patch new file mode 100644 index 000000000..28be00208 --- /dev/null +++ b/patches/gcc-7.2.0-PS3.patch @@ -0,0 +1,727 @@ +diff --git a/Makefile.in b/Makefile.in +index b824e0a0c..5bf0da25e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -25734,7 +25734,6 @@ check-libiberty: + .PHONY: install-libiberty maybe-install-libiberty + maybe-install-libiberty: + @if libiberty +-maybe-install-libiberty: install-libiberty + + install-libiberty: installdirs + @: $(MAKE); $(unstage) +diff --git a/gcc/config.gcc b/gcc/config.gcc +index a9196cd26..f2a94403d 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2330,6 +2330,15 @@ pdp11-*-*) + # tmake_file="${tmake_file} rs6000/t-fprules" + # extra_headers= + # ;; ++powerpc64-ps3-elf) ++ tm_file="${tm_file} dbxelf.h elfos.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" ++ tm_file="rs6000/biarch64.h ${tm_file} rs6000/cell64lv2.h" ++ if test x${enable_secureplt} = xyes; then ++ tm_file="rs6000/secureplt.h ${tm_file}" ++ fi ++ extra_options="${extra_options} rs6000/sysv4.opt" ++ tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" ++ ;; + powerpc-*-darwin*) + extra_options="${extra_options} rs6000/darwin.opt" + case ${target} in +diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h +new file mode 100644 +index 000000000..86da868b5 +--- /dev/null ++++ b/gcc/config/rs6000/cell64lv2.h +@@ -0,0 +1,587 @@ ++/* Definitions of target machine for GNU compiler, ++ for 64 bit PowerPC linux. ++ Copyright (C) 2000-2017 Free Software Foundation, Inc. ++ ++ This file is part of GCC. ++ ++ GCC is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License as published ++ by the Free Software Foundation; either version 3, or (at your ++ option) any later version. ++ ++ GCC is distributed in the hope that it will be useful, but WITHOUT ++ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ++ License for more details. ++ ++ Under Section 7 of GPL version 3, you are granted additional ++ permissions described in the GCC Runtime Library Exception, version ++ 3.1, as published by the Free Software Foundation. ++ ++ You should have received a copy of the GNU General Public License and ++ a copy of the GCC Runtime Library Exception along with this program; ++ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++ . */ ++ ++#ifndef RS6000_BI_ARCH ++ ++#undef TARGET_64BIT ++#define TARGET_64BIT 1 ++ ++#define DEFAULT_ARCH64_P 1 ++#define RS6000_BI_ARCH_P 0 ++ ++#else ++ ++#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT) ++#define RS6000_BI_ARCH_P 1 ++ ++#endif ++ ++#ifdef IN_LIBGCC2 ++#undef TARGET_64BIT ++#ifdef __powerpc64__ ++#define TARGET_64BIT 1 ++#else ++#define TARGET_64BIT 0 ++#endif ++#endif ++ ++#undef TARGET_AIX ++#define TARGET_AIX TARGET_64BIT ++ ++#ifdef HAVE_LD_NO_DOT_SYMS ++/* New ABI uses a local sym for the function entry point. */ ++extern int dot_symbols; ++#undef DOT_SYMBOLS ++#define DOT_SYMBOLS dot_symbols ++#endif ++ ++#undef TARGET_KEEP_LEAF_WHEN_PROFILED ++#define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled ++ ++#define TARGET_USES_LINUX64_OPT 1 ++#ifdef HAVE_LD_LARGE_TOC ++#undef TARGET_CMODEL ++#define TARGET_CMODEL rs6000_current_cmodel ++#define SET_CMODEL(opt) rs6000_current_cmodel = opt ++#else ++#define SET_CMODEL(opt) do {} while (0) ++#endif ++ ++#undef PROCESSOR_DEFAULT ++#define PROCESSOR_DEFAULT PROCESSOR_CELL ++#undef PROCESSOR_DEFAULT64 ++#define PROCESSOR_DEFAULT64 PROCESSOR_CELL ++ ++/* We don't need to generate entries in .fixup, except when ++ -mrelocatable or -mrelocatable-lib is given. */ ++#undef RELOCATABLE_NEEDS_FIXUP ++#define RELOCATABLE_NEEDS_FIXUP \ ++ (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE) ++ ++#undef RS6000_ABI_NAME ++#define RS6000_ABI_NAME "linux" ++ ++#define INVALID_64BIT "-m%s not supported in this configuration" ++#define INVALID_32BIT INVALID_64BIT ++ ++#ifdef LINUX64_DEFAULT_ABI_ELFv2 ++#define ELFv2_ABI_CHECK (rs6000_elf_abi != 1) ++#else ++#define ELFv2_ABI_CHECK (rs6000_elf_abi == 2) ++#endif ++ ++#undef SUBSUBTARGET_OVERRIDE_OPTIONS ++#define SUBSUBTARGET_OVERRIDE_OPTIONS \ ++ do \ ++ { \ ++ if (!global_options_set.x_rs6000_alignment_flags) \ ++ rs6000_alignment_flags = MASK_ALIGN_NATURAL; \ ++ if (rs6000_isa_flags & OPTION_MASK_64BIT) \ ++ { \ ++ if (DEFAULT_ABI != ABI_AIX) \ ++ { \ ++ rs6000_current_abi = ABI_AIX; \ ++ error (INVALID_64BIT, "call"); \ ++ } \ ++ dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \ ++ if (ELFv2_ABI_CHECK) \ ++ { \ ++ rs6000_current_abi = ABI_ELFv2; \ ++ if (dot_symbols) \ ++ error ("-mcall-aixdesc incompatible with -mabi=elfv2"); \ ++ } \ ++ if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ ++ { \ ++ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ ++ error (INVALID_64BIT, "relocatable"); \ ++ } \ ++ if (rs6000_isa_flags & OPTION_MASK_EABI) \ ++ { \ ++ rs6000_isa_flags &= ~OPTION_MASK_EABI; \ ++ error (INVALID_64BIT, "eabi"); \ ++ } \ ++ if (TARGET_PROTOTYPE) \ ++ { \ ++ target_prototype = 0; \ ++ error (INVALID_64BIT, "prototype"); \ ++ } \ ++ if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \ ++ { \ ++ rs6000_isa_flags |= OPTION_MASK_POWERPC64; \ ++ error ("-m64 requires a PowerPC64 cpu"); \ ++ } \ ++ if ((rs6000_isa_flags_explicit \ ++ & OPTION_MASK_MINIMAL_TOC) != 0) \ ++ { \ ++ if (global_options_set.x_rs6000_current_cmodel \ ++ && rs6000_current_cmodel != CMODEL_SMALL) \ ++ error ("-mcmodel incompatible with other toc options"); \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ } \ ++ else \ ++ { \ ++ if (!global_options_set.x_rs6000_current_cmodel) \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ if (rs6000_current_cmodel != CMODEL_SMALL) \ ++ { \ ++ if (!global_options_set.x_TARGET_NO_FP_IN_TOC) \ ++ TARGET_NO_FP_IN_TOC \ ++ = rs6000_current_cmodel == CMODEL_MEDIUM; \ ++ if (!global_options_set.x_TARGET_NO_SUM_IN_TOC) \ ++ TARGET_NO_SUM_IN_TOC = 0; \ ++ } \ ++ } \ ++ } \ ++ else \ ++ { \ ++ if (!RS6000_BI_ARCH_P) \ ++ error (INVALID_32BIT, "32"); \ ++ if (global_options_set.x_rs6000_current_cmodel) \ ++ { \ ++ SET_CMODEL (CMODEL_SMALL); \ ++ error (INVALID_32BIT, "cmodel"); \ ++ } \ ++ } \ ++ } \ ++ while (0) ++ ++#undef ASM_DEFAULT_SPEC ++#undef ASM_SPEC ++#undef LINK_SECURE_PLT_SPEC ++ ++#ifndef RS6000_BI_ARCH ++#define ASM_DEFAULT_SPEC "-mcell" ++#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%(link_os_lv2_spec64)" ++#define LINK_SECURE_PLT_SPEC "" ++#else ++#if DEFAULT_ARCH64_P ++#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" ++#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%{m32:%(link_os_lv2_spec32)}%{!m32:%(link_os_lv2_spec64)}" ++#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}" ++#else ++#define ASM_DEFAULT_SPEC "-mppc%{m64:64}" ++#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" ++#define LINK_OS_LV2_SPEC "%{!m64:%(link_os_lv2_spec32)}%{m64:%(link_os_lv2_spec64)}" ++#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}" ++#endif ++#endif ++ ++#define ASM_SPEC32 "-a32 \ ++%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ ++%{memb|msdata=eabi: -memb}" ++ ++#define ASM_SPEC64 "-a64" ++ ++#define ASM_SPEC_COMMON "%(asm_cpu) \ ++%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ ++ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) ++ ++#undef SUBSUBTARGET_EXTRA_SPECS ++#define SUBSUBTARGET_EXTRA_SPECS \ ++ { "asm_spec_common", ASM_SPEC_COMMON }, \ ++ { "asm_spec32", ASM_SPEC32 }, \ ++ { "asm_spec64", ASM_SPEC64 }, \ ++ { "link_os_lv2_spec32", LINK_OS_LV2_SPEC32 }, \ ++ { "link_os_lv2_spec64", LINK_OS_LV2_SPEC64 }, \ ++ { "lib_lv2", LIB_LV2_SPEC }, \ ++ { "startfile_lv2", STARTFILE_LV2_SPEC }, \ ++ { "endfile_lv2", ENDFILE_LV2_SPEC }, \ ++ { "link_start_lv2", LINK_START_LV2_SPEC }, \ ++ { "link_os_lv2", LINK_OS_LV2_SPEC }, \ ++ { "cpp_os_lv2", CPP_OS_LV2_SPEC }, \ ++ { "link_os_extra_spec32", LINK_OS_EXTRA_SPEC32 }, \ ++ { "link_os_extra_spec64", LINK_OS_EXTRA_SPEC64 }, \ ++ { "link_os_new_dtags", LINK_OS_NEW_DTAGS_SPEC }, \ ++ { "include_extra", INCLUDE_EXTRA_SPEC }, \ ++ { "dynamic_linker_prefix", DYNAMIC_LINKER_PREFIX } ++ ++/* Optional specs used for overriding the system include directory, default ++ -rpath links, and prefix for the dynamic linker. Normally, there are not ++ defined, but if the user configure with the --with-advance-toolchain= ++ option, the advance-toolchain.h file will override these. */ ++#ifndef INCLUDE_EXTRA_SPEC ++#define INCLUDE_EXTRA_SPEC "" ++#endif ++ ++#ifndef LINK_OS_EXTRA_SPEC32 ++#define LINK_OS_EXTRA_SPEC32 "" ++#endif ++ ++#ifndef LINK_OS_EXTRA_SPEC64 ++#define LINK_OS_EXTRA_SPEC64 "" ++#endif ++ ++#ifndef LINK_OS_NEW_DTAGS_SPEC ++#define LINK_OS_NEW_DTAGS_SPEC "" ++#endif ++ ++#ifndef DYNAMIC_LINKER_PREFIX ++#define DYNAMIC_LINKER_PREFIX "" ++#endif ++ ++#undef MULTILIB_DEFAULTS ++#if DEFAULT_ARCH64_P ++#define MULTILIB_DEFAULTS { "m64" } ++#else ++#define MULTILIB_DEFAULTS { "m32" } ++#endif ++ ++/* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ ++#if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018 ++# ifndef RS6000_BI_ARCH ++# define TARGET_CAN_SPLIT_STACK ++# else ++# if DEFAULT_ARCH64_P ++/* Supported, and the default is -m64 */ ++# define TARGET_CAN_SPLIT_STACK_64BIT 1 ++# else ++/* Supported, and the default is -m32 */ ++# define TARGET_CAN_SPLIT_STACK_64BIT 0 ++# endif ++# endif ++#endif ++ ++#ifndef RS6000_BI_ARCH ++ ++/* 64-bit PowerPC Linux always has a TOC. */ ++#undef TARGET_TOC ++#define TARGET_TOC 1 ++ ++/* Some things from sysv4.h we don't do when 64 bit. */ ++#undef OPTION_RELOCATABLE ++#define OPTION_RELOCATABLE 0 ++#undef OPTION_EABI ++#define OPTION_EABI 0 ++#undef OPTION_PROTOTYPE ++#define OPTION_PROTOTYPE 0 ++#undef RELOCATABLE_NEEDS_FIXUP ++#define RELOCATABLE_NEEDS_FIXUP 0 ++ ++#endif ++ ++// TODO: Need to remove ? ++/* We use glibc _mcount for profiling. */ ++#define NO_PROFILE_COUNTERS 1 ++#define PROFILE_HOOK(LABEL) \ ++ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) ++ ++/* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ ++#undef ADJUST_FIELD_ALIGN ++#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ ++ (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ ++ ? 128 \ ++ : (TARGET_64BIT \ ++ && TARGET_ALIGN_NATURAL == 0 \ ++ && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ ++ ? MIN ((COMPUTED), 32) \ ++ : (COMPUTED)) ++ ++/* PowerPC64 Linux increases natural record alignment to doubleword if ++ the first field is an FP double, only if in power alignment mode. */ ++#undef ROUND_TYPE_ALIGN ++#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ ++ ((TARGET_64BIT \ ++ && (TREE_CODE (STRUCT) == RECORD_TYPE \ ++ || TREE_CODE (STRUCT) == UNION_TYPE \ ++ || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ ++ && TARGET_ALIGN_NATURAL == 0) \ ++ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ ++ : MAX ((COMPUTED), (SPECIFIED))) ++ ++/* Use the default for compiling target libs. */ ++#ifdef IN_TARGET_LIBS ++#undef TARGET_ALIGN_NATURAL ++#define TARGET_ALIGN_NATURAL 1 ++#endif ++ ++/* Indicate that jump tables go in the text section. */ ++#undef JUMP_TABLES_IN_TEXT_SECTION ++#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT ++ ++/* The linux ppc64 ABI isn't explicit on whether aggregates smaller ++ than a doubleword should be padded upward or downward. You could ++ reasonably assume that they follow the normal rules for structure ++ layout treating the parameter area as any other block of memory, ++ then map the reg param area to registers. i.e. pad upward. ++ Setting both of the following defines results in this behavior. ++ Setting just the first one will result in aggregates that fit in a ++ doubleword being padded downward, and others being padded upward. ++ Not a bad idea as this results in struct { int x; } being passed ++ the same way as an int. */ ++#define AGGREGATE_PADDING_FIXED TARGET_64BIT ++#define AGGREGATES_PAD_UPWARD_ALWAYS 0 ++ ++/* Specify padding for the last element of a block move between ++ registers and memory. FIRST is nonzero if this is the only ++ element. */ ++#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ ++ (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE)) ++ ++/* Linux doesn't support saving and restoring 64-bit regs in a 32-bit ++ process. */ ++#define OS_MISSING_POWERPC64 !TARGET_64BIT ++ ++#undef TARGET_OS_CPP_BUILTINS ++#define TARGET_OS_CPP_BUILTINS() \ ++ do \ ++ { \ ++ if (TARGET_64BIT) \ ++ { \ ++ builtin_define ("__PPU__"); \ ++ builtin_define ("__PPC__"); \ ++ builtin_define ("__PPC64__"); \ ++ builtin_define ("__lv2ppu__"); \ ++ builtin_define ("__powerpc__"); \ ++ builtin_define ("__powerpc64__"); \ ++ if (!DOT_SYMBOLS) \ ++ builtin_define ("_CALL_LINUX"); \ ++ builtin_assert ("cpu=powerpc64"); \ ++ builtin_assert ("machine=powerpc64"); \ ++ } \ ++ else \ ++ { \ ++ builtin_define_std ("PPC"); \ ++ builtin_define_std ("powerpc"); \ ++ builtin_assert ("cpu=powerpc"); \ ++ builtin_assert ("machine=powerpc"); \ ++ TARGET_OS_SYSV_CPP_BUILTINS (); \ ++ } \ ++ } \ ++ while (0) ++ ++#undef CPP_OS_DEFAULT_SPEC ++#define CPP_OS_DEFAULT_SPEC "%(cpp_os_lv2) %(include_extra)" ++ ++#undef LINK_SHLIB_SPEC ++#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" ++ ++#undef LIB_DEFAULT_SPEC ++#define LIB_DEFAULT_SPEC "%(lib_lv2)" ++ ++#undef STARTFILE_DEFAULT_SPEC ++#define STARTFILE_DEFAULT_SPEC "%(startfile_lv2)" ++ ++#undef ENDFILE_DEFAULT_SPEC ++#define ENDFILE_DEFAULT_SPEC "%(endfile_lv2)" ++ ++#undef LINK_START_DEFAULT_SPEC ++#define LINK_START_DEFAULT_SPEC "%(link_start_lv2)" ++ ++#undef LINK_OS_DEFAULT_SPEC ++#define LINK_OS_DEFAULT_SPEC "%(link_os_lv2)" ++ ++#define LIB_LV2_SPEC "-L %:getenv(PSL1GHT /ppu/lib) --start-group -lsysbase -lc -lrt -llv2 --end-group" ++ ++#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1" ++ ++#define STARTFILE_LV2_SPEC "lv2-crti.o%s crtbegin.o%s lv2-crt0.o%s lv2-sprx.o%s" ++ ++#define ENDFILE_LV2_SPEC "crtend.o%s lv2-crtn.o%s" ++ ++#define LINK_START_LV2_SPEC "-T lv2.ld%s" ++ ++#define LINK_OS_LV2_SPEC32 "-m elf32ppc" ++#define LINK_OS_LV2_SPEC64 "-m elf64ppc" ++ ++#define CPP_OS_LV2_SPEC "-D__lv2ppu__ -ffunction-sections -fdata-sections" ++ ++#undef DEFAULT_ASM_ENDIAN ++#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) ++#define DEFAULT_ASM_ENDIAN " -mlittle" ++#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ ++ " -m elf32lppclinux", \ ++ " -m elf32lppclinux") ++#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ ++ " -m elf64lppc", \ ++ " -m elf64lppc") ++#else ++#define DEFAULT_ASM_ENDIAN " -mbig" ++#define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux", \ ++ " -m elf32lppclinux", \ ++ " -m elf32ppclinux") ++#define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc", \ ++ " -m elf64lppc", \ ++ " -m elf64ppc") ++#endif ++ ++#undef TOC_SECTION_ASM_OP ++#define TOC_SECTION_ASM_OP \ ++ (TARGET_64BIT \ ++ ? "\t.section\t\".toc\",\"aw\"" \ ++ : "\t.section\t\".got\",\"aw\"") ++ ++#undef MINIMAL_TOC_SECTION_ASM_OP ++#define MINIMAL_TOC_SECTION_ASM_OP \ ++ (TARGET_64BIT \ ++ ? "\t.section\t\".toc1\",\"aw\"" \ ++ : (flag_pic \ ++ ? "\t.section\t\".got2\",\"aw\"" \ ++ : "\t.section\t\".got1\",\"aw\"")) ++ ++/* Must be at least as big as our pointer type. */ ++#undef SIZE_TYPE ++#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") ++ ++#undef PTRDIFF_TYPE ++#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") ++ ++#undef WCHAR_TYPE ++#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") ++#undef WCHAR_TYPE_SIZE ++#define WCHAR_TYPE_SIZE 32 ++ ++#undef RS6000_MCOUNT ++#define RS6000_MCOUNT "_mcount" ++ ++#ifdef __powerpc64__ ++/* _init and _fini functions are built from bits spread across many ++ object files, each potentially with a different TOC pointer. For ++ that reason, place a nop after the call so that the linker can ++ restore the TOC pointer if a TOC adjusting call stub is needed. */ ++#if DOT_SYMBOLS ++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ ++ asm (SECTION_OP "\n" \ ++" bl ." #FUNC "\n" \ ++" nop\n" \ ++" .previous"); ++#else ++#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ ++ asm (SECTION_OP "\n" \ ++" bl " #FUNC "\n" \ ++" nop\n" \ ++" .previous"); ++#endif ++#endif ++ ++/* FP save and restore routines. */ ++#undef SAVE_FP_PREFIX ++#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") ++#undef SAVE_FP_SUFFIX ++#define SAVE_FP_SUFFIX "" ++#undef RESTORE_FP_PREFIX ++#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") ++#undef RESTORE_FP_SUFFIX ++#define RESTORE_FP_SUFFIX "" ++ ++/* Dwarf2 debugging. */ ++#undef PREFERRED_DEBUGGING_TYPE ++#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG ++ ++/* This is how to declare the size of a function. */ ++#undef ASM_DECLARE_FUNCTION_SIZE ++#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ ++ do \ ++ { \ ++ if (!flag_inhibit_size_directive) \ ++ { \ ++ fputs ("\t.size\t", (FILE)); \ ++ if (TARGET_64BIT && DOT_SYMBOLS) \ ++ putc ('.', (FILE)); \ ++ assemble_name ((FILE), (FNAME)); \ ++ fputs (",.-", (FILE)); \ ++ rs6000_output_function_entry (FILE, FNAME); \ ++ putc ('\n', (FILE)); \ ++ } \ ++ } \ ++ while (0) ++ ++/* Return nonzero if this entry is to be written into the constant ++ pool in a special way. We do so if this is a SYMBOL_REF, LABEL_REF ++ or a CONST containing one of them. If -mfp-in-toc (the default), ++ we also do this for floating-point constants. We actually can only ++ do this if the FP formats of the target and host machines are the ++ same, but we can't check that since not every file that uses ++ the macros includes real.h. We also do this when we can write the ++ entry into the TOC and the entry is not larger than a TOC entry. */ ++ ++#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P ++#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ ++ (TARGET_TOC \ ++ && (GET_CODE (X) == SYMBOL_REF \ ++ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ ++ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \ ++ || GET_CODE (X) == LABEL_REF \ ++ || (GET_CODE (X) == CONST_INT \ ++ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ ++ || (GET_CODE (X) == CONST_DOUBLE \ ++ && ((TARGET_64BIT \ ++ && (TARGET_MINIMAL_TOC \ ++ || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ ++ && ! TARGET_NO_FP_IN_TOC))) \ ++ || (!TARGET_64BIT \ ++ && !TARGET_NO_FP_IN_TOC \ ++ && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ ++ && BITS_PER_WORD == HOST_BITS_PER_INT))))) ++ ++/* Select a format to encode pointers in exception handling data. CODE ++ is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is ++ true if the symbol may be affected by dynamic relocations. */ ++#undef ASM_PREFERRED_EH_DATA_FORMAT ++#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ ++ (TARGET_64BIT || flag_pic \ ++ ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ ++ | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ ++ : DW_EH_PE_absptr) ++ ++/* For backward compatibility, we must continue to use the AIX ++ structure return convention. */ ++#undef DRAFT_V4_STRUCT_RET ++#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) ++ ++#ifdef TARGET_LIBC_PROVIDES_SSP ++/* ppc32 glibc provides __stack_chk_guard in -0x7008(2), ++ ppc64 glibc provides it at -0x7010(13). */ ++#define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) ++#endif ++ ++#define POWERPC_CELL64LV2 ++ ++#define POINTERS_EXTEND_UNSIGNED 1 ++ ++/* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later. */ ++#ifdef TARGET_DEFAULT_LONG_DOUBLE_128 ++#define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128 ++#endif ++ ++/* Static stack checking is supported by means of probes. */ ++#define STACK_CHECK_STATIC_BUILTIN 1 ++ ++/* The default value isn't sufficient in 64-bit mode. */ ++#define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024) ++ ++/* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends ++ on glibc 2.19 or greater. */ ++#if TARGET_GLIBC_MAJOR > 2 \ ++ || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19) ++#define RS6000_GLIBC_ATOMIC_FENV 1 ++#endif ++ ++/* The IEEE 128-bit emulator is only built on Linux systems. Flag that we ++ should enable the type handling for KFmode on VSX systems even if we are not ++ enabling the __float128 keyword. */ ++#undef TARGET_FLOAT128_ENABLE_TYPE ++#define TARGET_FLOAT128_ENABLE_TYPE 1 +diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c +index db9136f26..3a29d4723 100644 +--- a/gcc/config/rs6000/rs6000.c ++++ b/gcc/config/rs6000/rs6000.c +@@ -1349,6 +1349,12 @@ rtl_opt_pass *make_pass_analyze_swaps (gcc::context*); + static bool rs6000_keep_leaf_when_profiled () __attribute__ ((unused)); + static tree rs6000_fold_builtin (tree, int, tree *, bool); + ++#ifdef POWERPC_CELL64LV2 ++ ++static bool rs6000_cell64lv2_valid_pointer_mode(enum machine_mode); ++ ++#endif ++ + /* Hash table stuff for keeping track of TOC entries. */ + + struct GTY((for_user)) toc_hash_struct +@@ -43333,7 +43339,19 @@ rs6000_optab_supported_p (int op, machine_mode mode1, machine_mode, + return true; + } + } +- ++ ++#ifdef POWERPC_CELL64LV2 ++ ++#undef TARGET_VALID_POINTER_MODE ++#define TARGET_VALID_POINTER_MODE rs6000_cell64lv2_valid_pointer_mode ++ ++static bool rs6000_cell64lv2_valid_pointer_mode(enum machine_mode mode) ++{ ++ return (mode == SImode || (TARGET_64BIT && mode == DImode) || mode == ptr_mode || mode == Pmode); ++} ++ ++#endif ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-rs6000.h" +diff --git a/gcc/configure b/gcc/configure +index 50ccc2a0f..6b503988a 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -28598,12 +28598,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h + esac + + case "$target:$tm_file" in +- powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) ++ powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) + case "$target" in + *le-*-linux*) + emul_name="-melf64lppc" + ;; +- *-*-linux*) ++ *-*-linux* | *-ps3-elf*) + emul_name="-melf64ppc" + ;; + *-*-freebsd*) +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 1d5a9d7c6..e568cb3f8 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5462,12 +5462,12 @@ EOF + esac + + case "$target:$tm_file" in +- powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc*-*-linux*rs6000/biarch64.h*) ++ powerpc64-*-freebsd* | powerpc64*-*-linux* | powerpc64-ps3-elf* | powerpc*-*-linux*rs6000/biarch64.h*) + case "$target" in + *le-*-linux*) + emul_name="-melf64lppc" + ;; +- *-*-linux*) ++ *-*-linux* | *-ps3-elf*) + emul_name="-melf64ppc" + ;; + *-*-freebsd*) +diff --git a/libcpp/lex.c b/libcpp/lex.c +index 9edd2a6af..15585ff93 100644 +--- a/libcpp/lex.c ++++ b/libcpp/lex.c +@@ -568,7 +568,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED) + { + vc m_nl, m_cr, m_bs, m_qm; + +- data = *((const vc *)s); ++ data = __builtin_vec_vsx_ld (0, s); + s += 16; + + m_nl = (vc) __builtin_vec_cmpeq(data, repl_nl); +diff --git a/libgcc/config.host b/libgcc/config.host +index bedcf1017..8d6c8feff 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -1043,6 +1043,8 @@ powerpc-*-rtems*) + tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" + extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" + ;; ++powerpc64-ps3-elf) ++ ;; + powerpc*-*-linux*) + tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc" + tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index 14e295cff..75b932fb1 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # binutils-PPU.sh by Naomi Peori (naomi@peori.ca) -BINUTILS="binutils-2.22" +BINUTILS="binutils-2.24" if [ ! -d ${BINUTILS} ]; then @@ -16,7 +16,7 @@ if [ ! -d ${BINUTILS} ]; then tar xfvj ${BINUTILS}.tar.bz2 ## Patch the source code. - cat ../patches/${BINUTILS}-PS3.patch | patch -p1 -d ${BINUTILS} + cat ../patches/${BINUTILS}-PS3-PPU.patch | patch -p1 -d ${BINUTILS} ## Replace config.guess and config.sub cp config.guess config.sub ${BINUTILS} @@ -41,6 +41,7 @@ cd ${BINUTILS}/build-ppu --disable-dependency-tracking \ --disable-werror \ --enable-64-bit-bfd \ + --enable-lto \ --with-gcc \ --with-gnu-as \ --with-gnu-ld diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index 0c993d411..11524598c 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -16,7 +16,7 @@ if [ ! -d ${BINUTILS} ]; then tar xfvj ${BINUTILS}.tar.bz2 ## Patch the source code. - cat ../patches/${BINUTILS}-PS3.patch | patch -p1 -d ${BINUTILS} + cat ../patches/${BINUTILS}-PS3-SPU.patch | patch -p1 -d ${BINUTILS} ## Replace config.guess and config.sub cp config.guess config.sub ${BINUTILS} @@ -42,7 +42,8 @@ cd ${BINUTILS}/build-spu --disable-werror \ --with-gcc \ --with-gnu-as \ - --with-gnu-ld + --with-gnu-ld \ + --enable-lto ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 22aafa443..014ef3332 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # gcc-newlib-SPU.sh by Naomi Peori (naomi@peori.ca) -GCC="gcc-9.5.0" +GCC="gcc-7.2.0" NEWLIB="newlib-1.20.0" if [ ! -d ${GCC} ]; then @@ -15,7 +15,7 @@ if [ ! -d ${GCC} ]; then rm -Rf ${NEWLIB} && tar xfvz ${NEWLIB}.tar.gz ## Patch the source code. - cat ../patches/${GCC}-PS3-SPU.patch | patch -p1 -d ${GCC} + cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} ## Enter the source code directory. From 4a6b6f7df69b53f72ef0bda227ffd0cd068d56f0 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 16:52:39 -0300 Subject: [PATCH 017/159] add c++ lang for spu-gcc --- scripts/006-gcc-newlib-SPU.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 014ef3332..bdd56b27c 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -45,8 +45,9 @@ cd ${GCC}/build-spu ## Configure the build. unset CFLAGS CXXFLAGS LDFLAGS +CFLAGS_FOR_TARGET="-Os -fpic -ffast-math -ftree-vectorize -funroll-loops -fschedule-insns -mdual-nops -mwarn-reloc" \ ../configure --prefix="$PS3DEV/spu" --target="spu" \ - --enable-languages="c" \ + --enable-languages="c,c++" \ --enable-lto \ --enable-threads \ --enable-newlib-multithread \ From 3be7a7d62dbdb4d9af74b7971a5909147ab405ae Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 17:17:14 -0300 Subject: [PATCH 018/159] alias sed='gsed' for mac --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3e3e68a21..e10930ace 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,7 +26,8 @@ jobs: if: matrix.os == 'macos-latest' run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed + alias sed='gsed' # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / From e489a569f9b83f57741e53eb3c48104d6e1e5f70 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 17:30:09 -0300 Subject: [PATCH 019/159] gsed alias for macOS --- scripts/002-gcc-newlib-PPU.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index d75fcbe29..b961706a9 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -66,6 +66,11 @@ CXXFLAGS="$CXXFLAGS -Werror=format-security" --disable-shared \ --disable-win32-registry + +# Check if the operating system is macOS +if [ "$(uname)" = "Darwin" ]; then + alias sed='gsed' +fi ## TODO - Move it to patch file sed -i 's/ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE/if 0/' ../libstdc++-v3/src/filesystem/dir-common.h From 4fc062a0be8882caf966aa86b7ef60864da2eba4 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 18:16:55 -0300 Subject: [PATCH 020/159] add python2-dev and libssl-dev for psl1ght build --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e10930ace..b4741ef58 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,7 +20,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt update - sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2 subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config + sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev - name: Install macOS requirements if: matrix.os == 'macos-latest' From 9cb47c7bd87a398d3a4745f97301bcda72dabbfd Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 18:56:03 -0300 Subject: [PATCH 021/159] [gha] only ubuntu for while --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b4741ef58..36ce75643 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + # os: [macos-latest, ubuntu-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v2 From b26dbb0ddad1e0e210585ad73d5d49021a0c5779 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 19:11:38 -0300 Subject: [PATCH 022/159] [gha] set default shell to bash --- .github/workflows/deploy.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 36ce75643..c31940a8e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,8 +11,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - # os: [macos-latest, ubuntu-latest] - os: [ubuntu-latest] + os: [macos-latest, ubuntu-latest] + defaults: + run: + shell: bash steps: - uses: actions/checkout@v2 From 10609f09e12bb3eb0aa84cfca522df651c956d1a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 19:29:17 -0300 Subject: [PATCH 023/159] [gha] use ~/.bashrc --- .github/workflows/deploy.yaml | 6 ++++-- scripts/002-gcc-newlib-PPU.sh | 7 +------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c31940a8e..6fe09360d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,6 +15,8 @@ jobs: defaults: run: shell: bash + env: + BASH_ENV: "~/.bashrc" steps: - uses: actions/checkout@v2 @@ -29,8 +31,8 @@ jobs: if: matrix.os == 'macos-latest' run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed - alias sed='gsed' + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python + echo "alias sed='gsed'" >> ~/.bashrc # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index b961706a9..f58a584ed 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # gcc-newlib-PPU.sh by Naomi Peori (naomi@peori.ca) GCC="gcc-13.2.0" @@ -66,11 +66,6 @@ CXXFLAGS="$CXXFLAGS -Werror=format-security" --disable-shared \ --disable-win32-registry - -# Check if the operating system is macOS -if [ "$(uname)" = "Darwin" ]; then - alias sed='gsed' -fi ## TODO - Move it to patch file sed -i 's/ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE/if 0/' ../libstdc++-v3/src/filesystem/dir-common.h From 2a647601fa4d7de647c15b77631a7aae8cc8da28 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 19:35:51 -0300 Subject: [PATCH 024/159] [gha] mac already have python installed --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 6fe09360d..f50a38123 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -31,7 +31,7 @@ jobs: if: matrix.os == 'macos-latest' run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg From 1e9664296691f88090dff9722391c051abf4dbec Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 19:51:28 -0300 Subject: [PATCH 025/159] [gha] get current arch --- .github/workflows/deploy.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f50a38123..78deb63d7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [ubuntu-latest] defaults: run: shell: bash @@ -64,6 +64,10 @@ jobs: id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: Get current arch + id: arch + run: echo "::set-output name=arch::$(uname -m)" + - name: Create Release id: create_release uses: actions/create-release@v1 @@ -71,7 +75,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{matrix.os}}-${{ steps.slug.outputs.sha8 }} - release_name: ps3dev ${{matrix.os}} (${{steps.date.outputs.date}}) + release_name: ps3dev ${{matrix.os}} ${{steps.arch.outputs.arch}} (${{steps.date.outputs.date}}) draft: false prerelease: false @@ -83,5 +87,5 @@ jobs: with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./ps3dev.tar.gz - asset_name: ps3dev-${{matrix.os}}-${{steps.date.outputs.date}}.tar.gz + asset_name: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz asset_content_type: application/gzip \ No newline at end of file From a3f0d38bc07c5afd23fd76029c8a5cca97450218 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 22:55:37 -0300 Subject: [PATCH 026/159] [gha] checkout@v4 --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 78deb63d7..74e0e99f3 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -19,7 +19,7 @@ jobs: BASH_ENV: "~/.bashrc" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' From 6ccca0894a8c9db6a27fef82ceb0d55eae9ff0f7 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 22:56:10 -0300 Subject: [PATCH 027/159] [gha] replace apple python for python@3.12 --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 74e0e99f3..1a6b24359 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -31,7 +31,7 @@ jobs: if: matrix.os == 'macos-latest' run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config python@3.12 gnu-sed echo "alias sed='gsed'" >> ~/.bashrc # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg From c54ad2051be662e71f6c0fb4a53f220d928aea9f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 22:56:44 -0300 Subject: [PATCH 028/159] binutils-2.42 --- scripts/001-binutils-PPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index 75b932fb1..6f2abaa07 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # binutils-PPU.sh by Naomi Peori (naomi@peori.ca) -BINUTILS="binutils-2.24" +BINUTILS="binutils-2.42" if [ ! -d ${BINUTILS} ]; then From fc9713865b36ca3eca14da24500239870c446fb5 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 22:57:28 -0300 Subject: [PATCH 029/159] ppu gcc remove -Werror=format-security --- scripts/002-gcc-newlib-PPU.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index f58a584ed..0a2682108 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -47,8 +47,8 @@ cd ${GCC}/build-ppu # Avoid breakage -CFLAGS="$CFLAGS -Werror=format-security" -CXXFLAGS="$CXXFLAGS -Werror=format-security" +CFLAGS="${CFLAGS/-Werror=format-security/}" +CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" ../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ --with-cpu="cell" \ --with-newlib \ From dad8ba2efec84fc7af9299cfd55d2cc8d33062ea Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 5 Mar 2024 23:46:30 -0300 Subject: [PATCH 030/159] [ppu] avoiding switch case duplication on dir-common.h --- patches/gcc-13.2.0-PS3-PPU.patch | 62 ++++++++++++++++++++++---------- scripts/002-gcc-newlib-PPU.sh | 3 -- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3-PPU.patch index 2bc8eeb59..e4d00a592 100644 --- a/patches/gcc-13.2.0-PS3-PPU.patch +++ b/patches/gcc-13.2.0-PS3-PPU.patch @@ -1,20 +1,9 @@ # Original from https://github.com/ps3dev/ps3toolchain # Updated to gcc 9.5.0 by Darjan Krijan [https://disc-kuraudo.eu] # Updated to gcc 13.2.0 by luizfernandonb -diff --git a/Makefile.in b/Makefile.in -index 06a9398e172..7419f7ed67a 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -28118,7 +28118,6 @@ check-libiberty: - .PHONY: install-libiberty maybe-install-libiberty - maybe-install-libiberty: - @if libiberty --maybe-install-libiberty: install-libiberty - - install-libiberty: installdirs - @: $(MAKE); $(unstage) +# Updated to gcc 13.2.0 by humbertodias diff --git a/gcc/config.gcc b/gcc/config.gcc -index 648b3dc2110..650d65fe28d 100644 +index 648b3dc..650d65f 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2863,6 +2863,15 @@ pdp11-*-*) @@ -35,7 +24,7 @@ index 648b3dc2110..650d65fe28d 100644 case ${target} in diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h new file mode 100644 -index 00000000000..79a09605757 +index 0000000..4a34fca --- /dev/null +++ b/gcc/config/rs6000/cell64lv2.h @@ -0,0 +1,583 @@ @@ -624,7 +613,7 @@ index 00000000000..79a09605757 +#define TARGET_FLOAT128_ENABLE_TYPE 1 \ No newline at end of file diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc -index e5ceff3a61b..152b1191490 100644 +index 196bcbe..11430b8 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1762,6 +1762,17 @@ static const struct attribute_spec rs6000_attribute_table[] = @@ -655,10 +644,10 @@ index e5ceff3a61b..152b1191490 100644 } if (OPTION_SET_P (rs6000_current_cmodel)) diff --git a/gcc/configure b/gcc/configure -index dec2eca1a45..bcfdcffb950 100755 +index c7b26d1..85e83d3 100755 --- a/gcc/configure +++ b/gcc/configure -@@ -30853,12 +30853,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h +@@ -30787,12 +30787,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h esac case "$target:$tm_file" in @@ -674,7 +663,7 @@ index dec2eca1a45..bcfdcffb950 100755 ;; *le-*-freebsd*) diff --git a/libgcc/config.host b/libgcc/config.host -index 9d7212028d0..c2b3bb8ac28 100644 +index 9d72120..c2b3bb8 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1224,6 +1224,8 @@ powerpc-*-rtems*) @@ -686,3 +675,40 @@ index 9d7212028d0..c2b3bb8ac28 100644 powerpc*-*-linux*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc" tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" +diff --git a/libstdc++-v3/src/filesystem/dir-common.h b/libstdc++-v3/src/filesystem/dir-common.h +index af51375..3aedb59 100644 +--- a/libstdc++-v3/src/filesystem/dir-common.h ++++ b/libstdc++-v3/src/filesystem/dir-common.h +@@ -272,20 +272,12 @@ get_file_type(const std::filesystem::__gnu_posix::dirent& d [[gnu::unused]]) + #ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE + switch (d.d_type) + { +- case DT_BLK: +- return file_type::block; +- case DT_CHR: +- return file_type::character; + case DT_DIR: + return file_type::directory; +- case DT_FIFO: +- return file_type::fifo; + case DT_LNK: + return file_type::symlink; + case DT_REG: + return file_type::regular; +- case DT_SOCK: +- return file_type::socket; + case DT_UNKNOWN: + return file_type::unknown; + default: +diff --git a/Makefile.in b/Makefile.in +index 06a9398..7419f7e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -28118,7 +28118,6 @@ check-libiberty: + .PHONY: install-libiberty maybe-install-libiberty + maybe-install-libiberty: + @if libiberty +-maybe-install-libiberty: install-libiberty + + install-libiberty: installdirs + @: $(MAKE); $(unstage) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 0a2682108..62a6c0703 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -66,9 +66,6 @@ CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" --disable-shared \ --disable-win32-registry -## TODO - Move it to patch file -sed -i 's/ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE/if 0/' ../libstdc++-v3/src/filesystem/dir-common.h - ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? if [ ! -z $ret ]; then PROCS=4; fi From 14c882c19a53f81934034276f36a45621db1f159 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 00:19:21 -0300 Subject: [PATCH 031/159] [spu] gcc-9.5.0 --- scripts/006-gcc-newlib-SPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index bdd56b27c..2791cad3d 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # gcc-newlib-SPU.sh by Naomi Peori (naomi@peori.ca) -GCC="gcc-7.2.0" +GCC="gcc-9.5.0" NEWLIB="newlib-1.20.0" if [ ! -d ${GCC} ]; then From ba86afaa30f625a4734d3426f87a0b9cce4d648b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 00:19:32 -0300 Subject: [PATCH 032/159] Revert "binutils-2.42" This reverts commit c54ad2051be662e71f6c0fb4a53f220d928aea9f. --- scripts/001-binutils-PPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index 6f2abaa07..75b932fb1 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # binutils-PPU.sh by Naomi Peori (naomi@peori.ca) -BINUTILS="binutils-2.42" +BINUTILS="binutils-2.24" if [ ! -d ${BINUTILS} ]; then From 75b61972de80b402562f8cd793f9baadf037b645 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 00:49:41 -0300 Subject: [PATCH 033/159] [ppu] binutils-2.42 --- scripts/001-binutils-PPU.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index 75b932fb1..eb56593c1 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -1,7 +1,7 @@ #!/bin/sh -e # binutils-PPU.sh by Naomi Peori (naomi@peori.ca) -BINUTILS="binutils-2.24" +BINUTILS="binutils-2.42" if [ ! -d ${BINUTILS} ]; then @@ -34,19 +34,20 @@ fi cd ${BINUTILS}/build-ppu ## Configure the build. +unset LDFLAGS ../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ - --disable-nls \ - --disable-shared \ - --disable-debug \ - --disable-dependency-tracking \ - --disable-werror \ - --enable-64-bit-bfd \ + --with-gcc \ + --with-gnu-as \ + --with-gnu-ld \ + --enable-64-bit-bfd \ --enable-lto \ - --with-gcc \ - --with-gnu-as \ - --with-gnu-ld + --disable-nls \ + --disable-shared \ + --disable-debug \ + --disable-dependency-tracking \ + --disable-werror ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? if [ ! -z $ret ]; then PROCS=4; fi -${MAKE:-make} -j $PROCS && ${MAKE:-make} libdir=host-libs/lib install +${MAKE:-make} -j $PROCS && ${MAKE:-make} libdir=`pwd`/host-libs/lib install From df37178a023f4d85361008a514c5e9819edac06e Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 01:25:03 -0300 Subject: [PATCH 034/159] [ci] add macos-latest --- .github/workflows/deploy.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1a6b24359..dac2ea1c6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] + os: [macos-latest, ubuntu-latest] defaults: run: shell: bash @@ -33,9 +33,6 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config python@3.12 gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - # python2 - curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg - sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From a38290b187fc823ddd8d425c0213152356bebeaf Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 01:30:28 -0300 Subject: [PATCH 035/159] [ci-mac] remove python --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index dac2ea1c6..efd4be85f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -31,7 +31,7 @@ jobs: if: matrix.os == 'macos-latest' run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config python@3.12 gnu-sed + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - name: Runs all the stages in the shell From a4ef882019715e690bc93527088be2105f72c17d Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 01:35:21 -0300 Subject: [PATCH 036/159] [ci-mac] add python2 manually --- .github/workflows/deploy.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index efd4be85f..321844b5f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -33,6 +33,9 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc + # python2 + curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg + installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From f1e532fc52081b7ff8112f368b47cb36ce0ddc97 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 01:38:37 -0300 Subject: [PATCH 037/159] [ci-mac] sudo required --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 321844b5f..edfa3ec68 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -35,7 +35,7 @@ jobs: echo "alias sed='gsed'" >> ~/.bashrc # python2 curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg - installer -pkg python-2.7.18-macosx10.9.pkg -target / + sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From 98a03e51308e5ba53f0abaae392ec791af60b0cd Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 02:01:14 -0300 Subject: [PATCH 038/159] [docker] update ubuntu to 24.04 the last LTS --- Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4052d3d62..ed16fe466 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ -FROM ubuntu:xenial +FROM ubuntu:24.04 LABEL maintainer="miigotu@gmail.com" ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin +ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:$PS3DEV/portlibs/ppu/lib/package ENV DEBIAN_FRONTEND=noninteractive RUN \ - apt-get -y update && \ - apt-get -y install \ - autoconf bison build-essential ca-certificates flex git libelf-dev\ - libgmp-dev libncurses5-dev libssl-dev libtool-bin pkg-config python-dev \ - texinfo wget zlib1g-dev && \ - apt-get -y clean autoclean autoremove && \ - rm -rf /var/lib/{apt,dpkg,cache,log}/ + apt -y update && \ + apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ + ca-certificates flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ + libtool libtool-bin make patch pkg-config python-dev-is-python3 texinfo wget xz-utils zlib1g-dev && \ + apt -y clean autoclean autoremove && \ + rm -rf /var/lib/{apt,dpkg,cache,log} RUN mkdir /build WORKDIR /build From eec7d6bf3ea82414deee7ad12e0a2d12d2f858bd Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 03:22:31 -0300 Subject: [PATCH 039/159] [spu] enable GWINSZ_IN_SYS_IOCTL using mac compiler --- scripts/007-gdb-SPU.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/007-gdb-SPU.sh b/scripts/007-gdb-SPU.sh index 8e227156f..7e0657731 100755 --- a/scripts/007-gdb-SPU.sh +++ b/scripts/007-gdb-SPU.sh @@ -34,6 +34,12 @@ fi cd ${GDB}/build-spu ## Configure the build. + +# TODO - Move it to patch file +if [ "$(uname -s)" = "Darwin" ]; then +sed -i 's/#undef GWINSZ_IN_SYS_IOCTL/#define GWINSZ_IN_SYS_IOCTL/' ../readline/config.h.in +fi + ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-nls \ --disable-sim \ @@ -42,4 +48,4 @@ cd ${GDB}/build-spu ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? if [ ! -z $ret ]; then PROCS=4; fi -${MAKE:-make} -j $PROCS && ${MAKE:-make} libdir=host-libs/lib install +${MAKE:-make} -j $PROCS && ${MAKE:-make} libdir=`pwd`/host-libs/lib install From 9b064aff8b9f2d91ba727866dd2befaeeef03dc2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 03:45:07 -0300 Subject: [PATCH 040/159] [spu-gdb] moving fix for mac to patch file --- patches/gdb-8.3.1-PS3.patch | 219 ++++++++++++++++++++---------------- scripts/007-gdb-SPU.sh | 5 - 2 files changed, 122 insertions(+), 102 deletions(-) diff --git a/patches/gdb-8.3.1-PS3.patch b/patches/gdb-8.3.1-PS3.patch index 979fa68ea..b2f3a1169 100644 --- a/patches/gdb-8.3.1-PS3.patch +++ b/patches/gdb-8.3.1-PS3.patch @@ -1,5 +1,48 @@ +# Updated for mac gdb 8.3.1-PS3 by humbertodias +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +index 5614cc3386c..a7942e6c37f 100644 +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -1100,6 +1100,7 @@ COMMON_SFILES = \ + remote-fileio.c \ + remote-notif.c \ + reverse.c \ ++ run-on-main-thread.c \ + rust-lang.c \ + sentinel-frame.c \ + ser-event.c \ +@@ -1362,6 +1363,7 @@ HFILES_NO_SRCDIR = \ + riscv-tdep.h \ + rs6000-aix-tdep.h \ + rs6000-tdep.h \ ++ run-on-main-thread.h \ + s390-linux-tdep.h \ + s390-tdep.h \ + score-tdep.h \ +diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py +index 3d662a7d3f1..04b9e49c229 100644 +--- a/gdb/python/lib/gdb/command/prompt.py ++++ b/gdb/python/lib/gdb/command/prompt.py +@@ -45,7 +45,7 @@ The currently defined substitutions are: + self.hook_set = False + + def get_show_string (self, pvalue): +- if self.value is not '': ++ if self.value: + return "The extended prompt is: " + self.value + else: + return "The extended prompt is not set." +@@ -57,7 +57,7 @@ The currently defined substitutions are: + return "" + + def before_prompt_hook(self, current): +- if self.value is not '': ++ if self.value: + return gdb.prompt.substitute_prompt(self.value) + else: + return None diff --git a/gdb/python/python.c b/gdb/python/python.c -index 67f362b852d0..4bdd2201abc3 100644 +index c23db2c1261..422b61bedf6 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -28,14 +28,13 @@ @@ -18,7 +61,7 @@ index 67f362b852d0..4bdd2201abc3 100644 /* Declared constants and enum for python stack printing. */ static const char python_excp_none[] = "none"; -@@ -228,13 +227,37 @@ +@@ -228,13 +227,37 @@ gdbpy_enter::~gdbpy_enter () m_error->restore (); @@ -57,7 +100,7 @@ index 67f362b852d0..4bdd2201abc3 100644 /* Set the quit flag. */ static void -@@ -248,6 +271,10 @@ +@@ -248,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) static int gdbpy_check_quit_flag (const struct extension_language_defn *extlang) { @@ -68,7 +111,7 @@ index 67f362b852d0..4bdd2201abc3 100644 return PyOS_InterruptOccurred (); } -@@ -942,60 +969,54 @@ +@@ -942,60 +969,54 @@ gdbpy_source_script (const struct extension_language_defn *extlang, /* A single event. */ struct gdbpy_event { @@ -81,25 +124,20 @@ index 67f362b852d0..4bdd2201abc3 100644 + : m_func (func.release ()) + { + } -+ + +-/* All pending events. */ +-static struct gdbpy_event *gdbpy_event_list; +-/* The final link of the event list. */ +-static struct gdbpy_event **gdbpy_event_list_end; + gdbpy_event (gdbpy_event &&other) + : m_func (other.m_func) + { + other.m_func = nullptr; + } --/* All pending events. */ --static struct gdbpy_event *gdbpy_event_list; --/* The final link of the event list. */ --static struct gdbpy_event **gdbpy_event_list_end; -- -/* So that we can wake up the main thread even when it is blocked in - poll(). */ -static struct serial_event *gdbpy_serial_event; -- --/* The file handler callback. This reads from the internal pipe, and -- then processes the Python event queue. This will always be run in -- the main gdb thread. */ + gdbpy_event (const gdbpy_event &other) + : m_func (other.m_func) + { @@ -107,23 +145,29 @@ index 67f362b852d0..4bdd2201abc3 100644 + Py_XINCREF (m_func); + } --static void --gdbpy_run_events (int error, gdb_client_data client_data) --{ -- gdbpy_enter enter_py (get_current_arch (), current_language); +-/* The file handler callback. This reads from the internal pipe, and +- then processes the Python event queue. This will always be run in +- the main gdb thread. */ + ~gdbpy_event () + { + gdbpy_gil gil; + Py_XDECREF (m_func); + } -+ + +-static void +-gdbpy_run_events (int error, gdb_client_data client_data) +-{ +- gdbpy_enter enter_py (get_current_arch (), current_language); + gdbpy_event &operator= (const gdbpy_event &other) = delete; - /* Clear the event fd. Do this before flushing the events list, so - that any new event post afterwards is sure to re-awake the event - loop. */ - serial_event_clear (gdbpy_serial_event); -- ++ void operator() () ++ { ++ gdbpy_enter enter_py (get_current_arch (), current_language); + - while (gdbpy_event_list) - { - /* Dispatching the event might push a new element onto the event @@ -132,10 +176,7 @@ index 67f362b852d0..4bdd2201abc3 100644 - gdbpy_event_list = gdbpy_event_list->next; - if (gdbpy_event_list == NULL) - gdbpy_event_list_end = &gdbpy_event_list; -+ void operator() () -+ { -+ gdbpy_enter enter_py (get_current_arch (), current_language); - +- - gdbpy_ref<> call_result (PyObject_CallObject (item->event, NULL)); + gdbpy_ref<> call_result (PyObject_CallObject (m_func, NULL)); if (call_result == NULL) @@ -164,7 +205,7 @@ index 67f362b852d0..4bdd2201abc3 100644 if (!PyArg_ParseTuple (args, "O", &func)) return NULL; -@@ -1007,38 +1028,13 @@ +@@ -1007,38 +1028,13 @@ gdbpy_post_event (PyObject *self, PyObject *args) return NULL; } @@ -206,7 +247,7 @@ index 67f362b852d0..4bdd2201abc3 100644 /* This is the extension_language_ops.before_prompt "method". */ -@@ -1573,6 +1569,7 @@ +@@ -1573,6 +1569,7 @@ finalize_python (void *ignore) Py_Finalize (); @@ -214,7 +255,7 @@ index 67f362b852d0..4bdd2201abc3 100644 restore_active_ext_lang (previous_active); } -@@ -1701,7 +1698,6 @@ +@@ -1701,7 +1698,6 @@ do_start_initialization () || gdbpy_initialize_linetable () < 0 || gdbpy_initialize_thread () < 0 || gdbpy_initialize_inferior () < 0 @@ -222,7 +263,7 @@ index 67f362b852d0..4bdd2201abc3 100644 || gdbpy_initialize_eventregistry () < 0 || gdbpy_initialize_py_events () < 0 || gdbpy_initialize_event () < 0 -@@ -1736,8 +1732,7 @@ +@@ -1736,8 +1732,7 @@ do_start_initialization () return false; /* Release the GIL while gdb runs. */ @@ -232,39 +273,11 @@ index 67f362b852d0..4bdd2201abc3 100644 make_final_cleanup (finalize_python, NULL); ---- /dev/null 2023-07-16 09:39:45.472000000 +0200 -+++ b/gdb/run-on-main-thread.h 2023-07-30 10:43:06.264134972 +0200 -@@ -0,0 +1,28 @@ -+/* Run a function on the main thread -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef GDB_RUN_ON_MAIN_THREAD_H -+#define GDB_RUN_ON_MAIN_THREAD_H -+ -+#include -+ -+/* Send a runnable to the main thread. */ -+ -+extern void run_on_main_thread (std::function &&); -+ -+#endif /* GDB_RUN_ON_MAIN_THREAD_H */ ---- /dev/null 2023-07-16 09:39:45.472000000 +0200 -+++ b/gdb/run-on-main-thread.c 2023-07-30 10:43:03.510435316 +0200 +diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c +new file mode 100644 +index 00000000000..86824b5af4a +--- /dev/null ++++ b/gdb/run-on-main-thread.c @@ -0,0 +1,97 @@ +/* Run a function on the main thread + Copyright (C) 2019 Free Software Foundation, Inc. @@ -363,41 +376,53 @@ index 67f362b852d0..4bdd2201abc3 100644 + runnable_event = make_serial_event (); + add_file_handler (serial_event_fd (runnable_event), run_events, nullptr); +} ---- a/gdb/Makefile.in 2023-07-30 10:45:06.611621149 +0200 -+++ b/gdb/Makefile.in 2023-07-30 10:46:04.284435216 +0200 -@@ -1100,6 +1100,7 @@ - remote-fileio.c \ - remote-notif.c \ - reverse.c \ -+ run-on-main-thread.c \ - rust-lang.c \ - sentinel-frame.c \ - ser-event.c \ -@@ -1362,6 +1363,7 @@ - riscv-tdep.h \ - rs6000-aix-tdep.h \ - rs6000-tdep.h \ -+ run-on-main-thread.h \ - s390-linux-tdep.h \ - s390-tdep.h \ - score-tdep.h \ ---- a/gdb/python/lib/gdb/command/prompt.py -+++ b/gdb/python/lib/gdb/command/prompt.py -@@ -45,7 +45,7 @@ def __init__(self): - self.hook_set = False +diff --git a/gdb/run-on-main-thread.h b/gdb/run-on-main-thread.h +new file mode 100644 +index 00000000000..fd1a2c42532 +--- /dev/null ++++ b/gdb/run-on-main-thread.h +@@ -0,0 +1,28 @@ ++/* Run a function on the main thread ++ Copyright (C) 2019 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef GDB_RUN_ON_MAIN_THREAD_H ++#define GDB_RUN_ON_MAIN_THREAD_H ++ ++#include ++ ++/* Send a runnable to the main thread. */ ++ ++extern void run_on_main_thread (std::function &&); ++ ++#endif /* GDB_RUN_ON_MAIN_THREAD_H */ +diff --git a/readline/config.h.in b/readline/config.h.in +index c194e761a45..07b04fceb56 100644 +--- a/readline/config.h.in ++++ b/readline/config.h.in +@@ -234,7 +234,11 @@ + /* Definitions pulled in from aclocal.m4. */ + #undef VOID_SIGHANDLER - def get_show_string (self, pvalue): -- if self.value is not '': -+ if self.value: - return "The extended prompt is: " + self.value - else: - return "The extended prompt is not set." -@@ -57,7 +57,7 @@ def get_set_string (self): - return "" ++#if __APPLE__ ++#define GWINSZ_IN_SYS_IOCTL ++#else + #undef GWINSZ_IN_SYS_IOCTL ++#endif + + #undef STRUCT_WINSIZE_IN_SYS_IOCTL - def before_prompt_hook(self, current): -- if self.value is not '': -+ if self.value: - return gdb.prompt.substitute_prompt(self.value) - else: - return None diff --git a/scripts/007-gdb-SPU.sh b/scripts/007-gdb-SPU.sh index 7e0657731..d78de91e9 100755 --- a/scripts/007-gdb-SPU.sh +++ b/scripts/007-gdb-SPU.sh @@ -35,11 +35,6 @@ cd ${GDB}/build-spu ## Configure the build. -# TODO - Move it to patch file -if [ "$(uname -s)" = "Darwin" ]; then -sed -i 's/#undef GWINSZ_IN_SYS_IOCTL/#define GWINSZ_IN_SYS_IOCTL/' ../readline/config.h.in -fi - ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-nls \ --disable-sim \ From 02de5f40395b137f7d26249a0098e0bfc9d05310 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 04:24:07 -0300 Subject: [PATCH 041/159] [ci] docker hub --- .github/workflows/deploy-docker.yaml | 67 ++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/deploy-docker.yaml diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml new file mode 100644 index 000000000..c51fd5866 --- /dev/null +++ b/.github/workflows/deploy-docker.yaml @@ -0,0 +1,67 @@ +name: ci-docker +on: + pull_request: + branches: + - master + + # Runs on pushes targeting the default branch + push: + branches: ['master'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + dockerhub-push: + runs-on: ubuntu-latest + environment: DockerHub + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 +# - linux/arm/v7 +# - linux/arm64/v8 +# - linux/ppc64le +# - linux/s390x + + env: + DOCKERHUB_REPONAME: ps3dev + DOCKERHUB_REPOTAG: latest + + steps: + + - name: Checkout + uses: actions/checkout@v4 + + - name: README to Dockerhub + uses: christian-korneck/update-container-description-action@v1 + env: + DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} + with: + destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }} + provider: dockerhub + short_description: 'A Docker Image for PS3 Development' + readme_file: 'README.md' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + with: + context: . + platforms: ${{ matrix.platform }} + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file From f5bf275f174c85f8a948606d246a975cc2aed4ae Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:31:52 -0300 Subject: [PATCH 042/159] [ci] add python11 with diskutils module --- .github/workflows/deploy.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index edfa3ec68..1a0130ff8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,12 +20,15 @@ jobs: steps: - uses: actions/checkout@v4 - + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' run: | sudo apt update - sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev + sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch subversion wget zlib1g-dev libtool-bin bzip2 libgmp3-dev pkg-config libssl-dev - name: Install macOS requirements if: matrix.os == 'macos-latest' @@ -33,9 +36,6 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - # python2 - curl -O https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg - sudo installer -pkg python-2.7.18-macosx10.9.pkg -target / - name: Runs all the stages in the shell run: | From 0886e06f51541ce2552e64ee44be4e7417e8a101 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:36:19 -0300 Subject: [PATCH 043/159] [ci] python 2.7 --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1a0130ff8..b2002b4db 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '2.7' - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' From 62c2bfc5789326046379f2927769bbcbb1c941bd Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:37:40 -0300 Subject: [PATCH 044/159] Revert "[ci] python 2.7" This reverts commit 0886e06f51541ce2552e64ee44be4e7417e8a101. --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b2002b4db..1a0130ff8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -22,7 +22,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '2.7' + python-version: '3.11' - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' From c5de5097d75202fb29237b809f73a0489b5aeac9 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:44:25 -0300 Subject: [PATCH 045/159] [ci] install python manually for macos --- .github/workflows/deploy.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 1a0130ff8..a91c56d6b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,15 +20,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.11' - + - name: Install Ubuntu requirements if: matrix.os == 'ubuntu-latest' run: | sudo apt update - sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch subversion wget zlib1g-dev libtool-bin bzip2 libgmp3-dev pkg-config libssl-dev + sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev - name: Install macOS requirements if: matrix.os == 'macos-latest' @@ -36,6 +33,9 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc + # python3 + curl -O https://www.python.org/ftp/python/3.11.8/python-3.11.8-macos11.pkg + sudo installer -pkg python-3.11.8-macos11.pkg -target / - name: Runs all the stages in the shell run: | From 6ec4cc5f92ccd459691f08ba60123f1e957bb9ce Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:48:14 -0300 Subject: [PATCH 046/159] [ci] python@3.11 support disktutils --- .github/workflows/deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a91c56d6b..9282466de 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -33,9 +33,9 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - # python3 - curl -O https://www.python.org/ftp/python/3.11.8/python-3.11.8-macos11.pkg - sudo installer -pkg python-3.11.8-macos11.pkg -target / + + brew install python@3.11 + brew link --overwrite python@3.11 - name: Runs all the stages in the shell run: | From 39c17bfd9a6672a4792d4213674d99126938a3eb Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:50:22 -0300 Subject: [PATCH 047/159] [ci] mac already have python installed --- .github/workflows/deploy.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 9282466de..31c22c931 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -34,9 +34,6 @@ jobs: brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - brew install python@3.11 - brew link --overwrite python@3.11 - - name: Runs all the stages in the shell run: | mkdir $PWD/ps3dev From bbced149f584437d9ce925594f2dc136a3730225 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 13:56:05 -0300 Subject: [PATCH 048/159] [ci] pip install python-config --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 31c22c931..4c328cbde 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -33,6 +33,7 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc + pip install python-config - name: Runs all the stages in the shell run: | From 6eba5043ea2f6be32ce1f5794d446b6caf06f4f3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:25:19 -0300 Subject: [PATCH 049/159] [ci] macos-13 --- .github/workflows/deploy.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4c328cbde..87ca8e51d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-13] defaults: run: shell: bash @@ -28,16 +28,17 @@ jobs: sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev - name: Install macOS requirements - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos-13' + # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python@3.11 echo "alias sed='gsed'" >> ~/.bashrc - pip install python-config + #pip install python-config - name: Runs all the stages in the shell run: | - mkdir $PWD/ps3dev + mkdir -p $PWD/ps3dev export PS3DEV=$PWD/ps3dev export PSL1GHT=$PS3DEV export PATH=$PATH:$PS3DEV/bin From bb224597ed3f4adb16080a24ec5d99b4a647b07b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:28:32 -0300 Subject: [PATCH 050/159] [ci] brew install python3 --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 87ca8e51d..560e95569 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ jobs: # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python@3.11 + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python3 echo "alias sed='gsed'" >> ~/.bashrc #pip install python-config From a03374566938aff464c90103ffb271debd58ea44 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:32:53 -0300 Subject: [PATCH 051/159] [ci] unlink python3 first --- .github/workflows/deploy.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 560e95569..7e41336e5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,9 +32,11 @@ jobs: # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed python3 + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - #pip install python-config + brew unlink python3 + brew install python@3.11 + pip install python-config - name: Runs all the stages in the shell run: | From a12fccb6e627f16690a53e3f0304f4a87c821484 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:36:13 -0300 Subject: [PATCH 052/159] [ci] show python installed version --- .github/workflows/deploy.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7e41336e5..3bbca7e29 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -34,8 +34,7 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed echo "alias sed='gsed'" >> ~/.bashrc - brew unlink python3 - brew install python@3.11 + python --version pip install python-config - name: Runs all the stages in the shell From 59e1c5fb6df9c975c0f10f554cb5cd554d221b61 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:39:16 -0300 Subject: [PATCH 053/159] [ci] mac install makeinfo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3bbca7e29..402741930 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -32,7 +32,7 @@ jobs: # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update - brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed + brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc python --version pip install python-config From be59dce8948027ab89e308a5e8277112effc957a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:42:31 -0300 Subject: [PATCH 054/159] [ci] uninstall py3.12 for downgrading to 3.11 --- .github/workflows/deploy.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 402741930..b2508ce46 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -35,7 +35,9 @@ jobs: brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc python --version - pip install python-config + brew uninstall python3 + brew install python@3.11 + python --version - name: Runs all the stages in the shell run: | From 5ed350f632f93baea49c65e1de8548e74baf7c78 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:44:35 -0300 Subject: [PATCH 055/159] [ci] brew uninstall --ignore-dependencies python3 --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b2508ce46..a449f53c5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -35,7 +35,7 @@ jobs: brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc python --version - brew uninstall python3 + brew uninstall --ignore-dependencies python3 brew install python@3.11 python --version From 25b89ed4f9e56ac0dbf1978bfe80c394720f283b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:45:17 -0300 Subject: [PATCH 056/159] ignoring .vscode --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c9f22d9d2..7a894455c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ build/ .idea/** .DS_Store +ps3dev +.vscode \ No newline at end of file From c019c465903727a4503afa174b558d311192f644 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 14:51:34 -0300 Subject: [PATCH 057/159] [ci] install python3.11 using pyenv --- .github/workflows/deploy.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a449f53c5..34698a22d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-13] + os: [macos-latest, ubuntu-latest] defaults: run: shell: bash @@ -28,15 +28,25 @@ jobs: sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev - name: Install macOS requirements - if: matrix.os == 'macos-13' + if: matrix.os == 'macos-latest' # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc python --version - brew uninstall --ignore-dependencies python3 - brew install python@3.11 + + + # install pyenv + brew install pyenv + # Initialize pyenv in the current shell + eval "$(pyenv init --path)" + + # Install Python 3.11 using pyenv + pyenv install 3.11.0 + # Set Python 3.11 as the global version + pyenv global 3.11.0 + python --version - name: Runs all the stages in the shell From 335c8c4944d9c5bdc8969948f69d6a37b145a1fc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 15:10:47 -0300 Subject: [PATCH 058/159] [ci] checking python-config --- .github/workflows/deploy.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 34698a22d..e831689a7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,12 +11,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [macos-latest] defaults: run: shell: bash - env: - BASH_ENV: "~/.bashrc" steps: - uses: actions/checkout@v4 @@ -34,8 +32,10 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc + + # check current version python --version - + python-config --libs # install pyenv brew install pyenv @@ -47,7 +47,9 @@ jobs: # Set Python 3.11 as the global version pyenv global 3.11.0 + # check current version python --version + python-config --libs - name: Runs all the stages in the shell run: | From a6ca9a71ce830696164ecd68196e458a4bfacf78 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 15:20:40 -0300 Subject: [PATCH 059/159] [ci] alias python-config --- .github/workflows/deploy.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e831689a7..0d44a4ecc 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -15,6 +15,8 @@ jobs: defaults: run: shell: bash + env: + BASH_ENV: "~/.bashrc" steps: - uses: actions/checkout@v4 @@ -32,7 +34,7 @@ jobs: brew update brew install autoconf automake openssl libelf ncurses zlib gmp wget pkg-config gnu-sed texinfo echo "alias sed='gsed'" >> ~/.bashrc - + # check current version python --version python-config --libs @@ -47,7 +49,8 @@ jobs: # Set Python 3.11 as the global version pyenv global 3.11.0 - # check current version + echo "alias python-config=~/.pyenv/versions/3.11.0/bin/python-config' >> ~/.bashrc + python --version python-config --libs From f7ae248a5112099c4b428f08445dc0df727251fe Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 15:30:13 -0300 Subject: [PATCH 060/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0d44a4ecc..e93e43301 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest] + os: [ubuntu-latest] defaults: run: shell: bash From af9ea702f155f733faa38a809be7f3750a46ff03 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 16:10:06 -0300 Subject: [PATCH 061/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e93e43301..f11b54f60 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] + os: [macos-latest] defaults: run: shell: bash @@ -48,9 +48,10 @@ jobs: pyenv install 3.11.0 # Set Python 3.11 as the global version pyenv global 3.11.0 - - echo "alias python-config=~/.pyenv/versions/3.11.0/bin/python-config' >> ~/.bashrc - + dir_python=`dirname $(pyenv which python-config)` + echo $dir_path + echo "export PATH=$dir_python:$PATH" >> ~/.bashrc + source ~/.bashrc python --version python-config --libs From 38eeddb4733f7ec26e9525c60384418b609e30c2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 16:16:47 -0300 Subject: [PATCH 062/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f11b54f60..159337d2c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -48,10 +48,11 @@ jobs: pyenv install 3.11.0 # Set Python 3.11 as the global version pyenv global 3.11.0 - dir_python=`dirname $(pyenv which python-config)` + dir_python="$(pyenv which python-config)" echo $dir_path - echo "export PATH=$dir_python:$PATH" >> ~/.bashrc + echo "export PATH=$dir_python/..:$PATH" >> ~/.bashrc source ~/.bashrc + echo $PATH python --version python-config --libs From 22026d30bc1b34d1b886c3bc9dbffb49beee273c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 16:19:51 -0300 Subject: [PATCH 063/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 159337d2c..05409a238 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -37,7 +37,7 @@ jobs: # check current version python --version - python-config --libs + #python-config --libs # install pyenv brew install pyenv @@ -48,6 +48,9 @@ jobs: pyenv install 3.11.0 # Set Python 3.11 as the global version pyenv global 3.11.0 + + pip install python-config + dir_python="$(pyenv which python-config)" echo $dir_path echo "export PATH=$dir_python/..:$PATH" >> ~/.bashrc From b09a226f34b5c6a988315609e9c5234f9174a83d Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 16:31:54 -0300 Subject: [PATCH 064/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 05409a238..e30c959b6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -53,8 +53,7 @@ jobs: dir_python="$(pyenv which python-config)" echo $dir_path - echo "export PATH=$dir_python/..:$PATH" >> ~/.bashrc - source ~/.bashrc + echo $PATH python --version python-config --libs From e3eaebdf0bbba832ff00a1cdb74582e0e9989d31 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 17:02:18 -0300 Subject: [PATCH 065/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e30c959b6..72ba2a4a6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -57,6 +57,7 @@ jobs: echo $PATH python --version python-config --libs + echo 'pyenv global 3.11.0' >> ~/.bashrc - name: Runs all the stages in the shell run: | From b82e9177b7d3a2c16070f2a0ec8a8b3ba09fafba Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 17:38:30 -0300 Subject: [PATCH 066/159] [ci] add ubuntu-latest --- .github/workflows/deploy.yaml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 72ba2a4a6..86db29983 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest] + os: [macos-latest, ubuntu-latest] defaults: run: shell: bash @@ -48,15 +48,7 @@ jobs: pyenv install 3.11.0 # Set Python 3.11 as the global version pyenv global 3.11.0 - pip install python-config - - dir_python="$(pyenv which python-config)" - echo $dir_path - - echo $PATH - python --version - python-config --libs echo 'pyenv global 3.11.0' >> ~/.bashrc - name: Runs all the stages in the shell From 4140ac8df5e2caf28f27c423f67db28abc8ffc34 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 20:25:13 -0300 Subject: [PATCH 067/159] [docker] add python 3.11.8 using pyenv --- Dockerfile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ed16fe466..6f19c1e2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,34 @@ FROM ubuntu:24.04 LABEL maintainer="miigotu@gmail.com" +# Set the default shell to Bash +SHELL ["/bin/bash", "-c"] + ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:$PS3DEV/portlibs/ppu/lib/package ENV DEBIAN_FRONTEND=noninteractive +# last python version with diskutils module support +ENV PYTHON_VERSION=3.11.8 +ENV PYENV_ROOT="$HOME/.pyenv" +ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" RUN \ apt -y update && \ apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ ca-certificates flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ - libtool libtool-bin make patch pkg-config python-dev-is-python3 texinfo wget xz-utils zlib1g-dev && \ + libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ + # pyenv + apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ + llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl && \ + curl https://pyenv.run | bash && \ + pyenv update && \ + pyenv install $PYTHON_VERSION && \ + pyenv global $PYTHON_VERSION && \ + pyenv rehash && \ + # pyenv apt -y clean autoclean autoremove && \ rm -rf /var/lib/{apt,dpkg,cache,log} From e018f59874a9cd78e0b54c04e8f2877a16440e70 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 20:25:42 -0300 Subject: [PATCH 068/159] [ci] only ubuntu. mas is taking too long --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 86db29983..552ddb4e8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest] + os: [ubuntu-latest] defaults: run: shell: bash From 422541b91fe3cce1068e16721ec849bfe74187c9 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 6 Mar 2024 20:55:34 -0300 Subject: [PATCH 069/159] [docker] typo --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6f19c1e2b..961f77c4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,6 @@ WORKDIR /build COPY . /build # Fixes certificate errors with letsencrypt in ARMv7 -RUN echo "\nca_certificate=/etc/ssl/certs/ca-certificates.crt" | tee -a /etc/wgetrc +RUN echo "ca_certificate=/etc/ssl/certs/ca-certificates.crt" >> /etc/wgetrc RUN /build/toolchain.sh From 31d06097c1266298d5cd690de9fc6fa23914539c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 7 Mar 2024 09:52:19 -0300 Subject: [PATCH 070/159] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 961f77c4b..4cbf15783 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin -ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:$PS3DEV/portlibs/ppu/lib/package +ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/package:/usr/lib/x86_64-linux-gnu/pkgconfig ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support From a8b15136e43bec7814f9ceeadd12b7b7dba9bcab Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 7 Mar 2024 09:56:12 -0300 Subject: [PATCH 071/159] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4cbf15783..76519c884 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin -ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/package:/usr/lib/x86_64-linux-gnu/pkgconfig +ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/package ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support From 53a74e1a3c2c38c0346df99d3afa0608939e512f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 7 Mar 2024 12:50:22 -0300 Subject: [PATCH 072/159] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76519c884..6fb66a2f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin -ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/package +ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/pkgconfig ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support From 46f2dbc7a563cdb5d1335a9ca56c8a2c1b3b5106 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 9 Mar 2024 00:05:23 -0300 Subject: [PATCH 073/159] Update deploy-docker.yaml --- .github/workflows/deploy-docker.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index c51fd5866..9fca0fb57 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -20,8 +20,9 @@ jobs: matrix: platform: - linux/amd64 + - linux/386 # - linux/arm/v7 -# - linux/arm64/v8 + - linux/arm64/v8 # - linux/ppc64le # - linux/s390x @@ -64,4 +65,4 @@ jobs: context: . platforms: ${{ matrix.platform }} push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} From fddd3ada017234a0827d46e62be7630f7632a94b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 10 Mar 2024 23:04:13 -0300 Subject: [PATCH 074/159] CFLAGS=-fno-asynchronous-unwind-tables --- patches/gcc-13.2.0-PS3-PPU.patch | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3-PPU.patch index e4d00a592..c34645a1f 100644 --- a/patches/gcc-13.2.0-PS3-PPU.patch +++ b/patches/gcc-13.2.0-PS3-PPU.patch @@ -663,18 +663,27 @@ index c7b26d1..85e83d3 100755 ;; *le-*-freebsd*) diff --git a/libgcc/config.host b/libgcc/config.host -index 9d72120..c2b3bb8 100644 +index 9d72120..7ddde1d 100644 --- a/libgcc/config.host +++ b/libgcc/config.host -@@ -1224,6 +1224,8 @@ powerpc-*-rtems*) +@@ -1224,6 +1224,9 @@ powerpc-*-rtems*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" ;; +powerpc64-ps3-elf) ++ tmake_file="${tmake_file} rs6000/t-crtstuff-cell64lv2" + ;; powerpc*-*-linux*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc" tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" +diff --git a/libgcc/config/rs6000/t-crtstuff-cell64lv2 b/libgcc/config/rs6000/t-crtstuff-cell64lv2 +new file mode 100644 +index 0000000..9eb9ca7 +--- /dev/null ++++ b/libgcc/config/rs6000/t-crtstuff-cell64lv2 +@@ -0,0 +1 @@ ++CRTSTUFF_T_CFLAGS = -fno-asynchronous-unwind-tables +\ No newline at end of file diff --git a/libstdc++-v3/src/filesystem/dir-common.h b/libstdc++-v3/src/filesystem/dir-common.h index af51375..3aedb59 100644 --- a/libstdc++-v3/src/filesystem/dir-common.h From aba3190c559c83cf8f9b1c1e31ed1a506ed33b87 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 10 Mar 2024 23:11:21 -0300 Subject: [PATCH 075/159] Update deploy-docker.yaml --- .github/workflows/deploy-docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 9fca0fb57..09fc3d52a 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -20,9 +20,9 @@ jobs: matrix: platform: - linux/amd64 - - linux/386 +# - linux/386 # - linux/arm/v7 - - linux/arm64/v8 +# - linux/arm64/v8 # - linux/ppc64le # - linux/s390x From 1fb228923fc04efc78f330cd64220f3e9edb20f3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 11 Mar 2024 01:27:08 -0300 Subject: [PATCH 076/159] Update Dockerfile --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6fb66a2f3..fe0d9db43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,9 +29,8 @@ RUN \ pyenv global $PYTHON_VERSION && \ pyenv rehash && \ # pyenv - apt -y clean autoclean autoremove && \ - rm -rf /var/lib/{apt,dpkg,cache,log} - + apt -y clean autoclean autoremove + RUN mkdir /build WORKDIR /build COPY . /build From c07bfc4747d7b48b08ede54d5ceafee6becbe4cc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 11 Mar 2024 02:02:37 -0300 Subject: [PATCH 077/159] add PATH=/portlibs/ppu/bin --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index fe0d9db43..1ef626020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ SHELL ["/bin/bash", "-c"] ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} -ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin +ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/pkgconfig ENV DEBIAN_FRONTEND=noninteractive From 9056e9590adacf35145aae0ec6ef012653ff6eeb Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 14 Mar 2024 14:37:40 -0300 Subject: [PATCH 078/159] Update 009-ps3libraries.sh --- scripts/009-ps3libraries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 67fd2adc7..71db9909e 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -2,7 +2,7 @@ # ps3libraries.sh by Naomi Peori (naomi@peori.ca) ## Download the source code. -wget --no-check-certificate https://github.com/ps3dev/ps3libraries/tarball/master -O ps3libraries.tar.gz +wget --no-check-certificate https://github.com/humbertodias/ps3libraries/tarball/master -O ps3libraries.tar.gz ## Unpack the source code. rm -Rf ps3libraries && mkdir ps3libraries && tar --strip-components=1 --directory=ps3libraries -xvzf ps3libraries.tar.gz && cd ps3libraries From 755d94127a03019b994a45565e81c89352d7561b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 14 Mar 2024 14:39:20 -0300 Subject: [PATCH 079/159] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1ef626020..9284265f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" RUN \ apt -y update && \ apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ - ca-certificates flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ + ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ # pyenv apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ From dd90084554d8dd99f2be8f264b249a370a5151cc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 14 Mar 2024 15:18:20 -0300 Subject: [PATCH 080/159] Update deploy.yaml --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 552ddb4e8..c6060f6ab 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -3,6 +3,7 @@ name: CI on: push: pull_request: + workflow_dispatch: repository_dispatch: types: [run_build] @@ -102,4 +103,4 @@ jobs: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./ps3dev.tar.gz asset_name: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz - asset_content_type: application/gzip \ No newline at end of file + asset_content_type: application/gzip From 21a85b41fdc933f22939de356ddc8feff856d08c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Thu, 14 Mar 2024 18:28:57 -0300 Subject: [PATCH 081/159] Update 009-ps3libraries.sh --- scripts/009-ps3libraries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 71db9909e..5f279d34d 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -2,7 +2,7 @@ # ps3libraries.sh by Naomi Peori (naomi@peori.ca) ## Download the source code. -wget --no-check-certificate https://github.com/humbertodias/ps3libraries/tarball/master -O ps3libraries.tar.gz +wget --no-check-certificate https://github.com/humbertodias/ps3libraries/tarball/psl1ght-2.30.1 -O ps3libraries.tar.gz ## Unpack the source code. rm -Rf ps3libraries && mkdir ps3libraries && tar --strip-components=1 --directory=ps3libraries -xvzf ps3libraries.tar.gz && cd ps3libraries From e892486c1d35edeea9e0bb91bfbed923c988a16a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 15 Mar 2024 00:22:20 -0300 Subject: [PATCH 082/159] add PATH=$PATH:$PS3DEV/portlibs/ppu/bin --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c6060f6ab..b4a6a1242 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -60,6 +60,7 @@ jobs: export PATH=$PATH:$PS3DEV/bin export PATH=$PATH:$PS3DEV/ppu/bin export PATH=$PATH:$PS3DEV/spu/bin + export PATH=$PATH:$PS3DEV/portlibs/ppu/bin ./toolchain.sh - name: Get short SHA From d8e237ade4ae8598597d09553a5ac6f8cb2a558a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 15 Mar 2024 01:06:26 -0300 Subject: [PATCH 083/159] PKG_CONFIG_PATH=$PS3DEV/portlibs/ppu/lib/pkgconfig --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b4a6a1242..d8f99cbf6 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -61,6 +61,7 @@ jobs: export PATH=$PATH:$PS3DEV/ppu/bin export PATH=$PATH:$PS3DEV/spu/bin export PATH=$PATH:$PS3DEV/portlibs/ppu/bin + export PKG_CONFIG_PATH=$PS3DEV/portlibs/ppu/lib/pkgconfig ./toolchain.sh - name: Get short SHA From 1cc315aae357a7742edc461038c652a4e8227c0c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 15 Mar 2024 16:21:50 -0300 Subject: [PATCH 084/159] rm tmp files --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9284265f0..7b9a0d044 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,5 @@ COPY . /build # Fixes certificate errors with letsencrypt in ARMv7 RUN echo "ca_certificate=/etc/ssl/certs/ca-certificates.crt" >> /etc/wgetrc RUN /build/toolchain.sh - +# Temporary files +RUN rm -rf /build/build From 504fe345647429c1dcd22f723b8abdbdf8a41f3f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 15 Mar 2024 18:41:27 -0300 Subject: [PATCH 085/159] Update Dockerfile --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b9a0d044..f641cafdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,4 @@ COPY . /build # Fixes certificate errors with letsencrypt in ARMv7 RUN echo "ca_certificate=/etc/ssl/certs/ca-certificates.crt" >> /etc/wgetrc -RUN /build/toolchain.sh -# Temporary files -RUN rm -rf /build/build +RUN /build/toolchain.sh && rm -rf /build/build From 1416700e4012dde23bec07d3fcec5436dafda0a3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 15 Mar 2024 22:01:29 -0300 Subject: [PATCH 086/159] python 3.10 + pycrypto + nvidia-cg-toolkit --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f641cafdb..109e3ab99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,15 +11,16 @@ ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/pkgconfig ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support -ENV PYTHON_VERSION=3.11.8 +ENV PYTHON_VERSION=3.10 ENV PYENV_ROOT="$HOME/.pyenv" +ENV PIP_ROOT_USER_ACTION=ignore ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" RUN \ apt -y update && \ apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ - libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ + libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev nvidia-cg-toolkit && \ # pyenv apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl && \ @@ -28,6 +29,7 @@ RUN \ pyenv install $PYTHON_VERSION && \ pyenv global $PYTHON_VERSION && \ pyenv rehash && \ + pip install pycrypto && \ # pyenv apt -y clean autoclean autoremove From e7bc2ca826af44b201cd1cd6ed02cf5c1a4965e2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 19 Mar 2024 15:48:21 -0300 Subject: [PATCH 087/159] newlib fix to avoid duplicated values on dirent_type --- patches/gcc-13.2.0-PS3-PPU.patch | 25 ------------------------- patches/newlib-1.20.0-PS3.patch | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3-PPU.patch index c34645a1f..9573bf1cf 100644 --- a/patches/gcc-13.2.0-PS3-PPU.patch +++ b/patches/gcc-13.2.0-PS3-PPU.patch @@ -684,31 +684,6 @@ index 0000000..9eb9ca7 @@ -0,0 +1 @@ +CRTSTUFF_T_CFLAGS = -fno-asynchronous-unwind-tables \ No newline at end of file -diff --git a/libstdc++-v3/src/filesystem/dir-common.h b/libstdc++-v3/src/filesystem/dir-common.h -index af51375..3aedb59 100644 ---- a/libstdc++-v3/src/filesystem/dir-common.h -+++ b/libstdc++-v3/src/filesystem/dir-common.h -@@ -272,20 +272,12 @@ get_file_type(const std::filesystem::__gnu_posix::dirent& d [[gnu::unused]]) - #ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE - switch (d.d_type) - { -- case DT_BLK: -- return file_type::block; -- case DT_CHR: -- return file_type::character; - case DT_DIR: - return file_type::directory; -- case DT_FIFO: -- return file_type::fifo; - case DT_LNK: - return file_type::symlink; - case DT_REG: - return file_type::regular; -- case DT_SOCK: -- return file_type::socket; - case DT_UNKNOWN: - return file_type::unknown; - default: diff --git a/Makefile.in b/Makefile.in index 06a9398..7419f7e 100644 --- a/Makefile.in diff --git a/patches/newlib-1.20.0-PS3.patch b/patches/newlib-1.20.0-PS3.patch index 2cab6e163..e20c4ee2e 100644 --- a/patches/newlib-1.20.0-PS3.patch +++ b/patches/newlib-1.20.0-PS3.patch @@ -13178,3 +13178,30 @@ index 6932de2..4c8bdbb 100644 /* Calculate the exponent. */ if (y < 0.0) N = (int) (y * ONE_OVER_PI - 0.5); +diff --git a/newlib/libc/sys/lv2/sys/dirent.h b/newlib/libc/sys/lv2/sys/dirent.h +index 84780e9..d44d070 100644 +--- a/newlib/libc/sys/lv2/sys/dirent.h ++++ b/newlib/libc/sys/lv2/sys/dirent.h +@@ -7,14 +7,14 @@ + + #define DT_INVALID 0xff + #define DT_UNKNOWN 0 +-#define DT_FIFO DT_INVALID +-#define DT_CHR DT_INVALID +-#define DT_DIR 1 +-#define DT_BLK DT_INVALID +-#define DT_REG 2 +-#define DT_LNK 3 +-#define DT_SOCK DT_INVALID +-#define DT_WHT DT_INVALID ++#define DT_FIFO 1 ++#define DT_CHR 2 ++#define DT_DIR 4 ++#define DT_BLK 6 ++#define DT_REG 8 ++#define DT_LNK 10 ++#define DT_SOCK 12 ++#define DT_WHT 14 + + #define dirfd(dp) ((dp)->dd_fd) + From 04ddabf87814e0fec6ddde0e52d3b00173d7e121 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 19 Mar 2024 20:59:13 -0300 Subject: [PATCH 088/159] typo 006-gcc-newlib-SPU.sh --- scripts/006-gcc-newlib-SPU.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 2791cad3d..6e4f176e9 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -15,7 +15,7 @@ if [ ! -d ${GCC} ]; then rm -Rf ${NEWLIB} && tar xfvz ${NEWLIB}.tar.gz ## Patch the source code. - cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} + cat ../patches/${GCC}-PS3-SPU.patch | patch -p1 -d ${GCC} cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} ## Enter the source code directory. From 4d23a177cf01f201be1f4773c8c690898c893f04 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 3 Apr 2024 10:55:46 -0300 Subject: [PATCH 089/159] install nvidia-cg-toolkit only for x68 arch --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 109e3ab99..21b7ed3b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,8 @@ RUN \ apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev nvidia-cg-toolkit && \ + # Install dependencies specific for amd64 architecture + if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi ; \ # pyenv apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl && \ From 16a02432e63d2e7a4a82cbf6490560dfa2c8e8f6 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 3 Apr 2024 17:14:23 -0300 Subject: [PATCH 090/159] docker multi-stage image --- Dockerfile | 58 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21b7ed3b4..a57136b2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -FROM ubuntu:24.04 -LABEL maintainer="miigotu@gmail.com" +FROM ubuntu:22.04 as builder # Set the default shell to Bash SHELL ["/bin/bash", "-c"] @@ -7,38 +6,41 @@ SHELL ["/bin/bash", "-c"] ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin -ENV PKG_CONFIG_PATH $PS3DEV/portlibs/ppu/lib/pkgconfig +ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support ENV PYTHON_VERSION=3.10 -ENV PYENV_ROOT="$HOME/.pyenv" +ENV PYENV_ROOT ${HOME}/.pyenv ENV PIP_ROOT_USER_ACTION=ignore -ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" +ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:$PATH -RUN \ - apt -y update && \ - apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ - ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ - libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev nvidia-cg-toolkit && \ - # Install dependencies specific for amd64 architecture - if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi ; \ - # pyenv - apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ - llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl && \ - curl https://pyenv.run | bash && \ - pyenv update && \ - pyenv install $PYTHON_VERSION && \ - pyenv global $PYTHON_VERSION && \ - pyenv rehash && \ - pip install pycrypto && \ - # pyenv - apt -y clean autoclean autoremove - -RUN mkdir /build +RUN apt update -y && \ + apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ + ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ + libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ + # Fixes certificate errors with letsencrypt in ARMv7 + echo 'ca_certificate=/etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc && \ + # Install dependencies specific for amd64 architecture + if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi && \ + # pyenv + apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ + llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ + echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc && \ + git config --global http.sslverify 'false' && \ + curl https://pyenv.run | bash && \ + pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \ + pip install pycrypto && \ + # pyenv + apt -y clean autoclean autoremove && \ + mkdir /build WORKDIR /build COPY . /build +RUN /build/toolchain.sh -# Fixes certificate errors with letsencrypt in ARMv7 -RUN echo "ca_certificate=/etc/ssl/certs/ca-certificates.crt" >> /etc/wgetrc -RUN /build/toolchain.sh && rm -rf /build/build +FROM ubuntu:22.04 as runtime +ENV PS3DEV /usr/local/ps3dev +ENV PSL1GHT ${PS3DEV} +ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin +ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig +COPY --from=builder ${PS3DEV} ${PS3DEV} \ No newline at end of file From a4910a8d00f776770dcd05e75afa4db0edb12d20 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Fri, 5 Apr 2024 22:50:25 -0300 Subject: [PATCH 091/159] add base stage --- Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index a57136b2d..bb45dab46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,16 @@ -FROM ubuntu:22.04 as builder - +FROM ubuntu:22.04 as base # Set the default shell to Bash SHELL ["/bin/bash", "-c"] - ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig - ENV DEBIAN_FRONTEND=noninteractive # last python version with diskutils module support ENV PYTHON_VERSION=3.10 ENV PYENV_ROOT ${HOME}/.pyenv ENV PIP_ROOT_USER_ACTION=ignore ENV PATH ${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:$PATH - RUN apt update -y && \ apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ @@ -32,13 +28,15 @@ RUN apt update -y && \ pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \ pip install pycrypto && \ # pyenv - apt -y clean autoclean autoremove && \ - mkdir /build + apt -y clean autoclean autoremove + +FROM base as builder +RUN mkdir /build WORKDIR /build COPY . /build RUN /build/toolchain.sh -FROM ubuntu:22.04 as runtime +FROM base as runtime ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin From 899711443c6054e407c10d9d07cb1ae5738dce7f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 09:38:09 -0300 Subject: [PATCH 092/159] download source code only if directory doesn't exist --- scripts/008-psl1ght.sh | 19 ++++++++++++------- scripts/009-ps3libraries.sh | 18 +++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/scripts/008-psl1ght.sh b/scripts/008-psl1ght.sh index 0f66d90dc..1135ad172 100755 --- a/scripts/008-psl1ght.sh +++ b/scripts/008-psl1ght.sh @@ -1,14 +1,19 @@ #!/bin/sh -e # psl1ght.sh by Naomi Peori (naomi@peori.ca) -## Download the source code. -wget --no-check-certificate https://github.com/ps3dev/PSL1GHT/tarball/master -O psl1ght.tar.gz +PSL1GHT="PSL1GHT" -## Unpack the source code. -rm -Rf psl1ght && mkdir psl1ght && tar --strip-components=1 --directory=psl1ght -xvzf psl1ght.tar.gz +if [ ! -d ${PSL1GHT} ]; then -## Create the build directory. -cd psl1ght + ## Download the source code. + wget --no-check-certificate https://github.com/ps3dev/$PSL1GHT/tarball/master -O $PSL1GHT.tar.gz + + ## Unpack the source code. + rm -Rf $PSL1GHT && mkdir $PSL1GHT && tar --strip-components=1 --directory=$PSL1GHT -xvzf $PSL1GHT.tar.gz + +fi + +cd $PSL1GHT ## Compile and install. -${MAKE:-make} install-ctrl && ${MAKE:-make} && ${MAKE:-make} install +${MAKE:-make} install-ctrl && ${MAKE:-make} && ${MAKE:-make} install \ No newline at end of file diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 5f279d34d..4e4c65b34 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -1,11 +1,19 @@ #!/bin/sh -e # ps3libraries.sh by Naomi Peori (naomi@peori.ca) -## Download the source code. -wget --no-check-certificate https://github.com/humbertodias/ps3libraries/tarball/psl1ght-2.30.1 -O ps3libraries.tar.gz +PS3LIBRARIES="ps3libraries" -## Unpack the source code. -rm -Rf ps3libraries && mkdir ps3libraries && tar --strip-components=1 --directory=ps3libraries -xvzf ps3libraries.tar.gz && cd ps3libraries +if [ ! -d ${PSL1GHT} ]; then + + ## Download the source code. + wget --no-check-certificate https://github.com/humbertodias/$PS3LIBRARIES/tarball/psl1ght-2.30.1 -O $PS3LIBRARIES.tar.gz + + ## Unpack the source code. + rm -Rf $PS3LIBRARIES && mkdir $PS3LIBRARIES && tar --strip-components=1 --directory=$PS3LIBRARIES -xvzf $PS3LIBRARIES.tar.gz + +fi + +cd $PS3LIBRARIES ## Compile and install. -./libraries.sh +./libraries.sh \ No newline at end of file From dea2c907d7496c67919a6b1318295ee9080274ac Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 09:38:37 -0300 Subject: [PATCH 093/159] enabling linux/arm --- .github/workflows/deploy-docker.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 09fc3d52a..af523c76e 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -20,11 +20,11 @@ jobs: matrix: platform: - linux/amd64 -# - linux/386 -# - linux/arm/v7 -# - linux/arm64/v8 -# - linux/ppc64le -# - linux/s390x + - linux/arm/v7 + - linux/arm64/v8 + # - linux/386 + # - linux/ppc64le + # - linux/s390x env: DOCKERHUB_REPONAME: ps3dev From c450e5352b518576da980b8f9fea019fbda9ccc9 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 11:03:44 -0300 Subject: [PATCH 094/159] typo --- scripts/008-psl1ght.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/008-psl1ght.sh b/scripts/008-psl1ght.sh index 1135ad172..1da1f8fab 100755 --- a/scripts/008-psl1ght.sh +++ b/scripts/008-psl1ght.sh @@ -1,19 +1,19 @@ #!/bin/sh -e # psl1ght.sh by Naomi Peori (naomi@peori.ca) -PSL1GHT="PSL1GHT" +PSL1GHT_DIR="PSL1GHT" -if [ ! -d ${PSL1GHT} ]; then +if [ ! -d ${PSL1GHT_DIR} ]; then ## Download the source code. - wget --no-check-certificate https://github.com/ps3dev/$PSL1GHT/tarball/master -O $PSL1GHT.tar.gz + wget --no-check-certificate https://github.com/ps3dev/$PSL1GHT_DIR/tarball/master -O $PSL1GHT_DIR.tar.gz ## Unpack the source code. - rm -Rf $PSL1GHT && mkdir $PSL1GHT && tar --strip-components=1 --directory=$PSL1GHT -xvzf $PSL1GHT.tar.gz + rm -Rf $PSL1GHT_DIR && mkdir $PSL1GHT_DIR && tar --strip-components=1 --directory=$PSL1GHT_DIR -xvzf $PSL1GHT_DIR.tar.gz fi -cd $PSL1GHT +cd $PSL1GHT_DIR ## Compile and install. ${MAKE:-make} install-ctrl && ${MAKE:-make} && ${MAKE:-make} install \ No newline at end of file From 6729efb39111ba5545cb6c0ec8d8d1287b2daab9 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 13:45:38 -0300 Subject: [PATCH 095/159] skip arm --- .github/workflows/deploy-docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index af523c76e..ea14c9a35 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -20,8 +20,8 @@ jobs: matrix: platform: - linux/amd64 - - linux/arm/v7 - - linux/arm64/v8 + # - linux/arm/v7 + # - linux/arm64/v8 # - linux/386 # - linux/ppc64le # - linux/s390x From 08351b75a873dbaa7ba638f59b2b0b9ec23bc255 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 13:48:49 -0300 Subject: [PATCH 096/159] typo --- scripts/009-ps3libraries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 4e4c65b34..5e6c806bf 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -3,7 +3,7 @@ PS3LIBRARIES="ps3libraries" -if [ ! -d ${PSL1GHT} ]; then +if [ ! -d ${PS3LIBRARIES} ]; then ## Download the source code. wget --no-check-certificate https://github.com/humbertodias/$PS3LIBRARIES/tarball/psl1ght-2.30.1 -O $PS3LIBRARIES.tar.gz From 1520f52369294d13a78e77e4d7a7cf9089dfed05 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 14:08:32 -0300 Subject: [PATCH 097/159] ci x86 install nvidia-cg-toolkit --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index d8f99cbf6..c9b0bf8da 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,7 +26,8 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt update - sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev + sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev && \ + if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi - name: Install macOS requirements if: matrix.os == 'macos-latest' From 9d48317adca9587c9aae96215613e607f06d95f6 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 14:14:43 -0300 Subject: [PATCH 098/159] sudo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c9b0bf8da..306bfc89e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -27,7 +27,7 @@ jobs: run: | sudo apt update sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev && \ - if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi + if [ "$(uname -m)" = "x86_64" ]; then sudo apt install -y nvidia-cg-toolkit ; fi - name: Install macOS requirements if: matrix.os == 'macos-latest' From 900a37d29e199136c600d0334138b50e92b544ec Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 15:52:35 -0300 Subject: [PATCH 099/159] add linux/arm64 --- .github/workflows/deploy-docker.yaml | 1 + .github/workflows/deploy.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index ea14c9a35..968aacf59 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -20,6 +20,7 @@ jobs: matrix: platform: - linux/amd64 + - linux/arm64 # - linux/arm/v7 # - linux/arm64/v8 # - linux/386 diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 306bfc89e..da26e1e8a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,4 +1,4 @@ -name: CI +name: ci on: push: From 72bbba7359f5503acd01058826587848f5107c89 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 16:35:10 -0300 Subject: [PATCH 100/159] architecture: [x64, arm64] --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index da26e1e8a..52b73f3da 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -13,6 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] + architecture: [x64, arm64] defaults: run: shell: bash From b5dee4657ec52c32d0663ce1ff6792aa4f930c5e Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 17:06:49 -0300 Subject: [PATCH 101/159] doc: how to build multi platform image --- .github/workflows/deploy-docker.yaml | 9 ++------- Dockerfile | 6 +++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 968aacf59..6bddcfba9 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -13,20 +13,15 @@ on: jobs: dockerhub-push: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} environment: DockerHub strategy: fail-fast: false matrix: + os: [ubuntu-latest] platform: - linux/amd64 - linux/arm64 - # - linux/arm/v7 - # - linux/arm64/v8 - # - linux/386 - # - linux/ppc64le - # - linux/s390x - env: DOCKERHUB_REPONAME: ps3dev DOCKERHUB_REPOTAG: latest diff --git a/Dockerfile b/Dockerfile index bb45dab46..708e9b61c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,4 +41,8 @@ ENV PS3DEV /usr/local/ps3dev ENV PSL1GHT ${PS3DEV} ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig -COPY --from=builder ${PS3DEV} ${PS3DEV} \ No newline at end of file +COPY --from=builder ${PS3DEV} ${PS3DEV} + +# How to build multi platform image +# docker buildx create --use +# docker buildx build --platform linux/amd64,linux/arm64 -t ps3dev:latest . \ No newline at end of file From 627a9c4c3d98eb665cf03ff85e512b097f6b29c2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 19:08:45 -0300 Subject: [PATCH 102/159] release tagname with arch --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 52b73f3da..43feba469 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -93,7 +93,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{matrix.os}}-${{ steps.slug.outputs.sha8 }} + tag_name: ${{matrix.os}}-${{steps.arch.outputs.arch}}-${{ steps.slug.outputs.sha8 }} release_name: ps3dev ${{matrix.os}} ${{steps.arch.outputs.arch}} (${{steps.date.outputs.date}}) draft: false prerelease: false From 73d3c690ea1fa884dd02e3a285106082fc452479 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 22:01:19 -0300 Subject: [PATCH 103/159] upload/download artifact --- .github/workflows/deploy-docker.yaml | 2 +- .github/workflows/deploy.yaml | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 6bddcfba9..051774f00 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-latest] platform: - linux/amd64 - - linux/arm64 + # - linux/arm64 env: DOCKERHUB_REPONAME: ps3dev DOCKERHUB_REPOTAG: latest diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 43feba469..76f981120 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -108,3 +108,24 @@ jobs: asset_path: ./ps3dev.tar.gz asset_name: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz asset_content_type: application/gzip + + + publish-release: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + if: startsWith(github.ref, 'refs/tags/') + with: + name: artifact + path: ${{github.workspace}} + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + ${{ github.workspace }}/*.pkg \ No newline at end of file From 26bfb463e36cf19a60d189f05dcabca7cc7ac3f7 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 6 Apr 2024 22:34:06 -0300 Subject: [PATCH 104/159] publish-release --- .github/workflows/deploy.yaml | 37 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 76f981120..79f5b9cc2 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -87,45 +87,32 @@ jobs: id: arch run: echo "::set-output name=arch::$(uname -m)" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Archive Folder + uses: actions/upload-artifact@v4 with: - tag_name: ${{matrix.os}}-${{steps.arch.outputs.arch}}-${{ steps.slug.outputs.sha8 }} - release_name: ps3dev ${{matrix.os}} ${{steps.arch.outputs.arch}} (${{steps.date.outputs.date}}) - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./ps3dev.tar.gz - asset_name: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz - asset_content_type: application/gzip - + name: artifact-${{matrix.architecture}} + path: | + ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz publish-release: needs: build runs-on: ubuntu-latest + strategy: + matrix: + architecture: [x64, arm64] steps: - name: Download Artifact uses: actions/download-artifact@v4 - if: startsWith(github.ref, 'refs/tags/') +# if: startsWith(github.ref, 'refs/tags/') with: - name: artifact + name: artifact-${{matrix.architecture}} path: ${{github.workspace}} - name: Create Release id: create_release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + # if: startsWith(github.ref, 'refs/tags/') with: files: | - ${{ github.workspace }}/*.pkg \ No newline at end of file + ${{ github.workspace }}/*.tar.gz \ No newline at end of file From b6399bc05d85ac1d1f9bffe2ee7371e505a0affe Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 10:31:14 -0300 Subject: [PATCH 105/159] Compress ps3dev folder --- .github/workflows/deploy.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 79f5b9cc2..bd6a485a0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -87,6 +87,10 @@ jobs: id: arch run: echo "::set-output name=arch::$(uname -m)" + - name: Compress ps3dev folder + run: | + tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C /usr/local/ps3dev + - name: Archive Folder uses: actions/upload-artifact@v4 with: From b5dcf2d6b6e9094a4b18082442498076c2d8e1b5 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 10:44:46 -0300 Subject: [PATCH 106/159] Download all Artifact --- .github/workflows/deploy.yaml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index bd6a485a0..64f501d0e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -74,11 +74,6 @@ jobs: run: | tar -zcvf ps3dev.tar.gz ps3dev -# - uses: actions/upload-artifact@v2 -# with: -# name: ps3dev-${{ steps.slug.outputs.sha8 }}-${{matrix.os}} -# path: ps3dev.tar.gz - - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" @@ -101,17 +96,10 @@ jobs: publish-release: needs: build runs-on: ubuntu-latest - strategy: - matrix: - architecture: [x64, arm64] steps: - - name: Download Artifact + - name: Download all Artifact uses: actions/download-artifact@v4 -# if: startsWith(github.ref, 'refs/tags/') - with: - name: artifact-${{matrix.architecture}} - path: ${{github.workspace}} - name: Create Release id: create_release From 0be0b57607f623796d7e2cf3450fe858b87f7c57 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 11:10:19 -0300 Subject: [PATCH 107/159] typo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 64f501d0e..e4634fdf5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -84,7 +84,7 @@ jobs: - name: Compress ps3dev folder run: | - tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C /usr/local/ps3dev + tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C ${PS3DEV} - name: Archive Folder uses: actions/upload-artifact@v4 From 6812c43210ccf1eb73fca8c226daf7f711139ff2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 11:52:29 -0300 Subject: [PATCH 108/159] typo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index e4634fdf5..3bbee1d79 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -84,7 +84,7 @@ jobs: - name: Compress ps3dev folder run: | - tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C ${PS3DEV} + tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C "${PS3DEV}" . - name: Archive Folder uses: actions/upload-artifact@v4 From 2eac023bcdecaba7b43dc9c06e74c56c6c3ab0bb Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 13:00:44 -0300 Subject: [PATCH 109/159] typo --- .github/workflows/deploy.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 3bbee1d79..82fc4e60f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -72,7 +72,7 @@ jobs: - name: Compress ps3dev folder run: | - tar -zcvf ps3dev.tar.gz ps3dev + tar -zcvf ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz ps3dev - name: Get current date id: date @@ -82,16 +82,11 @@ jobs: id: arch run: echo "::set-output name=arch::$(uname -m)" - - name: Compress ps3dev folder - run: | - tar -czvf ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz -C "${PS3DEV}" . - - name: Archive Folder uses: actions/upload-artifact@v4 with: name: artifact-${{matrix.architecture}} - path: | - ${{github.workspace}}/ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz + path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz publish-release: needs: build From 1bc901fca8793d03595a6a170208048a3e9199d3 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 14:04:37 -0300 Subject: [PATCH 110/159] typo --- .github/workflows/deploy.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 82fc4e60f..8d925c95f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -69,10 +69,6 @@ jobs: - name: Get short SHA id: slug run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" - - - name: Compress ps3dev folder - run: | - tar -zcvf ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz ps3dev - name: Get current date id: date @@ -82,6 +78,10 @@ jobs: id: arch run: echo "::set-output name=arch::$(uname -m)" + - name: Compress ps3dev folder + run: | + tar -zcvf ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz ps3dev + - name: Archive Folder uses: actions/upload-artifact@v4 with: @@ -98,8 +98,8 @@ jobs: - name: Create Release id: create_release - uses: softprops/action-gh-release@v1 - # if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: files: | ${{ github.workspace }}/*.tar.gz \ No newline at end of file From 939526882d44696d96415eb811b08c86df3d8594 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 14:24:39 -0300 Subject: [PATCH 111/159] tag auto creation --- .github/workflows/deploy.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 8d925c95f..24843453c 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -88,6 +88,12 @@ jobs: name: artifact-${{matrix.architecture}} path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz + - name: Create Tag + run: | + TAG_NAME="v${{ steps.slug.outputs.sha8 }}" + git tag -a $TAG_NAME -m "automatic tag creation" + git push origin $TAG_NAME + publish-release: needs: build runs-on: ubuntu-latest @@ -102,4 +108,5 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: | - ${{ github.workspace }}/*.tar.gz \ No newline at end of file + ${{ github.workspace }}/*.tar.gz + From 883f535f7dc32a272712d899c20a3e01d423f345 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 15:08:51 -0300 Subject: [PATCH 112/159] create-tag@v1 --- .github/workflows/deploy.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 24843453c..31229b37b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -89,10 +89,11 @@ jobs: path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz - name: Create Tag - run: | - TAG_NAME="v${{ steps.slug.outputs.sha8 }}" - git tag -a $TAG_NAME -m "automatic tag creation" - git push origin $TAG_NAME + uses: negz/create-tag@v1 + with: + version: ${{ steps.slug.outputs.sha8 }} + message: "automatic tag creation" + token: ${{ secrets.GITHUB_TOKEN }} publish-release: needs: build From 8f655f950a1df4f4cdaceaf0c1d69e7fd4785315 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 15:49:02 -0300 Subject: [PATCH 113/159] tag name semantic version --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 31229b37b..f53e4dde8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -91,7 +91,7 @@ jobs: - name: Create Tag uses: negz/create-tag@v1 with: - version: ${{ steps.slug.outputs.sha8 }} + version: v${{steps.date.outputs.date}}-${{ steps.slug.outputs.sha8 }} message: "automatic tag creation" token: ${{ secrets.GITHUB_TOKEN }} From 77a966e4f0e694657118a586583d61ef3c75f8cf Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 16:04:23 -0300 Subject: [PATCH 114/159] steps.semver.outputs.semver --- .github/workflows/deploy.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index f53e4dde8..fcb49752f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -88,10 +88,14 @@ jobs: name: artifact-${{matrix.architecture}} path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz + - name: Set SemVer + id: semver + run: echo "::set-output name=semver::0.1.0+${{ steps.date.outputs.date }}.${{ steps.slug.outputs.sha8 }}" + - name: Create Tag uses: negz/create-tag@v1 with: - version: v${{steps.date.outputs.date}}-${{ steps.slug.outputs.sha8 }} + version: ${{steps.semver.outputs.semver}} message: "automatic tag creation" token: ${{ secrets.GITHUB_TOKEN }} From 9e951a784b14bee2aec442c32093a6e748f5248d Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 17:04:59 -0300 Subject: [PATCH 115/159] Check if Tag Exists --- .github/workflows/deploy.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index fcb49752f..dac0bfec0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -91,8 +91,21 @@ jobs: - name: Set SemVer id: semver run: echo "::set-output name=semver::0.1.0+${{ steps.date.outputs.date }}.${{ steps.slug.outputs.sha8 }}" - + + - name: Check if Tag Exists + id: check_tag + run: | + tag_exists=$(git tag --list "${{ steps.semver.outputs.semver }}" | wc -l) + if [ "$tag_exists" -eq "0" ]; then + echo "Tag does not exist." + echo "::set-output name=tag_exists::false" + else + echo "Tag already exists." + echo "::set-output name=tag_exists::true" + fi + - name: Create Tag + if: steps.check_tag.outputs.tag_exists == 'false' uses: negz/create-tag@v1 with: version: ${{steps.semver.outputs.semver}} From 8175a5a8280a74940c0ed13359603b93e8585ad1 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 17:54:19 -0300 Subject: [PATCH 116/159] git fetch --tags --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index dac0bfec0..9a56cc8a5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -95,6 +95,7 @@ jobs: - name: Check if Tag Exists id: check_tag run: | + git fetch --tags tag_exists=$(git tag --list "${{ steps.semver.outputs.semver }}" | wc -l) if [ "$tag_exists" -eq "0" ]; then echo "Tag does not exist." @@ -123,8 +124,8 @@ jobs: - name: Create Release id: create_release uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') with: + tag_name: ${{ needs.build.outputs.semver }} files: | ${{ github.workspace }}/*.tar.gz From 52dbd3cd2b19b82196ab075c53c97349c4700cb0 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 18:06:57 -0300 Subject: [PATCH 117/159] create tag on publish job --- .github/workflows/deploy.yaml | 38 +++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 9a56cc8a5..c4e4d6a2e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -88,32 +88,7 @@ jobs: name: artifact-${{matrix.architecture}} path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz - - name: Set SemVer - id: semver - run: echo "::set-output name=semver::0.1.0+${{ steps.date.outputs.date }}.${{ steps.slug.outputs.sha8 }}" - - - name: Check if Tag Exists - id: check_tag - run: | - git fetch --tags - tag_exists=$(git tag --list "${{ steps.semver.outputs.semver }}" | wc -l) - if [ "$tag_exists" -eq "0" ]; then - echo "Tag does not exist." - echo "::set-output name=tag_exists::false" - else - echo "Tag already exists." - echo "::set-output name=tag_exists::true" - fi - - - name: Create Tag - if: steps.check_tag.outputs.tag_exists == 'false' - uses: negz/create-tag@v1 - with: - version: ${{steps.semver.outputs.semver}} - message: "automatic tag creation" - token: ${{ secrets.GITHUB_TOKEN }} - - publish-release: + publish: needs: build runs-on: ubuntu-latest @@ -121,6 +96,17 @@ jobs: - name: Download all Artifact uses: actions/download-artifact@v4 + - name: Set SemVer + id: semver + run: echo "::set-output name=semver::0.1.0+${{ steps.date.outputs.date }}.${{ steps.slug.outputs.sha8 }}" + + - name: Create Tag + uses: negz/create-tag@v1 + with: + version: ${{ steps.semver.outputs.semver }} + message: "automatic tag creation" + token: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release id: create_release uses: softprops/action-gh-release@v2 From 10fd2341572f414c37aeac65a7a8b054f219b67c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 18:56:35 -0300 Subject: [PATCH 118/159] needs.build.outputs.sha8 --- .github/workflows/deploy.yaml | 11 ++++++++--- Dockerfile | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index c4e4d6a2e..542f6d7ca 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -10,6 +10,7 @@ on: jobs: build: runs-on: ${{ matrix.os }} + strategy: matrix: os: [ubuntu-latest] @@ -20,6 +21,10 @@ jobs: env: BASH_ENV: "~/.bashrc" + outputs: + sha8: ${{ steps.slug.outputs.sha8 }} + date: ${{ steps.date.outputs.date }} + steps: - uses: actions/checkout@v4 @@ -86,7 +91,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: artifact-${{matrix.architecture}} - path: ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz + path: ps3dev-${{matrix.os}}-${{matrix.architecture}}-${{steps.date.outputs.date}}.tar.gz publish: needs: build @@ -98,7 +103,7 @@ jobs: - name: Set SemVer id: semver - run: echo "::set-output name=semver::0.1.0+${{ steps.date.outputs.date }}.${{ steps.slug.outputs.sha8 }}" + run: echo "::set-output name=semver::0.1.0+${{ needs.build.outputs.date }}.${{ needs.build.outputs.sha8 }}" - name: Create Tag uses: negz/create-tag@v1 @@ -111,7 +116,7 @@ jobs: id: create_release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ needs.build.outputs.semver }} + tag_name: ${{ steps.semver.outputs.semver }} files: | ${{ github.workspace }}/*.tar.gz diff --git a/Dockerfile b/Dockerfile index 708e9b61c..98590a9cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,7 @@ ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/por ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig COPY --from=builder ${PS3DEV} ${PS3DEV} -# How to build multi platform image -# docker buildx create --use -# docker buildx build --platform linux/amd64,linux/arm64 -t ps3dev:latest . \ No newline at end of file +# How to build and run a multi platform image +# Tested platforms: linux/amd64 or linux/arm64 +# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker build . -t ps3dev +# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker run -it -v `pwd`:/build -w /build ps3dev \ No newline at end of file From f18bd35d791c20bd5ff3ce9f5e0c894dcccbbc08 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 18:58:10 -0300 Subject: [PATCH 119/159] add macos-latest --- .github/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 542f6d7ca..b64443eec 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] architecture: [x64, arm64] defaults: run: @@ -90,7 +90,7 @@ jobs: - name: Archive Folder uses: actions/upload-artifact@v4 with: - name: artifact-${{matrix.architecture}} + name: ${{matrix.os}}-${{matrix.architecture}} path: ps3dev-${{matrix.os}}-${{matrix.architecture}}-${{steps.date.outputs.date}}.tar.gz publish: From 72718dc79f24f01e34c5592c4c81af84f3ebda3d Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 19:08:55 -0300 Subject: [PATCH 120/159] docker build/push without qemu --- .github/workflows/deploy-docker.yaml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 051774f00..65d54dc04 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-latest] platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 env: DOCKERHUB_REPONAME: ps3dev DOCKERHUB_REPOTAG: latest @@ -42,12 +42,6 @@ jobs: short_description: 'A Docker Image for PS3 Development' readme_file: 'README.md' - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -56,9 +50,6 @@ jobs: - name: Build and push id: docker_build - uses: docker/build-push-action@v5 - with: - context: . - platforms: ${{ matrix.platform }} - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} + run: | + DOCKER_DEFAULT_PLATFORM=${{ matrix.platform }} docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} . + DOCKER_DEFAULT_PLATFORM=${{ matrix.platform }} docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file From edca12c123c82e5fccb341931ee2d24438be3955 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 19:14:06 -0300 Subject: [PATCH 121/159] arch[x64,arm64] --- .github/workflows/deploy-docker.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 65d54dc04..e1dcbfeb6 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -19,9 +19,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - platform: - - linux/amd64 - - linux/arm64 + architecture: [x64, arm64] env: DOCKERHUB_REPONAME: ps3dev DOCKERHUB_REPOTAG: latest @@ -51,5 +49,5 @@ jobs: - name: Build and push id: docker_build run: | - DOCKER_DEFAULT_PLATFORM=${{ matrix.platform }} docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} . - DOCKER_DEFAULT_PLATFORM=${{ matrix.platform }} docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} . + docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file From dc963ff64cafd728928bf146474403a2e0f93ff7 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 19:24:09 -0300 Subject: [PATCH 122/159] ubuntu arm not supported for gha --- .github/workflows/deploy-docker.yaml | 6 +++++- .github/workflows/deploy.yaml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index e1dcbfeb6..7ac0477dc 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - architecture: [x64, arm64] + architecture: [x64] env: DOCKERHUB_REPONAME: ps3dev DOCKERHUB_REPOTAG: latest @@ -46,6 +46,10 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Get current arch + id: arch + run: echo "::set-output name=arch::$(uname -m)" + - name: Build and push id: docker_build run: | diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b64443eec..7cd744c43 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -14,7 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - architecture: [x64, arm64] + architecture: [x64] defaults: run: shell: bash From ccf1da7ef1f695723c8ba115727c2fdcd16fd143 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 19:32:13 -0300 Subject: [PATCH 123/159] add qemu --- .github/workflows/deploy-docker.yaml | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 7ac0477dc..db8e579e7 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -13,16 +13,10 @@ on: jobs: dockerhub-push: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest environment: DockerHub - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - architecture: [x64] env: DOCKERHUB_REPONAME: ps3dev - DOCKERHUB_REPOTAG: latest steps: @@ -40,18 +34,26 @@ jobs: short_description: 'A Docker Image for PS3 Development' readme_file: 'README.md' + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get current arch - id: arch - run: echo "::set-output name=arch::$(uname -m)" - - - name: Build and push - id: docker_build - run: | - docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} . - docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ env.DOCKERHUB_REPOTAG }} \ No newline at end of file + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ${{env.DOCKERHUB_REPONAME}}:latest + ${{env.DOCKERHUB_REPONAME}}:amd64 + ${{env.DOCKERHUB_REPONAME}}:arm64 \ No newline at end of file From 5b403d9f7c332a984bd3e1703a6851c8ab3651d7 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:07:00 -0300 Subject: [PATCH 124/159] qemu matrix platform --- .github/workflows/deploy-docker.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index db8e579e7..fa23e8bb9 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -17,7 +17,10 @@ jobs: environment: DockerHub env: DOCKERHUB_REPONAME: ps3dev - + strategy: + matrix: + platform: [linux/amd64, linux/arm64] + steps: - name: Checkout @@ -36,6 +39,8 @@ jobs: - name: Set up QEMU uses: docker/setup-qemu-action@v3 + with: + platforms: ${{ matrix.platform }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -51,9 +56,8 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm64 + platform: ${{ matrix.platform }} push: true tags: | - ${{env.DOCKERHUB_REPONAME}}:latest - ${{env.DOCKERHUB_REPONAME}}:amd64 - ${{env.DOCKERHUB_REPONAME}}:arm64 \ No newline at end of file + ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} + ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} \ No newline at end of file From 1c8468e87e59c0d7f9e5fa7fce8ccb88fe149ae1 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:08:40 -0300 Subject: [PATCH 125/159] typo --- .github/workflows/deploy-docker.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index fa23e8bb9..95f4bee89 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -58,6 +58,4 @@ jobs: file: ./Dockerfile platform: ${{ matrix.platform }} push: true - tags: | - ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} - ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} \ No newline at end of file + tags: ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} \ No newline at end of file From f2df629a71207c53c36fff13ab2fce25c2c05b5c Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:09:48 -0300 Subject: [PATCH 126/159] typo --- .github/workflows/deploy-docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 95f4bee89..181b5e90e 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -58,4 +58,4 @@ jobs: file: ./Dockerfile platform: ${{ matrix.platform }} push: true - tags: ${{env.DOCKERHUB_REPONAME}}:${{ matrix.platform }} \ No newline at end of file + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ matrix.platform }} \ No newline at end of file From 5b1eeaf0528fb2a99f687d0493c2b07fc941cb08 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:18:30 -0300 Subject: [PATCH 127/159] platforms: ${{ matrix.platform }} --- .github/workflows/deploy-docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 181b5e90e..18ea5f6bd 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -56,6 +56,6 @@ jobs: with: context: . file: ./Dockerfile - platform: ${{ matrix.platform }} + platforms: ${{ matrix.platform }} push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:${{ matrix.platform }} \ No newline at end of file + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:latest \ No newline at end of file From 03ef1e6e9a5ee11cf518c5981c89bf46be2804ed Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:44:42 -0300 Subject: [PATCH 128/159] typo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7cd744c43..daaa1f4ef 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -91,7 +91,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{matrix.os}}-${{matrix.architecture}} - path: ps3dev-${{matrix.os}}-${{matrix.architecture}}-${{steps.date.outputs.date}}.tar.gz + path: ps3dev-*.tar.gz publish: needs: build From 49b062ef78d84a54c3919735c5677267abacd76b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 21:49:17 -0300 Subject: [PATCH 129/159] macos-14 --- .github/workflows/deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index daaa1f4ef..2e04cee13 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-14] architecture: [x64] defaults: run: @@ -36,7 +36,7 @@ jobs: if [ "$(uname -m)" = "x86_64" ]; then sudo apt install -y nvidia-cg-toolkit ; fi - name: Install macOS requirements - if: matrix.os == 'macos-latest' + if: startsWith(matrix.os, 'macos') # act -P macos-latest=-self-hosted --container-architecture linux/amd64 run: | brew update From 2ae56962ad7a64c417e60ad237d2bb9a98bbb478 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 22:10:12 -0300 Subject: [PATCH 130/159] source ~/.bashrc --- .github/workflows/deploy.yaml | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 2e04cee13..b05bff7d8 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -18,8 +18,6 @@ jobs: defaults: run: shell: bash - env: - BASH_ENV: "~/.bashrc" outputs: sha8: ${{ steps.slug.outputs.sha8 }} @@ -27,9 +25,21 @@ jobs: steps: - uses: actions/checkout@v4 - + + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + + - name: Get current arch + id: arch + run: echo "::set-output name=arch::$(uname -m)" + - name: Install Ubuntu requirements - if: matrix.os == 'ubuntu-latest' + if: startsWith(matrix.os, 'ubuntu') run: | sudo apt update sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev && \ @@ -61,6 +71,7 @@ jobs: - name: Runs all the stages in the shell run: | + source ~/.bashrc mkdir -p $PWD/ps3dev export PS3DEV=$PWD/ps3dev export PSL1GHT=$PS3DEV @@ -71,18 +82,6 @@ jobs: export PKG_CONFIG_PATH=$PS3DEV/portlibs/ppu/lib/pkgconfig ./toolchain.sh - - name: Get short SHA - id: slug - run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Get current arch - id: arch - run: echo "::set-output name=arch::$(uname -m)" - - name: Compress ps3dev folder run: | tar -zcvf ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz ps3dev @@ -91,7 +90,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{matrix.os}}-${{matrix.architecture}} - path: ps3dev-*.tar.gz + path: *.tar.gz publish: needs: build From e30a10b2c26dbf9d6ea9c45b98fb8d1de2aa45a0 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 22:11:07 -0300 Subject: [PATCH 131/159] typo --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index b05bff7d8..79590cef5 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -90,7 +90,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{matrix.os}}-${{matrix.architecture}} - path: *.tar.gz + path: ps3dev-*.tar.gz publish: needs: build From fb853f0888cfd291f87b6ab7da239970cc316dea Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 22:21:28 -0300 Subject: [PATCH 132/159] force loading .bashrc --- .github/workflows/deploy.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 79590cef5..0d011d803 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -68,10 +68,11 @@ jobs: pyenv global 3.11.0 pip install python-config echo 'pyenv global 3.11.0' >> ~/.bashrc + echo 'echo bashrc loaded' >> ~/.bashrc - name: Runs all the stages in the shell run: | - source ~/.bashrc + . ~/.bashrc mkdir -p $PWD/ps3dev export PS3DEV=$PWD/ps3dev export PSL1GHT=$PS3DEV From 1acdfb56c538de3c2f90d8ffb6633016c34c0936 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 22:27:02 -0300 Subject: [PATCH 133/159] pyenv init --path --- .github/workflows/deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 0d011d803..4fdfd815a 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -67,6 +67,7 @@ jobs: # Set Python 3.11 as the global version pyenv global 3.11.0 pip install python-config + echo 'eval "$(pyenv init --path)"' >> ~/.bashrc echo 'pyenv global 3.11.0' >> ~/.bashrc echo 'echo bashrc loaded' >> ~/.bashrc From 1defaf30d310373c7821dfab359333d69ed70a70 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 22:38:14 -0300 Subject: [PATCH 134/159] macos-latest --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4fdfd815a..7167ad0f0 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-14] + os: [ubuntu-latest, macos-latest] architecture: [x64] defaults: run: From 5f7ca93fdd06d1d2f6dfb483ff69047a3747a2eb Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 7 Apr 2024 23:57:05 -0300 Subject: [PATCH 135/159] remove arm64 --- .github/workflows/deploy-docker.yaml | 2 +- .github/workflows/deploy.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index 18ea5f6bd..ff2c88036 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -19,7 +19,7 @@ jobs: DOCKERHUB_REPONAME: ps3dev strategy: matrix: - platform: [linux/amd64, linux/arm64] + platform: [linux/amd64] steps: diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7167ad0f0..738c9022f 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] architecture: [x64] defaults: run: From da9c7f75fad22e45b61fbdd286ae5de5d8ac28ce Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 8 Apr 2024 00:36:10 -0300 Subject: [PATCH 136/159] recursive file path --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 738c9022f..334b3f84d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -119,5 +119,5 @@ jobs: with: tag_name: ${{ steps.semver.outputs.semver }} files: | - ${{ github.workspace }}/*.tar.gz + ${{ github.workspace }}/**/*.tar.gz From 060f03b33937f74310d132b656a35888616382da Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 11:20:20 -0300 Subject: [PATCH 137/159] Restore PPU gdb and python checks; make downloads resume across GNU mirrors --- archives/archives.txt | 1 - depends/check-python.sh | 12 +++++ download.sh | 100 +++++++++++++++++++++++++++++++--------- scripts/003-gdb-PPU.sh | 51 ++++++++++++++++++++ 4 files changed, 142 insertions(+), 22 deletions(-) create mode 100755 depends/check-python.sh create mode 100755 scripts/003-gdb-PPU.sh diff --git a/archives/archives.txt b/archives/archives.txt index c3cc50880..a7776b984 100644 --- a/archives/archives.txt +++ b/archives/archives.txt @@ -5,5 +5,4 @@ e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da 87858592 https: c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 14571004 https://sourceware.org/pub/newlib/newlib-1.20.0.tar.gz -> newlib-1.20.0.tar.gz 1e55b4d7cdca7b34be12f4ceae651623aa73b2fd640152313f9f66a7149757c4 20489528 https://sourceware.org/pub/gdb/releases/gdb-8.3.1.tar.xz -> gdb-8.3.1.tar.xz - - https://github.com/ps3dev/psl1ght/tarball/master -> psl1ght.tar.gz -- - https://github.com/ps3dev/psl1ght/tarball/master -> psl1ght.tar.gz - - https://github.com/ps3dev/ps3libraries/tarball/master -> ps3libraries.tar.gz diff --git a/depends/check-python.sh b/depends/check-python.sh new file mode 100755 index 000000000..90774e550 --- /dev/null +++ b/depends/check-python.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# check-python.sh by Naomi Peori (naomi@peori.ca) + +## Check for python. +( python --version || python -V ) 1>/dev/null 2>&1 || { echo "ERROR: Install python before continuing."; exit 1; } + +## Check for python-config +pyprefix=$(python-config --prefix || python3-config --prefix) +[ $? -eq 0 ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } + +## Check for python header files +( ls -1d "${pyprefix}"/include/python[23].*/Python.h || ls -1d /opt/local/include/python[23].*/Python.h ) 1>/dev/null 2>&1 || [ -f "$PYINSTALLDIR/include/Python.h" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } diff --git a/download.sh b/download.sh index 17d226b44..99df8510a 100755 --- a/download.sh +++ b/download.sh @@ -5,7 +5,8 @@ cd "$(dirname "$0")" cd archives || exit 1 ARCHIVE="archives.txt" -WGET="wget --tries=5 --timeout=15 --quiet --show-progress" +# 15s was aborting slow Sourceware transfers. Keep the partial file and resume. +WGET_OPTS=(--continue --tries=20 --timeout=60 --waitretry=5 --retry-connrefused --quiet --show-progress) # ----------------------------------------------------------------------------- # verify_sha256 @@ -29,17 +30,67 @@ verify_sha256() { return 0 } +file_size() { + wc -c < "$1" | tr -d ' ' +} + # ----------------------------------------------------------------------------- -# fetch +# mirror_urls +# Prints the primary URL plus GNU/kernel.org fallbacks. # ----------------------------------------------------------------------------- -fetch() { +mirror_urls() { url="$1" - dest="$2" - $WGET -O "$dest" "$url" || { - echo " !! Download failed: $url" >&2 - rm -f "$dest" - return 1 - } + file="$(basename "$url")" + printf '%s\n' "$url" + + case "$url" in + */binutils/releases/*|*/gnu/binutils/*) + printf '%s\n' \ + "https://ftpmirror.gnu.org/gnu/binutils/${file}" \ + "https://ftp.gnu.org/gnu/binutils/${file}" \ + "https://sourceware.org/pub/binutils/releases/${file}" \ + "https://mirrors.kernel.org/sourceware/binutils/releases/${file}" + ;; + */gcc/releases/*|*/gnu/gcc/*) + ver="${file%.tar.*}" + printf '%s\n' \ + "https://ftpmirror.gnu.org/gnu/gcc/${ver}/${file}" \ + "https://ftp.gnu.org/gnu/gcc/${ver}/${file}" \ + "https://sourceware.org/pub/gcc/releases/${ver}/${file}" \ + "https://gcc.gnu.org/pub/gcc/releases/${ver}/${file}" + ;; + */gdb/releases/*|*/gnu/gdb/*) + printf '%s\n' \ + "https://ftpmirror.gnu.org/gnu/gdb/${file}" \ + "https://ftp.gnu.org/gnu/gdb/${file}" \ + "https://sourceware.org/pub/gdb/releases/${file}" + ;; + */newlib/*) + printf '%s\n' \ + "https://sourceware.org/pub/newlib/${file}" \ + "https://mirrors.kernel.org/sourceware/newlib/${file}" + ;; + esac +} + +# ----------------------------------------------------------------------------- +# fetch [url...] +# Resumes into dest; does not delete a partial file on failure. +# ----------------------------------------------------------------------------- +fetch() { + dest="$1" + shift + url="" + for url in "$@"; do + [ -n "$url" ] || continue + echo " -> $url" + if wget "${WGET_OPTS[@]}" -O "$dest" "$url"; then + return 0 + fi + echo " !! failed, trying next mirror..." >&2 + done + echo " !! Download failed: ${1:-$url}" >&2 + return 1 } # ----------------------------------------------------------------------------- @@ -54,7 +105,6 @@ download() { printf '==> %s\n' "$file" - # If already present, verify immediately — size alone is not enough. if [ -f "$file" ]; then if [ "$sha" = "-" ]; then echo " -- no checksum, skipping re-download of existing file" @@ -64,19 +114,27 @@ download() { echo " -- already good" return 0 fi - echo " -- existing file failed verification, re-downloading..." - rm -f "$file" + actual=$(file_size "$file") + if [ "$size" != "-" ] && [ "$actual" -lt "$size" ]; then + echo " -- incomplete (${actual}/${size} bytes), resuming..." + else + echo " -- existing file failed verification, re-downloading..." + rm -f "$file" + fi fi - # First attempt - fetch "$url" "$file" + # Unique mirror list, primary URL first. + urls=$(mirror_urls "$url" | awk 'NF && !seen[$0]++') + + # shellcheck disable=SC2086 + fetch "$file" $urls - # Verify, with one retry on mismatch if [ "$sha" != "-" ]; then if ! verify_sha256 "$file" "$sha"; then - echo " -- retrying download..." + echo " -- checksum failed, retrying from another mirror..." rm -f "$file" - fetch "$url" "$file" + # shellcheck disable=SC2086 + fetch "$file" $urls verify_sha256 "$file" "$sha" || { rm -f "$file" echo " !! Giving up on $file" >&2 @@ -125,17 +183,17 @@ guess_url() { file="$1" case "$file" in binutils-*.tar.*) - printf 'https://sourceware.org/pub/binutils/releases/%s\n' "$file" + printf 'https://ftpmirror.gnu.org/gnu/binutils/%s\n' "$file" ;; gcc-*.tar.*) ver="${file%.tar.*}" - printf 'https://sourceware.org/pub/gcc/releases/%s/%s\n' "$ver" "$file" + printf 'https://ftpmirror.gnu.org/gnu/gcc/%s/%s\n' "$ver" "$file" ;; newlib-*.tar.*) printf 'https://sourceware.org/pub/newlib/%s\n' "$file" ;; gdb-*.tar.*) - printf 'https://ftp.gnu.org/gnu/gdb/%s\n' "$file" + printf 'https://ftpmirror.gnu.org/gnu/gdb/%s\n' "$file" ;; *) return 1 @@ -178,4 +236,4 @@ if [ "$#" -eq 0 ]; then run_all else run_one "$1" -fi \ No newline at end of file +fi diff --git a/scripts/003-gdb-PPU.sh b/scripts/003-gdb-PPU.sh new file mode 100755 index 000000000..bc17a7925 --- /dev/null +++ b/scripts/003-gdb-PPU.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -eo pipefail +# gdb-PPU.sh by Naomi Peori (naomi@peori.ca) + +GDB="gdb-8.3.1" +source ../utils/utils.sh + +if [ ! -d ${GDB} ]; then + + ## Download the source code. + ../download.sh ${GDB}.tar.xz + + ## Fetch config.guess and config.sub, falling back to copies if Savannah is unavailable + ../config/get-config-scripts.sh + + ## Unpack the source code. + unpack_if_needed "../archives/${GDB}.tar.xz" "${GDB}" + + ## Patch the source code. + apply_patch "../patches/${GDB}-PS3.patch" "${GDB}" + + ## Replace config.guess and config.sub + cp ../archives/config.guess ../archives/config.sub ${GDB} + +fi + +if [ ! -d ${GDB}/build-ppu ]; then + + ## Create the build directory. + mkdir ${GDB}/build-ppu + +fi + +## Enter the build directory. +cd ${GDB}/build-ppu + +## Configure the build. +## pyenv ships Python 3.10; gdb 8.3.1 cannot build against that ABI. +../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ + --disable-multilib \ + --disable-nls \ + --disable-sim \ + --disable-werror \ + --with-python=no \ + --without-guile + +## Compile and install. +PROCS="$(nproc --all 2>&1)" || ret=$? +if [ ! -z $ret ]; then PROCS=4; fi +${MAKE:-make} -j $PROCS +${MAKE:-make} libdir="$(pwd)/host-libs/lib" install From ed6725dd8befbcd347d776ea3bb21b169c0cc5df Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 11:28:28 -0300 Subject: [PATCH 138/159] Fix python check to find python3-config under pyenv --- depends/check-python.sh | 45 ++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/depends/check-python.sh b/depends/check-python.sh index 90774e550..b1d8076f1 100755 --- a/depends/check-python.sh +++ b/depends/check-python.sh @@ -1,12 +1,43 @@ #!/bin/sh # check-python.sh by Naomi Peori (naomi@peori.ca) -## Check for python. -( python --version || python -V ) 1>/dev/null 2>&1 || { echo "ERROR: Install python before continuing."; exit 1; } +## Prefer python3 (pyenv, Debian) over the unversioned python name. +python_bin="" +for c in python3 python; do + command -v "$c" >/dev/null 2>&1 || continue + python_bin="$c" + break +done +[ -n "$python_bin" ] || { echo "ERROR: Install python before continuing."; exit 1; } -## Check for python-config -pyprefix=$(python-config --prefix || python3-config --prefix) -[ $? -eq 0 ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } +## python-config is often not on PATH; pyenv ships python3-config next to the interpreter. +pyconfig="" +for c in python3-config python-config; do + command -v "$c" >/dev/null 2>&1 || continue + pyconfig="$c" + break +done +if [ -z "$pyconfig" ]; then + pyhome=$("$python_bin" -c "import sys; print(sys.base_prefix)") + for c in "$pyhome"/bin/python3-config "$pyhome"/bin/python*-config; do + [ -x "$c" ] || continue + pyconfig="$c" + break + done +fi +[ -n "$pyconfig" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } -## Check for python header files -( ls -1d "${pyprefix}"/include/python[23].*/Python.h || ls -1d /opt/local/include/python[23].*/Python.h ) 1>/dev/null 2>&1 || [ -f "$PYINSTALLDIR/include/Python.h" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } +pyprefix=$("$pyconfig" --prefix) || { echo "ERROR: Install python-dev before continuing."; exit 1; } + +python_h="" +for h in \ + "$pyprefix"/include/python*/Python.h \ + ${PYENV_ROOT:+$PYENV_ROOT/versions/*/include/python*/Python.h} \ + /opt/local/include/python*/Python.h \ + ${PYINSTALLDIR:+$PYINSTALLDIR/include/Python.h} +do + [ -f "$h" ] || continue + python_h="$h" + break +done +[ -n "$python_h" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } From 5d3414834ab75e6f40416dbca1accef4c266a791 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 11:35:35 -0300 Subject: [PATCH 139/159] Fix bundled zlib fdopen clash with Apple Clang 17 / Xcode 26 --- patches/binutils-2.22-PS3-SPU.patch | 18 ++++++++++++++++-- patches/binutils-2.42-PS3-PPU.patch | 21 ++++++++++++++++++--- patches/gcc-13.2.0-PS3-PPU.patch | 14 ++++++++++++++ patches/gcc-9.5.0-PS3-SPU.patch | 14 ++++++++++++++ patches/gdb-8.3.1-PS3.patch | 14 ++++++++++++++ scripts/001-binutils-PPU.sh | 3 ++- scripts/005-binutils-SPU.sh | 3 ++- scripts/006-gcc-newlib-SPU.sh | 3 ++- 8 files changed, 82 insertions(+), 8 deletions(-) diff --git a/patches/binutils-2.22-PS3-SPU.patch b/patches/binutils-2.22-PS3-SPU.patch index ac2ac2368..7caf8c785 100644 --- a/patches/binutils-2.22-PS3-SPU.patch +++ b/patches/binutils-2.22-PS3-SPU.patch @@ -86,5 +86,19 @@ index 20e0271..48df959 100644 + else if (config.has_pie) + link_info.pie = TRUE; else - einfo (_("%P%F: -pie not supported\n")); - break; + einfo (_("%P%F: -pie not supported\n")); + break; + +# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. +diff --git a/zlib/zutil.h b/zlib/zutil.h +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/binutils-2.42-PS3-PPU.patch b/patches/binutils-2.42-PS3-PPU.patch index e90893b99..f1aff8f97 100644 --- a/patches/binutils-2.42-PS3-PPU.patch +++ b/patches/binutils-2.42-PS3-PPU.patch @@ -70,6 +70,21 @@ diff '--color=auto' -urN a/ld/lexsup.c b/ld/lexsup.c } + else if (config.has_pie) + link_info.type = type_pie; - else - einfo (_("%F%P: -shared not supported\n")); - break; + else + einfo (_("%F%P: -shared not supported\n")); + break; + +# Apple Clang 17+ (Xcode 16.3 / macOS 26) defines TARGET_OS_MAC as a builtin. +# zlib then #define fdopen(...) NULL, which breaks the SDK fdopen prototype. +diff --git a/zlib/zutil.h b/zlib/zutil.h +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3-PPU.patch index 9573bf1cf..af919ada9 100644 --- a/patches/gcc-13.2.0-PS3-PPU.patch +++ b/patches/gcc-13.2.0-PS3-PPU.patch @@ -696,3 +696,17 @@ index 06a9398..7419f7e 100644 install-libiberty: installdirs @: $(MAKE); $(unstage) + +# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. +diff --git a/zlib/zutil.h b/zlib/zutil.h +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/gcc-9.5.0-PS3-SPU.patch b/patches/gcc-9.5.0-PS3-SPU.patch index 1292e356d..5c65bb271 100644 --- a/patches/gcc-9.5.0-PS3-SPU.patch +++ b/patches/gcc-9.5.0-PS3-SPU.patch @@ -703,3 +703,17 @@ diff '--color=auto' -urN a/Makefile.in b/Makefile.in install-libiberty: installdirs @: $(MAKE); $(unstage) + +# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. +diff --git a/zlib/zutil.h b/zlib/zutil.h +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/gdb-8.3.1-PS3.patch b/patches/gdb-8.3.1-PS3.patch index b2f3a1169..d5968b1f3 100644 --- a/patches/gdb-8.3.1-PS3.patch +++ b/patches/gdb-8.3.1-PS3.patch @@ -425,4 +425,18 @@ index c194e761a45..07b04fceb56 100644 +#endif #undef STRUCT_WINSIZE_IN_SYS_IOCTL + +# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. +diff --git a/zlib/zutil.h b/zlib/zutil.h +--- a/zlib/zutil.h ++++ b/zlib/zutil.h +@@ -137,7 +137,7 @@ + # endif + #endif + +-#if defined(MACOS) || defined(TARGET_OS_MAC) ++#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) + # define OS_CODE 7 + # ifndef Z_SOLO + # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index 89f93993b..dfc7c7395 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -49,7 +49,8 @@ unset LDFLAGS --disable-dependency-tracking \ --disable-werror \ --disable-gprofng \ - --disable-install-libiberty + --disable-install-libiberty \ + --with-system-zlib ## Compile and install. ## Do not override libdir: binutils 2.42 installs libdep.la into diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index a2c14967d..5bb9e368c 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -45,7 +45,8 @@ cd ${BINUTILS}/build-spu --with-gcc \ --with-gnu-as \ --with-gnu-ld \ - --enable-lto + --enable-lto \ + --with-system-zlib ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index a8a6e816a..7a24a5bef 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -64,7 +64,8 @@ CXXFLAGS="-Wno-int-conversion" \ --disable-multilib \ --disable-nls \ --disable-shared \ - --disable-win32-registry + --disable-win32-registry \ + --with-system-zlib ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? From 1f45c821cfc8619d1b52529242671cd11918bbba Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 11:51:04 -0300 Subject: [PATCH 140/159] Add Apple Silicon GCC host patches for 13.2.0 and 9.5.0 --- patches/gcc-13.2.0-PS3-macos-arm64.patch | 34 ++++++++++++++++++++++++ patches/gcc-9.5.0-PS3-macos-arm64.patch | 33 +++++++++++++++++++++++ scripts/006-gcc-newlib-SPU.sh | 5 ++++ utils/utils.sh | 4 +++ 4 files changed, 76 insertions(+) create mode 100644 patches/gcc-13.2.0-PS3-macos-arm64.patch create mode 100644 patches/gcc-9.5.0-PS3-macos-arm64.patch diff --git a/patches/gcc-13.2.0-PS3-macos-arm64.patch b/patches/gcc-13.2.0-PS3-macos-arm64.patch new file mode 100644 index 000000000..6e9a4ce59 --- /dev/null +++ b/patches/gcc-13.2.0-PS3-macos-arm64.patch @@ -0,0 +1,34 @@ +# Build GCC 13.2.0 as a cross compiler on Apple Silicon. +# host_detect_local_cpu / driver-aarch64.o are not linked for Darwin hosts, +# and host-darwin.cc must export host_hooks. +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -1179,7 +1179,7 @@ + + /* Extra specs when building a native AArch64-hosted compiler. + Option rewriting rules based on host system. */ +-#if defined(__aarch64__) ++#if defined(__aarch64__) && !defined(__APPLE__) + extern const char *host_detect_local_cpu (int argc, const char **argv); + #define HAVE_LOCAL_CPU_DETECT + # define EXTRA_SPEC_FUNCTIONS \ +diff --git a/gcc/config/host-darwin.cc b/gcc/config/host-darwin.cc +--- a/gcc/config/host-darwin.cc ++++ b/gcc/config/host-darwin.cc +@@ -23,6 +23,8 @@ + #include "options.h" + #include "diagnostic-core.h" + #include "config/host-darwin.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" + #include + + /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the +@@ -180,4 +182,6 @@ + } + + return 1; + } ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/patches/gcc-9.5.0-PS3-macos-arm64.patch b/patches/gcc-9.5.0-PS3-macos-arm64.patch new file mode 100644 index 000000000..015af682f --- /dev/null +++ b/patches/gcc-9.5.0-PS3-macos-arm64.patch @@ -0,0 +1,33 @@ +# Build GCC 9.5.0 as a cross compiler on Apple Silicon. +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -1083,7 +1083,7 @@ + #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ + { "rewrite_mcpu", aarch64_rewrite_mcpu }, + +-#if defined(__aarch64__) ++#if defined(__aarch64__) && !defined(__APPLE__) + extern const char *host_detect_local_cpu (int argc, const char **argv); + #define HAVE_LOCAL_CPU_DETECT + # define EXTRA_SPEC_FUNCTIONS \ +diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c +--- a/gcc/config/host-darwin.c ++++ b/gcc/config/host-darwin.c +@@ -22,6 +22,8 @@ + #include "coretypes.h" + #include "diagnostic-core.h" + #include "config/host-darwin.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" + + /* Yes, this is really supposed to work. */ + /* This allows for a pagesize of 16384, which we have on Darwin20, but should +@@ -77,4 +79,6 @@ + gcc_assert (!ret || mmap_result == addr); + } + + return ret; + } ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 7a24a5bef..352de3d28 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -21,6 +21,11 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-SPU.patch" "${GCC}" apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" + ## Patch for macOS arm64 + if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then + apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" + fi + ## Enter the source code directory. cd ${GCC} diff --git a/utils/utils.sh b/utils/utils.sh index e14946811..82ab4568b 100755 --- a/utils/utils.sh +++ b/utils/utils.sh @@ -50,6 +50,10 @@ unpack_if_needed() { # Usage: apply_patch apply_patch() { local patchfile="$1" srcdir="$2" + if [ ! -f "$patchfile" ]; then + echo "apply_patch: missing $patchfile" >&2 + return 1 + fi local stamp="$srcdir/.ps3-patched-$(basename "$patchfile")" if [ -f "$stamp" ]; then echo "Already patched: $srcdir ($(basename "$patchfile"))" From ae0c2603465e92af22be252b22a861af8c0eea9e Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 12:00:36 -0300 Subject: [PATCH 141/159] Fix Apple Silicon GCC patch hunks to match 13.2.0 and 9.5.0 sources --- patches/gcc-13.2.0-PS3-macos-arm64.patch | 6 ++---- patches/gcc-9.5.0-PS3-macos-arm64.patch | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-macos-arm64.patch b/patches/gcc-13.2.0-PS3-macos-arm64.patch index 6e9a4ce59..425f9bff9 100644 --- a/patches/gcc-13.2.0-PS3-macos-arm64.patch +++ b/patches/gcc-13.2.0-PS3-macos-arm64.patch @@ -4,15 +4,13 @@ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h -@@ -1179,7 +1179,7 @@ - +@@ -1191,5 +1191,5 @@ /* Extra specs when building a native AArch64-hosted compiler. - Option rewriting rules based on host system. */ + Option rewriting rules based on host system. */ -#if defined(__aarch64__) +#if defined(__aarch64__) && !defined(__APPLE__) extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT - # define EXTRA_SPEC_FUNCTIONS \ diff --git a/gcc/config/host-darwin.cc b/gcc/config/host-darwin.cc --- a/gcc/config/host-darwin.cc +++ b/gcc/config/host-darwin.cc diff --git a/patches/gcc-9.5.0-PS3-macos-arm64.patch b/patches/gcc-9.5.0-PS3-macos-arm64.patch index 015af682f..811921458 100644 --- a/patches/gcc-9.5.0-PS3-macos-arm64.patch +++ b/patches/gcc-9.5.0-PS3-macos-arm64.patch @@ -2,7 +2,7 @@ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h -@@ -1083,7 +1083,7 @@ +@@ -1088,6 +1088,6 @@ #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ { "rewrite_mcpu", aarch64_rewrite_mcpu }, @@ -10,7 +10,6 @@ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +#if defined(__aarch64__) && !defined(__APPLE__) extern const char *host_detect_local_cpu (int argc, const char **argv); #define HAVE_LOCAL_CPU_DETECT - # define EXTRA_SPEC_FUNCTIONS \ diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c --- a/gcc/config/host-darwin.c +++ b/gcc/config/host-darwin.c @@ -26,7 +25,7 @@ diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c @@ -77,4 +79,6 @@ gcc_assert (!ret || mmap_result == addr); } - + return ret; } + From bf78b4532e38603d7789250d334fa351c0c1cd5f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 12:22:36 -0300 Subject: [PATCH 142/159] Drop zlib fdopen hunk from binutils 2.22 SPU patch --- patches/binutils-2.22-PS3-SPU.patch | 14 -------------- scripts/005-binutils-SPU.sh | 5 ++--- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/patches/binutils-2.22-PS3-SPU.patch b/patches/binutils-2.22-PS3-SPU.patch index 7caf8c785..8fba3c6c1 100644 --- a/patches/binutils-2.22-PS3-SPU.patch +++ b/patches/binutils-2.22-PS3-SPU.patch @@ -88,17 +88,3 @@ index 20e0271..48df959 100644 else einfo (_("%P%F: -pie not supported\n")); break; - -# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. -diff --git a/zlib/zutil.h b/zlib/zutil.h ---- a/zlib/zutil.h -+++ b/zlib/zutil.h -@@ -137,7 +137,7 @@ - # endif - #endif - --#if defined(MACOS) || defined(TARGET_OS_MAC) -+#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) - # define OS_CODE 7 - # ifndef Z_SOLO - # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index 5bb9e368c..e4ae85cf5 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -14,11 +14,10 @@ if [ ! -d ${BINUTILS} ]; then ../config/get-config-scripts.sh ## Unpack the source code. - echo "Unpacking ${BINUTILS}" - extract "../archives/${BINUTILS}.tar.bz2" + unpack_if_needed "../archives/${BINUTILS}.tar.bz2" "${BINUTILS}" ## Patch the source code. - cat ../patches/${BINUTILS}-PS3-SPU.patch | patch -p1 -d ${BINUTILS} + apply_patch "../patches/${BINUTILS}-PS3-SPU.patch" "${BINUTILS}" ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${BINUTILS} From 5fe807cb5a066d60535f0f76ce7a746b90979ea2 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 13:02:15 -0300 Subject: [PATCH 143/159] Xcode 16.4 on Intel hits the same isupper/islower --- patches/gcc-13.2.0-PS3-macos.patch | 65 ++++++++++++++++++++++++++++++ patches/gcc-9.5.0-PS3-macos.patch | 64 +++++++++++++++++++++++++++++ scripts/002-gcc-newlib-PPU.sh | 6 ++- scripts/006-gcc-newlib-SPU.sh | 6 ++- 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 patches/gcc-13.2.0-PS3-macos.patch create mode 100644 patches/gcc-9.5.0-PS3-macos.patch diff --git a/patches/gcc-13.2.0-PS3-macos.patch b/patches/gcc-13.2.0-PS3-macos.patch new file mode 100644 index 000000000..312288610 --- /dev/null +++ b/patches/gcc-13.2.0-PS3-macos.patch @@ -0,0 +1,65 @@ +# libc++ 17+ (Xcode 16.4 / 26) pulls ctype APIs through /. +# GCC's safe-ctype.h poisons isupper/islower/etc; include C++ headers first. +# Apply on all Darwin hosts (Intel and Apple Silicon). Linux is unchanged. +diff --git a/gcc/system.h b/gcc/system.h +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -194,26 +194,8 @@ + #undef fread_unlocked + #undef fwrite_unlocked + +-/* Include before "safe-ctype.h" to avoid GCC poisoning +- the ctype macros through safe-ctype.h */ +- +-#ifdef __cplusplus +-#ifdef INCLUDE_STRING +-# include +-#endif +-#endif +- +-/* There are an extraordinary number of issues with . +- The last straw is that it varies with the locale. Use libiberty's +- replacement instead. */ +-#include "safe-ctype.h" +- +-#include +- +-#include +- +-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +-extern int errno; +-#endif ++/* Include C++ headers before "safe-ctype.h". libc++ 17+ (Xcode 16 / 26) ++ pulls ctype names through /; the poison macros break them. */ + + #ifdef __cplusplus + #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +@@ -226,6 +208,9 @@ + #ifdef INCLUDE_SET + # include + #endif ++#ifdef INCLUDE_STRING ++# include ++#endif + #ifdef INCLUDE_VECTOR + # include + #endif +@@ -244,6 +226,19 @@ + # include + #endif + ++/* There are an extraordinary number of issues with . ++ The last straw is that it varies with the locale. Use libiberty's ++ replacement instead. */ ++#include "safe-ctype.h" ++ ++#include ++ ++#include ++ ++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO ++extern int errno; ++#endif ++ + /* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ diff --git a/patches/gcc-9.5.0-PS3-macos.patch b/patches/gcc-9.5.0-PS3-macos.patch new file mode 100644 index 000000000..a533ac135 --- /dev/null +++ b/patches/gcc-9.5.0-PS3-macos.patch @@ -0,0 +1,64 @@ +# libc++ 17+ (Xcode 16.4 / 26) vs GCC safe-ctype.h. Darwin only (Intel and arm64). +diff --git a/gcc/system.h b/gcc/system.h +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -194,26 +194,8 @@ + #undef fread_unlocked + #undef fwrite_unlocked + +-/* Include before "safe-ctype.h" to avoid GCC poisoning +- the ctype macros through safe-ctype.h */ +- +-#ifdef __cplusplus +-#ifdef INCLUDE_STRING +-# include +-#endif +-#endif +- +-/* There are an extraordinary number of issues with . +- The last straw is that it varies with the locale. Use libiberty's +- replacement instead. */ +-#include "safe-ctype.h" +- +-#include +- +-#include +- +-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +-extern int errno; +-#endif ++/* Include C++ headers before "safe-ctype.h". libc++ 17+ (Xcode 16 / 26) ++ pulls ctype names through /; the poison macros break them. */ + + #ifdef __cplusplus + #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +@@ -229,6 +211,9 @@ + #ifdef INCLUDE_SET + # include + #endif ++#ifdef INCLUDE_STRING ++# include ++#endif + #ifdef INCLUDE_VECTOR + # include + #endif +@@ -235,6 +220,19 @@ + # include + # include + #endif + ++/* There are an extraordinary number of issues with . ++ The last straw is that it varies with the locale. Use libiberty's ++ replacement instead. */ ++#include "safe-ctype.h" ++ ++#include ++ ++#include ++ ++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO ++extern int errno; ++#endif ++ + /* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 6c72a920e..37b4f63aa 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -20,7 +20,11 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-PPU.patch" "${GCC}" apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" - ## Patch for macOS arm64 + ## libc++ 17+ (Xcode 16/26, Intel and Apple Silicon) + if [[ $(uname -s) == 'Darwin' ]]; then + apply_patch "../patches/${GCC}-PS3-macos.patch" "${GCC}" + fi + ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" fi diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 352de3d28..1eece6735 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -21,7 +21,11 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-SPU.patch" "${GCC}" apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" - ## Patch for macOS arm64 + ## libc++ 17+ (Xcode 16/26, Intel and Apple Silicon) + if [[ $(uname -s) == 'Darwin' ]]; then + apply_patch "../patches/${GCC}-PS3-macos.patch" "${GCC}" + fi + ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" fi From 4a556cfe32ed03380a125cecd2b58dfad1c4e42b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 13:12:34 -0300 Subject: [PATCH 144/159] Fix malformed Darwin GCC system.h patches so GNU patch can apply them. --- patches/gcc-13.2.0-PS3-macos.patch | 12 ++++++------ patches/gcc-9.5.0-PS3-macos.patch | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-macos.patch b/patches/gcc-13.2.0-PS3-macos.patch index 312288610..20cd3a3ed 100644 --- a/patches/gcc-13.2.0-PS3-macos.patch +++ b/patches/gcc-13.2.0-PS3-macos.patch @@ -1,10 +1,9 @@ -# libc++ 17+ (Xcode 16.4 / 26) pulls ctype APIs through /. -# GCC's safe-ctype.h poisons isupper/islower/etc; include C++ headers first. -# Apply on all Darwin hosts (Intel and Apple Silicon). Linux is unchanged. +# libc++ 17+ (Xcode 16.4 / 26) vs GCC safe-ctype.h. +# Darwin only (Intel and Apple Silicon). Linux does not apply this file. diff --git a/gcc/system.h b/gcc/system.h --- a/gcc/system.h +++ b/gcc/system.h -@@ -194,26 +194,8 @@ +@@ -194,27 +194,8 @@ #undef fread_unlocked #undef fwrite_unlocked @@ -34,7 +33,7 @@ diff --git a/gcc/system.h b/gcc/system.h #ifdef __cplusplus #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -226,6 +208,9 @@ +@@ -229,6 +210,9 @@ #ifdef INCLUDE_SET # include #endif @@ -44,7 +43,8 @@ diff --git a/gcc/system.h b/gcc/system.h #ifdef INCLUDE_VECTOR # include #endif -@@ -244,6 +226,19 @@ +@@ -244,6 +228,19 @@ + # include # include #endif diff --git a/patches/gcc-9.5.0-PS3-macos.patch b/patches/gcc-9.5.0-PS3-macos.patch index a533ac135..f9d1dcbd2 100644 --- a/patches/gcc-9.5.0-PS3-macos.patch +++ b/patches/gcc-9.5.0-PS3-macos.patch @@ -1,8 +1,8 @@ -# libc++ 17+ (Xcode 16.4 / 26) vs GCC safe-ctype.h. Darwin only (Intel and arm64). +# libc++ 17+ vs GCC safe-ctype.h. Darwin only (Intel and arm64). diff --git a/gcc/system.h b/gcc/system.h --- a/gcc/system.h +++ b/gcc/system.h -@@ -194,26 +194,8 @@ +@@ -194,27 +194,8 @@ #undef fread_unlocked #undef fwrite_unlocked @@ -32,7 +32,7 @@ diff --git a/gcc/system.h b/gcc/system.h #ifdef __cplusplus #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -229,6 +211,9 @@ +@@ -229,6 +210,9 @@ #ifdef INCLUDE_SET # include #endif @@ -42,7 +42,7 @@ diff --git a/gcc/system.h b/gcc/system.h #ifdef INCLUDE_VECTOR # include #endif -@@ -235,6 +220,19 @@ +@@ -236,6 +220,19 @@ # include # include #endif From 53900d0c704e195ccd21f2f5ba151bde5e2e2aad Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 13:40:47 -0300 Subject: [PATCH 145/159] Refresh newlib config.sub so Apple Silicon Darwin is a valid host. --- scripts/002-gcc-newlib-PPU.sh | 3 +++ scripts/006-gcc-newlib-SPU.sh | 3 +++ utils/utils.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 37b4f63aa..e94411d86 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -51,6 +51,9 @@ if [ ! -d ${GCC}/build-ppu ]; then fi +## newlib 1.20 config.sub rejects aarch64-apple-darwin (Apple Silicon). +refresh_config_scripts "${NEWLIB}" "${GCC}" + ## Enter the build directory. cd ${GCC}/build-ppu diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 1eece6735..396dba7c0 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -52,6 +52,9 @@ if [ ! -d ${GCC}/build-spu ]; then fi +## newlib 1.20 config.sub rejects aarch64-apple-darwin (Apple Silicon). +refresh_config_scripts "${NEWLIB}" "${GCC}" + ## Enter the build directory. cd ${GCC}/build-spu diff --git a/utils/utils.sh b/utils/utils.sh index 82ab4568b..d37545d40 100755 --- a/utils/utils.sh +++ b/utils/utils.sh @@ -61,4 +61,32 @@ apply_patch() { fi patch -p1 --batch --forward -d "$srcdir" < "$patchfile" touch "$stamp" +} + +# Replace GNU config.guess/config.sub so hosts like aarch64-apple-darwin +# are recognized. newlib 1.20 (and other old trees) ship copies that reject +# Apple Silicon. Always refresh, including rebuilds after a failed configure. +# Usage: refresh_config_scripts [srcdir...] +refresh_config_scripts() { + if [ $# -lt 1 ]; then + echo "refresh_config_scripts: missing source directory" >&2 + return 1 + fi + ../config/get-config-scripts.sh + local src_guess="../archives/config.guess" + local src_sub="../archives/config.sub" + if [ ! -f "$src_guess" ] || [ ! -f "$src_sub" ]; then + echo "refresh_config_scripts: missing $src_guess or $src_sub" >&2 + return 1 + fi + local dest + for dest in "$@"; do + if [ ! -d "$dest" ]; then + echo "refresh_config_scripts: not a directory: $dest" >&2 + return 1 + fi + echo "Refreshing config.guess/config.sub in $dest" + find "$dest" -name config.guess -exec cp "$src_guess" {} \; + find "$dest" -name config.sub -exec cp "$src_sub" {} \; + done } \ No newline at end of file From 97d977d958f3a397796e83c23d51845fc0dd5a7f Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 14:23:03 -0300 Subject: [PATCH 146/159] Fix malformed GCC 9.5.0 Apple Silicon host-darwin.c hunk --- patches/gcc-9.5.0-PS3-macos-arm64.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/gcc-9.5.0-PS3-macos-arm64.patch b/patches/gcc-9.5.0-PS3-macos-arm64.patch index 811921458..105902447 100644 --- a/patches/gcc-9.5.0-PS3-macos-arm64.patch +++ b/patches/gcc-9.5.0-PS3-macos-arm64.patch @@ -22,11 +22,11 @@ diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c /* Yes, this is really supposed to work. */ /* This allows for a pagesize of 16384, which we have on Darwin20, but should -@@ -77,4 +79,6 @@ - gcc_assert (!ret || mmap_result == addr); - } +@@ -76,5 +76,7 @@ + gcc_assert (!ret || mmap_result == addr); + } - return ret; + return ret; } + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; From 9a5a05163332b64359df92bec1a9091d872cf2a9 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Mon, 31 Aug 2026 15:00:52 -0300 Subject: [PATCH 147/159] Move the Intel macOS CI runner from 15 to 26. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f836b65b..4a0e1cb37 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - runner: ubuntu-latest os: linux - - runner: macos-15-intel + - runner: macos-26-intel os: macos - runner: macos-26 From 64e134199daa556ddbc4c61b1da4af0bc044ee0b Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 2 Sep 2026 10:18:40 -0300 Subject: [PATCH 148/159] Apply the safe-ctype and libcody host fixes on every OS, not only Darwin --- patches/gcc-13.2.0-PS3-host.patch | 281 ++++++++++++++++++ patches/gcc-13.2.0-PS3-macos.patch | 65 ---- ...3-macos.patch => gcc-9.5.0-PS3-host.patch} | 26 +- scripts/002-gcc-newlib-PPU.sh | 6 +- scripts/006-gcc-newlib-SPU.sh | 6 +- 5 files changed, 296 insertions(+), 88 deletions(-) create mode 100644 patches/gcc-13.2.0-PS3-host.patch delete mode 100644 patches/gcc-13.2.0-PS3-macos.patch rename patches/{gcc-9.5.0-PS3-macos.patch => gcc-9.5.0-PS3-host.patch} (75%) diff --git a/patches/gcc-13.2.0-PS3-host.patch b/patches/gcc-13.2.0-PS3-host.patch new file mode 100644 index 000000000..2581b3c60 --- /dev/null +++ b/patches/gcc-13.2.0-PS3-host.patch @@ -0,0 +1,281 @@ +# Host GCC 16 / libc++ 17+: include C++ headers before safe-ctype.h on every +# OS, and teach libcody about char8_t (u8"" is char8_t* under -fchar8_t). +diff --git a/gcc/system.h b/gcc/system.h +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -194,27 +194,9 @@ + #undef fread_unlocked + #undef fwrite_unlocked + +-/* Include before "safe-ctype.h" to avoid GCC poisoning +- the ctype macros through safe-ctype.h */ +- +-#ifdef __cplusplus +-#ifdef INCLUDE_STRING +-# include +-#endif +-#endif +- +-/* There are an extraordinary number of issues with . +- The last straw is that it varies with the locale. Use libiberty's +- replacement instead. */ +-#include "safe-ctype.h" +- +-#include +- +-#include +- +-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +-extern int errno; +-#endif ++/* Include C++ headers before "safe-ctype.h". Host GCC 16 libstdc++ and ++ libc++ 17+ pull ctype names through //; the ++ poison macros break islower/toupper. */ + + #ifdef __cplusplus + #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +@@ -243,8 +225,24 @@ + # include + # include + # include ++# include ++# include ++# include + #endif + ++/* There are an extraordinary number of issues with . ++ The last straw is that it varies with the locale. Use libiberty's ++ replacement instead. */ ++#include "safe-ctype.h" ++ ++#include ++ ++#include ++ ++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO ++extern int errno; ++#endif ++ + /* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ + #define __NO_STRING_INLINES +diff --git a/libcody/cody.hh b/libcody/cody.hh +--- a/libcody/cody.hh ++++ b/libcody/cody.hh +@@ -47,12 +47,21 @@ + + // C++11 doesn't have utf8 character literals :( + ++#if __cpp_char8_t >= 201811 + template ++constexpr char S2C (char8_t const (&s)[I]) ++{ ++ static_assert (I == 2, "only single octet strings may be converted"); ++ return s[0]; ++} ++#else ++template + constexpr char S2C (char const (&s)[I]) + { + static_assert (I == 2, "only single octet strings may be converted"); + return s[0]; + } ++#endif + + /// Internal buffering class. Used to concatenate outgoing messages + /// and Lex incoming ones. +@@ -122,7 +131,14 @@ + if (buffer.size () != lastBol) + Space (); + Append (str, maybe_quote, len); ++ } ++#if __cpp_char8_t >= 201811 ++ void AppendWord (char8_t const *str, bool maybe_quote = false, ++ size_t len = ~size_t (0)) ++ { ++ AppendWord ((const char *) str, maybe_quote, len); + } ++#endif + /// Add a word as with AppendWord + /// @param str the string to append + /// @param maybe_quote string might need quoting, as for Append +@@ -262,8 +278,14 @@ + } + Packet (unsigned c, std::string const &s) + : string (s), cat (STRING), code (c) ++ { ++ } ++#if __cpp_char8_t >= 201811 ++ Packet (unsigned c, const char8_t *s) ++ : string ((const char *) s), cat (STRING), code (c) + { + } ++#endif + Packet (unsigned c, std::vector &&v) + : vector (std::move (v)), cat (VECTOR), code (c) + { +diff --git a/libcody/client.cc b/libcody/client.cc +--- a/libcody/client.cc ++++ b/libcody/client.cc +@@ -97,7 +97,7 @@ + + static Packet CommunicationError (int err) + { +- std::string e {u8"communication error:"}; ++ std::string e {(const char *) u8"communication error:"}; + e.append (strerror (err)); + + return Packet (Client::PC_ERROR, std::move (e)); +@@ -110,33 +110,33 @@ + { + if (e == EINVAL) + { +- std::string msg (u8"malformed string '"); ++ std::string msg ((const char *) u8"malformed string '"); + msg.append (words[0]); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + return Packet (Client::PC_ERROR, std::move (msg)); + } + else +- return Packet (Client::PC_ERROR, u8"missing response"); ++ return Packet (Client::PC_ERROR, (const char *) u8"missing response"); + } + + Assert (!words.empty ()); +- if (words[0] == u8"ERROR") ++ if (words[0] == (const char *) u8"ERROR") + return Packet (Client::PC_ERROR, +- words.size () == 2 ? words[1]: u8"malformed error response"); ++ words.size () == 2 ? words[1]: (const char *) u8"malformed error response"); + + if (isLast && !read.IsAtEnd ()) + return Packet (Client::PC_ERROR, +- std::string (u8"unexpected extra response")); ++ std::string ((const char *) u8"unexpected extra response")); + + Assert (code < Detail::RC_HWM); + Packet result (responseTable[code] (words)); + result.SetRequest (code); + if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ()) + { +- std::string msg {u8"malformed response '"}; ++ std::string msg {(const char *) u8"malformed response '"}; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + result.GetString () = std::move (msg); + } + else if (result.GetCode () == Client::PC_CONNECT) +@@ -199,7 +199,7 @@ + size_t alen, size_t ilen) + { + write.BeginLine (); +- write.AppendWord (u8"HELLO"); ++ write.AppendWord ((const char *) u8"HELLO"); + write.AppendInteger (Version); + write.AppendWord (agent, true, alen); + write.AppendWord (ident, true, ilen); +@@ -211,7 +211,7 @@ + // HELLO $version $agent [$flags] + Packet ConnectResponse (std::vector &words) + { +- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4)) ++ if (words[0] == (const char *) u8"HELLO" && (words.size () == 3 || words.size () == 4)) + { + char *eptr; + unsigned long val = strtoul (words[1].c_str (), &eptr, 10); +@@ -247,7 +247,7 @@ + // PATHNAME $dir | ERROR + Packet PathnameResponse (std::vector &words) + { +- if (words[0] == u8"PATHNAME" && words.size () == 2) ++ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2) + return Packet (Client::PC_PATHNAME, std::move (words[1])); + + return Packet (Client::PC_ERROR, u8""); +@@ -256,7 +256,7 @@ + // OK or ERROR + Packet OKResponse (std::vector &words) + { +- if (words[0] == u8"OK") ++ if (words[0] == (const char *) u8"OK") + return Packet (Client::PC_OK); + else + return Packet (Client::PC_ERROR, +@@ -319,11 +319,11 @@ + // PATHNAME $cmifile + Packet IncludeTranslateResponse (std::vector &words) + { +- if (words[0] == u8"BOOL" && words.size () == 2) ++ if (words[0] == (const char *) u8"BOOL" && words.size () == 2) + { +- if (words[1] == u8"FALSE") ++ if (words[1] == (const char *) u8"FALSE") + return Packet (Client::PC_BOOL, 0); +- else if (words[1] == u8"TRUE") ++ else if (words[1] == (const char *) u8"TRUE") + return Packet (Client::PC_BOOL, 1); + else + return Packet (Client::PC_ERROR, u8""); +diff --git a/libcody/server.cc b/libcody/server.cc +--- a/libcody/server.cc ++++ b/libcody/server.cc +@@ -36,12 +36,12 @@ + const requestTable[Detail::RC_HWM] = + { + // Same order as enum RequestCode +- RequestPair {u8"HELLO", nullptr}, +- RequestPair {u8"MODULE-REPO", ModuleRepoRequest}, +- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest}, +- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest}, +- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest}, +- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, ++ RequestPair {(const char *) u8"HELLO", nullptr}, ++ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest}, ++ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest}, ++ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest}, ++ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest}, ++ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, + }; + } + +@@ -135,21 +135,21 @@ + std::string msg; + + if (err > 0) +- msg = u8"error processing '"; ++ msg = (const char *) u8"error processing '"; + else if (ix >= Detail::RC_HWM) +- msg = u8"unrecognized '"; ++ msg = (const char *) u8"unrecognized '"; + else if (IsConnected () && ix == Detail::RC_CONNECT) +- msg = u8"already connected '"; ++ msg = (const char *) u8"already connected '"; + else if (!IsConnected () && ix != Detail::RC_CONNECT) +- msg = u8"not connected '"; ++ msg = (const char *) u8"not connected '"; + else +- msg = u8"malformed '"; ++ msg = (const char *) u8"malformed '"; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + if (err > 0) + { +- msg.append (u8" "); ++ msg.append ((const char *) u8" "); + msg.append (strerror (err)); + } + resolver->ErrorResponse (this, std::move (msg)); +@@ -176,7 +176,7 @@ + return nullptr; + + if (words.size () == 3) +- words.emplace_back (u8""); ++ words.emplace_back ((const char *) u8""); + unsigned version = ParseUnsigned (words[1]); + if (version == ~0u) + return nullptr; diff --git a/patches/gcc-13.2.0-PS3-macos.patch b/patches/gcc-13.2.0-PS3-macos.patch deleted file mode 100644 index 20cd3a3ed..000000000 --- a/patches/gcc-13.2.0-PS3-macos.patch +++ /dev/null @@ -1,65 +0,0 @@ -# libc++ 17+ (Xcode 16.4 / 26) vs GCC safe-ctype.h. -# Darwin only (Intel and Apple Silicon). Linux does not apply this file. -diff --git a/gcc/system.h b/gcc/system.h ---- a/gcc/system.h -+++ b/gcc/system.h -@@ -194,27 +194,8 @@ - #undef fread_unlocked - #undef fwrite_unlocked - --/* Include before "safe-ctype.h" to avoid GCC poisoning -- the ctype macros through safe-ctype.h */ -- --#ifdef __cplusplus --#ifdef INCLUDE_STRING --# include --#endif --#endif -- --/* There are an extraordinary number of issues with . -- The last straw is that it varies with the locale. Use libiberty's -- replacement instead. */ --#include "safe-ctype.h" -- --#include -- --#include -- --#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO --extern int errno; --#endif -+/* Include C++ headers before "safe-ctype.h". libc++ 17+ (Xcode 16 / 26) -+ pulls ctype names through /; the poison macros break them. */ - - #ifdef __cplusplus - #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -229,6 +210,9 @@ - #ifdef INCLUDE_SET - # include - #endif -+#ifdef INCLUDE_STRING -+# include -+#endif - #ifdef INCLUDE_VECTOR - # include - #endif -@@ -244,6 +228,19 @@ - # include - # include - #endif - -+/* There are an extraordinary number of issues with . -+ The last straw is that it varies with the locale. Use libiberty's -+ replacement instead. */ -+#include "safe-ctype.h" -+ -+#include -+ -+#include -+ -+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO -+extern int errno; -+#endif -+ - /* Some of glibc's string inlines cause warnings. Plus we'd rather - rely on (and therefore test) GCC's string builtins. */ diff --git a/patches/gcc-9.5.0-PS3-macos.patch b/patches/gcc-9.5.0-PS3-host.patch similarity index 75% rename from patches/gcc-9.5.0-PS3-macos.patch rename to patches/gcc-9.5.0-PS3-host.patch index f9d1dcbd2..3306f48a8 100644 --- a/patches/gcc-9.5.0-PS3-macos.patch +++ b/patches/gcc-9.5.0-PS3-host.patch @@ -1,8 +1,8 @@ -# libc++ 17+ vs GCC safe-ctype.h. Darwin only (Intel and arm64). +# Host GCC 16 / libc++ 17+: include C++ headers before safe-ctype.h on every OS. diff --git a/gcc/system.h b/gcc/system.h --- a/gcc/system.h +++ b/gcc/system.h -@@ -194,27 +194,8 @@ +@@ -194,27 +194,9 @@ #undef fread_unlocked #undef fwrite_unlocked @@ -27,24 +27,19 @@ diff --git a/gcc/system.h b/gcc/system.h -#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO -extern int errno; -#endif -+/* Include C++ headers before "safe-ctype.h". libc++ 17+ (Xcode 16 / 26) -+ pulls ctype names through /; the poison macros break them. */ ++/* Include C++ headers before "safe-ctype.h". Host GCC 16 libstdc++ and ++ libc++ 17+ pull ctype names through //; the ++ poison macros break islower/toupper. */ #ifdef __cplusplus #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -229,6 +210,9 @@ - #ifdef INCLUDE_SET - # include - #endif -+#ifdef INCLUDE_STRING -+# include -+#endif - #ifdef INCLUDE_VECTOR - # include - #endif -@@ -236,6 +220,19 @@ +@@ -235,8 +217,24 @@ + # include # include # include ++# include ++# include ++# include #endif +/* There are an extraordinary number of issues with . @@ -62,3 +57,4 @@ diff --git a/gcc/system.h b/gcc/system.h + /* Some of glibc's string inlines cause warnings. Plus we'd rather rely on (and therefore test) GCC's string builtins. */ + #define __NO_STRING_INLINES diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index e94411d86..fcb0da8a3 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -20,10 +20,8 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-PPU.patch" "${GCC}" apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" - ## libc++ 17+ (Xcode 16/26, Intel and Apple Silicon) - if [[ $(uname -s) == 'Darwin' ]]; then - apply_patch "../patches/${GCC}-PS3-macos.patch" "${GCC}" - fi + ## Host GCC 16 / libc++ 17+: safe-ctype vs /, libcody char8_t + apply_patch "../patches/${GCC}-PS3-host.patch" "${GCC}" ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 396dba7c0..2b1fcc476 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -21,10 +21,8 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-SPU.patch" "${GCC}" apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" - ## libc++ 17+ (Xcode 16/26, Intel and Apple Silicon) - if [[ $(uname -s) == 'Darwin' ]]; then - apply_patch "../patches/${GCC}-PS3-macos.patch" "${GCC}" - fi + ## Host GCC 16 / libc++ 17+: safe-ctype vs / + apply_patch "../patches/${GCC}-PS3-host.patch" "${GCC}" ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" From a27ba07d006586058eb179910a4872fab2e68a1d Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 2 Sep 2026 15:05:21 -0300 Subject: [PATCH 149/159] Build with host GCC 16.2 in Docker and fix C23/C++20 failures on modern compilers. --- .github/workflows/build.yml | 16 ++++++++++++++++ Dockerfile | 29 +++++++++++++++++++---------- patches/gcc-13.2.0-PS3-host.patch | 8 ++++++-- scripts/003-gdb-PPU.sh | 4 ++++ scripts/005-binutils-SPU.sh | 2 ++ scripts/007-gdb-SPU.sh | 4 ++++ 6 files changed, 51 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a0e1cb37..b0e5fe5ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,22 @@ jobs: working-directory: ./build run: ../download.sh + - name: Show host GCC version + shell: bash + run: | + echo "which gcc: $(command -v gcc || true)" + echo "which g++: $(command -v g++ || true)" + echo "which cc: $(command -v cc || true)" + echo "----- gcc --version -----" + gcc --version + echo "----- g++ --version -----" + g++ --version + echo "----- cc --version -----" + cc --version + echo "----- gcc -dumpfullversion / -dumpmachine -----" + gcc -dumpfullversion -dumpversion + gcc -dumpmachine + - name: Build Binutils (PPU) run: ./toolchain.sh 001 diff --git a/Dockerfile b/Dockerfile index 1c9f0d2a1..ef0d59561 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM debian:12-slim AS base +# Host compiler is GCC 16.2.0 from the official image (Debian Trixie). +FROM gcc:16.2.0-trixie AS base LABEL maintainer="miigotu@gmail.com" ENV PS3DEV=/usr/local/ps3dev \ @@ -7,26 +8,34 @@ ENV PS3DEV=/usr/local/ps3dev \ PYTHON_VERSION=3.10 \ PYENV_ROOT=/root/.pyenv \ PIP_ROOT_USER_ACTION=ignore \ - PKG_CONFIG_PATH=/usr/local/ps3dev/portlibs/ppu/lib/pkgconfig + PKG_CONFIG_PATH=/usr/local/ps3dev/portlibs/ppu/lib/pkgconfig \ + CC=gcc \ + CXX=g++ ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin" -RUN apt update -y && \ - apt --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ - ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ +RUN apt-get update -y && \ + apt-get --no-install-recommends install -y autoconf automake bison bzip2 \ + ca-certificates cmake flex gettext-base git libelf-dev libgmp-dev libncurses-dev libssl-dev \ libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ # Fixes certificate errors with letsencrypt in ARMv7 echo 'ca_certificate=/etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc && \ - # Install dependencies specific for amd64 architecture - if [ "$(uname -m)" = "x86_64" ]; then apt install -y nvidia-cg-toolkit ; fi && \ + # nvidia-cg-toolkit is non-free and amd64-only + if [ "$(uname -m)" = "x86_64" ]; then \ + if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ + sed -i 's/Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources ; \ + fi && \ + apt-get update -y && apt-get install -y nvidia-cg-toolkit ; \ + fi && \ # pyenv - apt --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ - llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ + apt-get --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ + llvm libncurses-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc && \ git config --global http.sslverify 'false' && \ curl https://pyenv.run | bash && \ pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \ pip install pycrypto && \ - apt -y clean autoclean autoremove + apt-get -y clean autoclean autoremove && \ + rm -rf /var/lib/apt/lists/* FROM base AS builder RUN mkdir /build diff --git a/patches/gcc-13.2.0-PS3-host.patch b/patches/gcc-13.2.0-PS3-host.patch index 2581b3c60..7f586508d 100644 --- a/patches/gcc-13.2.0-PS3-host.patch +++ b/patches/gcc-13.2.0-PS3-host.patch @@ -1,5 +1,7 @@ # Host GCC 16 / libc++ 17+: include C++ headers before safe-ctype.h on every # OS, and teach libcody about char8_t (u8"" is char8_t* under -fchar8_t). +# Packet (unsigned, size_t) vs Packet (unsigned, char8_t*) is ambiguous for +# integer 0 on C++20+ host compilers; cast BOOL payloads to size_t. diff --git a/gcc/system.h b/gcc/system.h --- a/gcc/system.h +++ b/gcc/system.h @@ -213,10 +215,12 @@ diff --git a/libcody/client.cc b/libcody/client.cc { - if (words[1] == u8"FALSE") + if (words[1] == (const char *) u8"FALSE") - return Packet (Client::PC_BOOL, 0); +- return Packet (Client::PC_BOOL, 0); ++ return Packet (Client::PC_BOOL, size_t (0)); - else if (words[1] == u8"TRUE") + else if (words[1] == (const char *) u8"TRUE") - return Packet (Client::PC_BOOL, 1); +- return Packet (Client::PC_BOOL, 1); ++ return Packet (Client::PC_BOOL, size_t (1)); else return Packet (Client::PC_ERROR, u8""); diff --git a/libcody/server.cc b/libcody/server.cc diff --git a/scripts/003-gdb-PPU.sh b/scripts/003-gdb-PPU.sh index bc17a7925..4866d57ce 100755 --- a/scripts/003-gdb-PPU.sh +++ b/scripts/003-gdb-PPU.sh @@ -36,6 +36,10 @@ cd ${GDB}/build-ppu ## Configure the build. ## pyenv ships Python 3.10; gdb 8.3.1 cannot build against that ABI. +## Host GCC 15/16 default to C23; bundled readline expects pre-C23 +## unprototyped signal handlers (VOID_SIGHANDLER). +CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion" \ +CXXFLAGS="${CXXFLAGS:-} -std=gnu++17 -Wno-narrowing" \ ../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ --disable-multilib \ --disable-nls \ diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index e4ae85cf5..14b7e41b4 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -35,6 +35,8 @@ fi cd ${BINUTILS}/build-spu ## Configure the build. +## Host GCC 15/16 default to C23; binutils 2.22 uses K&R-era C. +CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-implicit-function-declaration" \ ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-nls \ --disable-shared \ diff --git a/scripts/007-gdb-SPU.sh b/scripts/007-gdb-SPU.sh index 0928aa588..48d9563d9 100755 --- a/scripts/007-gdb-SPU.sh +++ b/scripts/007-gdb-SPU.sh @@ -36,6 +36,10 @@ cd ${GDB}/build-spu ## Configure the build. ## pyenv ships Python 3.10; gdb 8.3.1 cannot build against that ABI. +## Host GCC 15/16 default to C23; bundled readline expects pre-C23 +## unprototyped signal handlers (VOID_SIGHANDLER). +CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion" \ +CXXFLAGS="${CXXFLAGS:-} -std=gnu++17 -Wno-narrowing" \ ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-nls \ --disable-sim \ From 2390d777860002680b30d3196dd6329757130c13 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 2 Sep 2026 16:30:48 -0300 Subject: [PATCH 150/159] Stay on Debian 12 so the host-linked cross gcc needs only glibc 2.36 --- Dockerfile | 20 +++++++++----------- scripts/009-ps3libraries.sh | 3 +++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef0d59561..986ce50a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -# Host compiler is GCC 16.2.0 from the official image (Debian Trixie). -FROM gcc:16.2.0-trixie AS base +# Stay on Debian 12 so the host-linked cross gcc needs only glibc 2.36 +# (Bookworm). Building on Trixie produces GLIBC_2.38+ binaries that fail +# on Debian 12 and similar hosts. +FROM debian:12-slim AS base LABEL maintainer="miigotu@gmail.com" ENV PS3DEV=/usr/local/ps3dev \ @@ -8,27 +10,23 @@ ENV PS3DEV=/usr/local/ps3dev \ PYTHON_VERSION=3.10 \ PYENV_ROOT=/root/.pyenv \ PIP_ROOT_USER_ACTION=ignore \ - PKG_CONFIG_PATH=/usr/local/ps3dev/portlibs/ppu/lib/pkgconfig \ - CC=gcc \ - CXX=g++ + PKG_CONFIG_PATH=/usr/local/ps3dev/portlibs/ppu/lib/pkgconfig ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin" RUN apt-get update -y && \ - apt-get --no-install-recommends install -y autoconf automake bison bzip2 \ - ca-certificates cmake flex gettext-base git libelf-dev libgmp-dev libncurses-dev libssl-dev \ + apt-get --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ + ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ # Fixes certificate errors with letsencrypt in ARMv7 echo 'ca_certificate=/etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc && \ # nvidia-cg-toolkit is non-free and amd64-only if [ "$(uname -m)" = "x86_64" ]; then \ - if [ -f /etc/apt/sources.list.d/debian.sources ]; then \ - sed -i 's/Components: main$/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources ; \ - fi && \ + sed -i 's/ main$/ main contrib non-free non-free-firmware/' /etc/apt/sources.list && \ apt-get update -y && apt-get install -y nvidia-cg-toolkit ; \ fi && \ # pyenv apt-get --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ - llvm libncurses-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ + llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc && \ git config --global http.sslverify 'false' && \ curl https://pyenv.run | bash && \ diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 1236e6235..3d899dda1 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -10,6 +10,9 @@ fi source ../utils/utils.sh +## Host CC/CXX (common in Docker) makes autotools skip powerpc64-ps3-elf-gcc. +unset CC CXX CPP + ## Download the source code. ../download.sh ps3libraries.tar.gz From d6215a36a344a631733042668741b4f6f7f08183 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 13 Sep 2026 14:55:54 -0300 Subject: [PATCH 151/159] Stop applying the removed combined SPU GCC patch. The upstream merge left a cat of gcc-9.5.0-PS3.patch; SPU already uses the -SPU/-host/-macos-arm64 patches. --- scripts/006-gcc-newlib-SPU.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index fec3e50b4..f3434faff 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -31,9 +31,6 @@ if [ ! -d ${GCC} ]; then apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" fi - ## Patch the source code. - cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} - ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${GCC} From d46ecd5bba1dd998fee29daf935a0a359dd752fc Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 13 Sep 2026 17:55:37 -0300 Subject: [PATCH 152/159] Keep GCC 9.5.0 Darwin host files off the PPU 13.2.0 patch. The last master merge applied those hunks to gcc-13.2.0-PS3-PPU.patch; they already exist in GCC 13 and make GNU patch fail on Linux after zlib. --- patches/gcc-13.2.0-PS3-PPU.patch | 79 +------------------------ patches/gcc-9.5.0-PS3-macos-arm64.patch | 73 +++++++++++++++++++++++ 2 files changed, 76 insertions(+), 76 deletions(-) diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3-PPU.patch index 4f77f30bb..df5564463 100644 --- a/patches/gcc-13.2.0-PS3-PPU.patch +++ b/patches/gcc-13.2.0-PS3-PPU.patch @@ -32,81 +32,8 @@ index 648b3dc2110..650d65fe28d 100644 + tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + ;; powerpc-*-darwin*) - extra_options="${extra_options} ${cpu_type}/darwin.opt" - case ${target} in -diff --git a/gcc/config.host b/gcc/config.host -index 816a0f06cb..2d9bf9ed48 100644 ---- a/gcc/config.host -+++ b/gcc/config.host -@@ -99,7 +99,8 @@ case ${host} in - esac - - case ${host} in -- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) -+ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ -+ aarch64*-*-darwin*) - case ${target} in - aarch64*-*-*) - host_extra_gcc_objs="driver-aarch64.o" -@@ -251,6 +252,10 @@ case ${host} in - host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" - host_lto_plugin_soname=liblto_plugin-0.dll - ;; -+ aarch64*-*-darwin*) -+ out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o" -+ host_xmake_file="${host_xmake_file} aarch64/x-darwin" -+ ;; - i[34567]86-*-darwin* | x86_64-*-darwin*) - out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o" - host_xmake_file="${host_xmake_file} i386/x-darwin" -diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c -new file mode 100644 -index 0000000000..d70f2df3bf ---- /dev/null -+++ b/gcc/config/aarch64/host-aarch64-darwin.c -@@ -0,0 +1,33 @@ -+/* aarch64/arm64-darwin host-specific hook definitions. -+ -+Copyright The GNU Toolchain Authors. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify it under -+the terms of the GNU General Public License as published by the Free -+Software Foundation; either version 3, or (at your option) any later -+version. -+ -+GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+WARRANTY; without even the implied warranty of MERCHANTABILITY or -+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+#define IN_TARGET_CODE 1 -+ -+#include "config.h" -+#include "system.h" -+#include "coretypes.h" -+#include "hosthooks.h" -+#include "hosthooks-def.h" -+#include "config/host-darwin.h" -+ -+/* Darwin doesn't do anything special for arm64/aarch64 hosts; this file -+ exists just to include the generic config/host-darwin.h. */ -+ -+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; -diff --git a/gcc/config/aarch64/x-darwin b/gcc/config/aarch64/x-darwin -new file mode 100644 -index 0000000000..6d788d5e89 ---- /dev/null -+++ b/gcc/config/aarch64/x-darwin -@@ -0,0 +1,3 @@ -+host-aarch64-darwin.o : $(srcdir)/config/aarch64/host-aarch64-darwin.c -+ $(COMPILE) $< -+ $(POSTCOMPILE) + extra_options="${extra_options} ${cpu_type}/darwin.opt" + case ${target} in diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h new file mode 100644 index 00000000000..df93791e501 @@ -798,7 +725,7 @@ index 00000000000..9eb9ca7ac35 diff --git a/zlib/zutil.h b/zlib/zutil.h --- a/zlib/zutil.h +++ b/zlib/zutil.h -@@ -137,7 +137,7 @@ +@@ -130,7 +130,7 @@ # endif #endif diff --git a/patches/gcc-9.5.0-PS3-macos-arm64.patch b/patches/gcc-9.5.0-PS3-macos-arm64.patch index 105902447..1442b1a90 100644 --- a/patches/gcc-9.5.0-PS3-macos-arm64.patch +++ b/patches/gcc-9.5.0-PS3-macos-arm64.patch @@ -30,3 +30,76 @@ diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c } + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; +diff --git a/gcc/config.host b/gcc/config.host +index 816a0f06cb..2d9bf9ed48 100644 +--- a/gcc/config.host ++++ b/gcc/config.host +@@ -99,7 +99,8 @@ case ${host} in + esac + + case ${host} in +- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) ++ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ ++ aarch64*-*-darwin*) + case ${target} in + aarch64*-*-*) + host_extra_gcc_objs="driver-aarch64.o" +@@ -251,6 +252,10 @@ case ${host} in + host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" + host_lto_plugin_soname=liblto_plugin-0.dll + ;; ++ aarch64*-*-darwin*) ++ out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o" ++ host_xmake_file="${host_xmake_file} aarch64/x-darwin" ++ ;; + i[34567]86-*-darwin* | x86_64-*-darwin*) + out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o" + host_xmake_file="${host_xmake_file} i386/x-darwin" +diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c +new file mode 100644 +index 0000000000..d70f2df3bf +--- /dev/null ++++ b/gcc/config/aarch64/host-aarch64-darwin.c +@@ -0,0 +1,33 @@ ++/* aarch64/arm64-darwin host-specific hook definitions. ++ ++Copyright The GNU Toolchain Authors. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#define IN_TARGET_CODE 1 ++ ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" ++#include "config/host-darwin.h" ++ ++/* Darwin doesn't do anything special for arm64/aarch64 hosts; this file ++ exists just to include the generic config/host-darwin.h. */ ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; +diff --git a/gcc/config/aarch64/x-darwin b/gcc/config/aarch64/x-darwin +new file mode 100644 +index 0000000000..6d788d5e89 +--- /dev/null ++++ b/gcc/config/aarch64/x-darwin +@@ -0,0 +1,3 @@ ++host-aarch64-darwin.o : $(srcdir)/config/aarch64/host-aarch64-darwin.c ++ $(COMPILE) $< ++ $(POSTCOMPILE) From ec5410b96a048d25d560ebb8097e735a80b12a3a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 22 Sep 2026 11:34:16 -0300 Subject: [PATCH 153/159] kill old macos compatibility using mac-15-intel --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0e5fe5ee..4b741e40b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - runner: ubuntu-latest os: linux - - runner: macos-26-intel + - runner: mac-15-intel os: macos - runner: macos-26 @@ -159,4 +159,4 @@ jobs: run: | TAG="nightly-$(date -u +%Y-%m-%d)" gh release delete "$TAG" --yes --cleanup-tag || true - gh release create "$TAG" artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t "$TAG" --prerelease \ No newline at end of file + gh release create "$TAG" artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t "$TAG" --prerelease From fce08b7b59b30c3dd19f80c11f9affaa19dc4962 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Tue, 22 Sep 2026 18:04:56 -0300 Subject: [PATCH 154/159] Revert "kill old macos compatibility using mac-15-intel" This reverts commit ec5410b96a048d25d560ebb8097e735a80b12a3a. --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b741e40b..b0e5fe5ee 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - runner: ubuntu-latest os: linux - - runner: mac-15-intel + - runner: macos-26-intel os: macos - runner: macos-26 @@ -159,4 +159,4 @@ jobs: run: | TAG="nightly-$(date -u +%Y-%m-%d)" gh release delete "$TAG" --yes --cleanup-tag || true - gh release create "$TAG" artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t "$TAG" --prerelease + gh release create "$TAG" artifacts/*.tar.gz --target ${{ GITHUB.SHA }} -t "$TAG" --prerelease \ No newline at end of file From 6f580eaa6460f8d796048798da10637834bba853 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Wed, 23 Sep 2026 09:35:15 -0300 Subject: [PATCH 155/159] Always skipped. Pushing :latest needs the DockerHub environment, which # fails closed in a few seconds when those secrets are unavailable --- .github/workflows/deploy-docker.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml index ff2c88036..4c1f0305a 100644 --- a/.github/workflows/deploy-docker.yaml +++ b/.github/workflows/deploy-docker.yaml @@ -13,6 +13,9 @@ on: jobs: dockerhub-push: + # Always skipped. Pushing :latest needs the DockerHub environment, which + # fails closed in a few seconds when those secrets are unavailable. + if: false runs-on: ubuntu-latest environment: DockerHub env: From dc485236434b88dca91e75468af1400a361c2dac Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sat, 10 Oct 2026 17:16:48 -0300 Subject: [PATCH 156/159] Drop the unrelated changes from the GCC branch. CI, the Docker image, the PPU binutils 2.42 bump, the gdb restore, and the config.guess helpers do not belong here. The host GCC 16 and Apple Silicon fixes, resumable downloads, and the ps3libraries cross compiler stay. --- .github/workflows/build.yml | 18 +- .github/workflows/deploy-docker.yaml | 64 ----- .github/workflows/deploy.yaml | 94 ++----- .gitignore | 4 +- Dockerfile | 59 ++--- archives/archives.txt | 6 +- depends/check-python.sh | 43 ---- ...-PS3-SPU.patch => binutils-2.22-PS3.patch} | 4 +- patches/binutils-2.42-PS3-PPU.patch | 90 ------- ...2.0-PS3-PPU.patch => gcc-13.2.0-PS3.patch} | 0 ....5.0-PS3-SPU.patch => gcc-9.5.0-PS3.patch} | 0 patches/gdb-8.3.1-PS3.patch | 233 ++++++++---------- scripts/001-binutils-PPU.sh | 33 +-- scripts/002-gcc-newlib-PPU.sh | 28 ++- scripts/003-gdb-PPU.sh | 55 ----- scripts/005-binutils-SPU.sh | 9 +- scripts/006-gcc-newlib-SPU.sh | 31 ++- scripts/007-gdb-SPU.sh | 54 ---- toolchain.sh | 2 +- utils/utils.sh | 58 ----- 20 files changed, 200 insertions(+), 685 deletions(-) delete mode 100644 .github/workflows/deploy-docker.yaml delete mode 100755 depends/check-python.sh rename patches/{binutils-2.22-PS3-SPU.patch => binutils-2.22-PS3.patch} (97%) delete mode 100644 patches/binutils-2.42-PS3-PPU.patch rename patches/{gcc-13.2.0-PS3-PPU.patch => gcc-13.2.0-PS3.patch} (100%) rename patches/{gcc-9.5.0-PS3-SPU.patch => gcc-9.5.0-PS3.patch} (100%) delete mode 100755 scripts/003-gdb-PPU.sh delete mode 100755 scripts/007-gdb-SPU.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0e5fe5ee..8f836b65b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: - runner: ubuntu-latest os: linux - - runner: macos-26-intel + - runner: macos-15-intel os: macos - runner: macos-26 @@ -92,22 +92,6 @@ jobs: working-directory: ./build run: ../download.sh - - name: Show host GCC version - shell: bash - run: | - echo "which gcc: $(command -v gcc || true)" - echo "which g++: $(command -v g++ || true)" - echo "which cc: $(command -v cc || true)" - echo "----- gcc --version -----" - gcc --version - echo "----- g++ --version -----" - g++ --version - echo "----- cc --version -----" - cc --version - echo "----- gcc -dumpfullversion / -dumpmachine -----" - gcc -dumpfullversion -dumpversion - gcc -dumpmachine - - name: Build Binutils (PPU) run: ./toolchain.sh 001 diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml deleted file mode 100644 index 4c1f0305a..000000000 --- a/.github/workflows/deploy-docker.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: ci-docker -on: - pull_request: - branches: - - master - - # Runs on pushes targeting the default branch - push: - branches: ['master'] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - dockerhub-push: - # Always skipped. Pushing :latest needs the DockerHub environment, which - # fails closed in a few seconds when those secrets are unavailable. - if: false - runs-on: ubuntu-latest - environment: DockerHub - env: - DOCKERHUB_REPONAME: ps3dev - strategy: - matrix: - platform: [linux/amd64] - - steps: - - - name: Checkout - uses: actions/checkout@v4 - - - name: README to Dockerhub - uses: christian-korneck/update-container-description-action@v1 - env: - DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} - with: - destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }} - provider: dockerhub - short_description: 'A Docker Image for PS3 Development' - readme_file: 'README.md' - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - with: - platforms: ${{ matrix.platform }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - platforms: ${{ matrix.platform }} - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_REPONAME }}:latest \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 4f1be9020..9aa99971d 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,24 +1,11 @@ -name: ci +name: Build toolchain docker image on: workflow_dispatch jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - architecture: [x64] - defaults: - run: - shell: bash - - outputs: - sha8: ${{ steps.slug.outputs.sha8 }} - date: ${{ steps.date.outputs.date }} - + Docker: + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 @@ -36,13 +23,19 @@ jobs: if: success() id: prepare run: | - sudo apt update - sudo apt -y install autoconf automake bison flex gcc g++ libelf-dev make texinfo libncurses5-dev patch python2-dev subversion wget zlib1g-dev libtool-bin python-dev-is-python3 bzip2 libgmp3-dev pkg-config libssl-dev && \ - if [ "$(uname -m)" = "x86_64" ]; then sudo apt install -y nvidia-cg-toolkit ; fi - - - name: Install macOS requirements - if: startsWith(matrix.os, 'macos') - # act -P macos-latest=-self-hosted --container-architecture linux/amd64 + echo ::set-output name=docker_platforms::linux/amd64,linux/386 + echo ::set-output name=docker_username::miigotu + echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3dev + VERSION_TAG=${GITHUB_REF#refs/*/} + echo ::set-output name=version::${VERSION_TAG%/merge} + - name: Available platforms + if: success() + run: echo ${{ steps.buildx.outputs.platforms }} + - name: Docker Login and set build command + if: success() + id: login + env: + GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: | echo "${GITHUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin docker.pkg.github.com echo ::set-output name=buildx::$(echo docker buildx build --output type=image,name=${{ steps.prepare.outputs.github_image }},push=true \ @@ -59,51 +52,12 @@ jobs: - name: Run Buildx (master) if: success() && steps.prepare.outputs.version == 'master' && github.event_name != 'pull_request' run: | - . ~/.bashrc - mkdir -p $PWD/ps3dev - export PS3DEV=$PWD/ps3dev - export PSL1GHT=$PS3DEV - export PATH=$PATH:$PS3DEV/bin - export PATH=$PATH:$PS3DEV/ppu/bin - export PATH=$PATH:$PS3DEV/spu/bin - export PATH=$PATH:$PS3DEV/portlibs/ppu/bin - export PKG_CONFIG_PATH=$PS3DEV/portlibs/ppu/lib/pkgconfig - ./toolchain.sh - - - name: Compress ps3dev folder + ${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.github_image }}:latest" --file Dockerfile . + - name: Run Buildx (non-master) + if: success() && steps.prepare.outputs.version != 'master' && github.event_name != 'pull_request' run: | - tar -zcvf ps3dev-${{matrix.os}}-${{steps.arch.outputs.arch}}-${{steps.date.outputs.date}}.tar.gz ps3dev - - - name: Archive Folder - uses: actions/upload-artifact@v4 - with: - name: ${{matrix.os}}-${{matrix.architecture}} - path: ps3dev-*.tar.gz - - publish: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Download all Artifact - uses: actions/download-artifact@v4 - - - name: Set SemVer - id: semver - run: echo "::set-output name=semver::0.1.0+${{ needs.build.outputs.date }}.${{ needs.build.outputs.sha8 }}" - - - name: Create Tag - uses: negz/create-tag@v1 - with: - version: ${{ steps.semver.outputs.semver }} - message: "automatic tag creation" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - id: create_release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ steps.semver.outputs.semver }} - files: | - ${{ github.workspace }}/**/*.tar.gz - + ${{ steps.login.outputs.buildx }} --file Dockerfile . + - name: Clear + if: always() + run: | + rm -rf ${HOME}/.docker/config.json diff --git a/.gitignore b/.gitignore index 44dc0aa71..90200203a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ +/build /archives/* !/archives/archives.txt /ps3dev -.DS_Store -.idea/** -.vscode \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 986ce50a3..97556c450 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,27 @@ -# Stay on Debian 12 so the host-linked cross gcc needs only glibc 2.36 -# (Bookworm). Building on Trixie produces GLIBC_2.38+ binaries that fail -# on Debian 12 and similar hosts. -FROM debian:12-slim AS base +# FROM ubuntu:xenial +FROM debian:12-slim LABEL maintainer="miigotu@gmail.com" -ENV PS3DEV=/usr/local/ps3dev \ - PSL1GHT=/usr/local/ps3dev \ - DEBIAN_FRONTEND=noninteractive \ - PYTHON_VERSION=3.10 \ - PYENV_ROOT=/root/.pyenv \ - PIP_ROOT_USER_ACTION=ignore \ - PKG_CONFIG_PATH=/usr/local/ps3dev/portlibs/ppu/lib/pkgconfig -ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin:${PS3DEV}/portlibs/ppu/bin" +ENV PS3DEV /usr/local/ps3dev +ENV PSL1GHT ${PS3DEV} +ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin -RUN apt-get update -y && \ - apt-get --no-install-recommends install -y autoconf automake bison build-essential bzip2 \ - ca-certificates cmake flex gettext-base git libelf-dev libgmp3-dev libncurses5-dev libssl-dev \ - libtool libtool-bin make patch pkg-config texinfo wget xz-utils zlib1g-dev && \ - # Fixes certificate errors with letsencrypt in ARMv7 - echo 'ca_certificate=/etc/ssl/certs/ca-certificates.crt' >> /etc/wgetrc && \ - # nvidia-cg-toolkit is non-free and amd64-only - if [ "$(uname -m)" = "x86_64" ]; then \ - sed -i 's/ main$/ main contrib non-free non-free-firmware/' /etc/apt/sources.list && \ - apt-get update -y && apt-get install -y nvidia-cg-toolkit ; \ - fi && \ - # pyenv - apt-get --no-install-recommends install -y zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev \ - llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev curl git && \ - echo 'cacert=/etc/ssl/certs/ca-certificates.crt' >> ~/.curlrc && \ - git config --global http.sslverify 'false' && \ - curl https://pyenv.run | bash && \ - pyenv update && pyenv install $PYTHON_VERSION && pyenv global $PYTHON_VERSION && pyenv rehash && \ - pip install pycrypto && \ - apt-get -y clean autoclean autoremove && \ - rm -rf /var/lib/apt/lists/* +ENV DEBIAN_FRONTEND=noninteractive + +RUN \ + apt-get -y update && \ + apt-get -y install \ + autoconf bison build-essential ca-certificates flex git libelf-dev\ + libgmp-dev libncurses5-dev libssl-dev libtool-bin pkg-config \ + texinfo wget zlib1g-dev && \ + apt-get -y clean autoclean autoremove && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ -FROM base AS builder RUN mkdir /build WORKDIR /build COPY . /build -RUN mkdir -p "${PS3DEV}" && /build/toolchain.sh -FROM base AS runtime -COPY --from=builder ${PS3DEV} ${PS3DEV} +# Fixes certificate errors with letsencrypt in ARMv7 +# RUN echo "\nca_certificate=/etc/ssl/certs/ca-certificates.crt" | tee -a /etc/wgetrc +# RUN /build/toolchain.sh -# How to build and run a multi platform image -# Tested platforms: linux/amd64 or linux/arm64 -# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker build . -t ps3dev -# DOCKER_DEFAULT_PLATFORM=linux/arm64 docker run -it -v `pwd`:/build -w /build ps3dev diff --git a/archives/archives.txt b/archives/archives.txt index a7776b984..35fd5be8b 100644 --- a/archives/archives.txt +++ b/archives/archives.txt @@ -1,8 +1,6 @@ 6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6313ca9 19973532 https://sourceware.org/pub/binutils/releases/binutils-2.22.tar.bz2 -> binutils-2.22.tar.bz2 -aa54850ebda5064c72cd4ec2d9b056c294252991486350d9a97ab2a6dfdfaf12 38254526 https://sourceware.org/pub/binutils/releases/binutils-2.42.tar.bz2 -> binutils-2.42.tar.bz2 27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f 72462752 https://sourceware.org/pub/gcc/releases/gcc-9.5.0/gcc-9.5.0.tar.xz -> gcc-9.5.0.tar.xz e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da 87858592 https://sourceware.org/pub/gcc/releases/gcc-13.2.0/gcc-13.2.0.tar.xz -> gcc-13.2.0.tar.xz c644b2847244278c57bec2ddda69d8fab5a7c767f3b9af69aa7aa3da823ff692 14571004 https://sourceware.org/pub/newlib/newlib-1.20.0.tar.gz -> newlib-1.20.0.tar.gz -1e55b4d7cdca7b34be12f4ceae651623aa73b2fd640152313f9f66a7149757c4 20489528 https://sourceware.org/pub/gdb/releases/gdb-8.3.1.tar.xz -> gdb-8.3.1.tar.xz -- - https://github.com/ps3dev/psl1ght/tarball/master -> psl1ght.tar.gz -- - https://github.com/ps3dev/ps3libraries/tarball/master -> ps3libraries.tar.gz +- - https://github.com/ps3dev/psl1ght/tarball/master -> psl1ght.tar.gz +- - https://github.com/ps3dev/ps3libraries/tarball/master -> ps3libraries.tar.gz diff --git a/depends/check-python.sh b/depends/check-python.sh deleted file mode 100755 index b1d8076f1..000000000 --- a/depends/check-python.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# check-python.sh by Naomi Peori (naomi@peori.ca) - -## Prefer python3 (pyenv, Debian) over the unversioned python name. -python_bin="" -for c in python3 python; do - command -v "$c" >/dev/null 2>&1 || continue - python_bin="$c" - break -done -[ -n "$python_bin" ] || { echo "ERROR: Install python before continuing."; exit 1; } - -## python-config is often not on PATH; pyenv ships python3-config next to the interpreter. -pyconfig="" -for c in python3-config python-config; do - command -v "$c" >/dev/null 2>&1 || continue - pyconfig="$c" - break -done -if [ -z "$pyconfig" ]; then - pyhome=$("$python_bin" -c "import sys; print(sys.base_prefix)") - for c in "$pyhome"/bin/python3-config "$pyhome"/bin/python*-config; do - [ -x "$c" ] || continue - pyconfig="$c" - break - done -fi -[ -n "$pyconfig" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } - -pyprefix=$("$pyconfig" --prefix) || { echo "ERROR: Install python-dev before continuing."; exit 1; } - -python_h="" -for h in \ - "$pyprefix"/include/python*/Python.h \ - ${PYENV_ROOT:+$PYENV_ROOT/versions/*/include/python*/Python.h} \ - /opt/local/include/python*/Python.h \ - ${PYINSTALLDIR:+$PYINSTALLDIR/include/Python.h} -do - [ -f "$h" ] || continue - python_h="$h" - break -done -[ -n "$python_h" ] || { echo "ERROR: Install python-dev before continuing."; exit 1; } diff --git a/patches/binutils-2.22-PS3-SPU.patch b/patches/binutils-2.22-PS3.patch similarity index 97% rename from patches/binutils-2.22-PS3-SPU.patch rename to patches/binutils-2.22-PS3.patch index 8fba3c6c1..ac2ac2368 100644 --- a/patches/binutils-2.22-PS3-SPU.patch +++ b/patches/binutils-2.22-PS3.patch @@ -86,5 +86,5 @@ index 20e0271..48df959 100644 + else if (config.has_pie) + link_info.pie = TRUE; else - einfo (_("%P%F: -pie not supported\n")); - break; + einfo (_("%P%F: -pie not supported\n")); + break; diff --git a/patches/binutils-2.42-PS3-PPU.patch b/patches/binutils-2.42-PS3-PPU.patch deleted file mode 100644 index f1aff8f97..000000000 --- a/patches/binutils-2.42-PS3-PPU.patch +++ /dev/null @@ -1,90 +0,0 @@ -# Original from https://github.com/ps3dev/ps3toolchain -# Updated for binutils 2.40 by Darjan Krijan [https://disc-kuraudo.eu] -diff '--color=auto' -urN a/ld/emulparams/elf32_spu.sh b/ld/emulparams/elf32_spu.sh ---- a/ld/emulparams/elf32_spu.sh 2022-07-08 11:46:48.000000000 +0200 -+++ b/ld/emulparams/elf32_spu.sh 2023-01-04 22:15:19.310575828 +0100 -@@ -6,6 +6,8 @@ - ARCH=spu - MACHINE= - ALIGNMENT=16 -+GENERATE_PIE_SCRIPT=yes -+GENERATE_COMBRELOC_SCRIPT=yes - TEXT_START_ADDR=0 - INITIAL_READONLY_SECTIONS='.interrupt : { KEEP(*(.interrupt)) }' - if test -z "${CREATE_SHLIB}"; then -diff '--color=auto' -urN a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em ---- a/ld/emultempl/spuelf.em 2022-07-08 11:46:48.000000000 +0200 -+++ b/ld/emultempl/spuelf.em 2023-01-04 22:17:32.998687355 +0100 -@@ -258,6 +258,14 @@ - return total; - } - -+static void -+spu_before_parse (void) -+{ -+ gld${EMULATION_NAME}_before_parse (); -+ -+ config.has_pie = `if test -n "$GENERATE_PIE_SCRIPT" ; then echo true ; else echo false ; fi`; -+} -+ - /* Go find if we need to do anything special for overlays. */ - - static void -@@ -851,5 +859,6 @@ - - LDEMUL_AFTER_OPEN=spu_after_open - LDEMUL_BEFORE_ALLOCATION=spu_before_allocation -+LDEMUL_BEFORE_PARSE=spu_before_parse - LDEMUL_FINISH=gld${EMULATION_NAME}_finish - LDEMUL_CHOOSE_TARGET=gld${EMULATION_NAME}_choose_target -diff '--color=auto' -urN a/ld/ld.h b/ld/ld.h ---- a/ld/ld.h 2022-07-08 11:46:48.000000000 +0200 -+++ b/ld/ld.h 2023-01-04 22:24:33.832738444 +0100 -@@ -229,6 +229,9 @@ - parameter. */ - bool has_shared; - -+ /* If TRUE, -pie is supported. */ -+ bool has_pie; -+ - /* If TRUE, build constructors. */ - bool build_constructors; - -diff '--color=auto' -urN a/ld/ldmain.c b/ld/ldmain.c ---- a/ld/ldmain.c 2022-07-08 11:46:48.000000000 +0200 -+++ b/ld/ldmain.c 2023-01-04 22:16:46.319346843 +0100 -@@ -315,6 +315,7 @@ - config.make_executable = true; - config.magic_demand_paged = true; - config.text_read_only = true; -+ config.has_pie = false; - config.print_map_discarded = true; - link_info.disable_target_specific_optimizations = -1; - -diff '--color=auto' -urN a/ld/lexsup.c b/ld/lexsup.c ---- a/ld/lexsup.c 2022-07-08 11:46:48.000000000 +0200 -+++ b/ld/lexsup.c 2023-01-04 22:17:19.218882047 +0100 -@@ -1286,6 +1286,8 @@ - if (link_info.unresolved_syms_in_shared_libs == RM_NOT_YET_SET) - link_info.unresolved_syms_in_shared_libs = RM_IGNORE; - } -+ else if (config.has_pie) -+ link_info.type = type_pie; - else - einfo (_("%F%P: -shared not supported\n")); - break; - -# Apple Clang 17+ (Xcode 16.3 / macOS 26) defines TARGET_OS_MAC as a builtin. -# zlib then #define fdopen(...) NULL, which breaks the SDK fdopen prototype. -diff --git a/zlib/zutil.h b/zlib/zutil.h ---- a/zlib/zutil.h -+++ b/zlib/zutil.h -@@ -137,7 +137,7 @@ - # endif - #endif - --#if defined(MACOS) || defined(TARGET_OS_MAC) -+#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) - # define OS_CODE 7 - # ifndef Z_SOLO - # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/gcc-13.2.0-PS3-PPU.patch b/patches/gcc-13.2.0-PS3.patch similarity index 100% rename from patches/gcc-13.2.0-PS3-PPU.patch rename to patches/gcc-13.2.0-PS3.patch diff --git a/patches/gcc-9.5.0-PS3-SPU.patch b/patches/gcc-9.5.0-PS3.patch similarity index 100% rename from patches/gcc-9.5.0-PS3-SPU.patch rename to patches/gcc-9.5.0-PS3.patch diff --git a/patches/gdb-8.3.1-PS3.patch b/patches/gdb-8.3.1-PS3.patch index d5968b1f3..979fa68ea 100644 --- a/patches/gdb-8.3.1-PS3.patch +++ b/patches/gdb-8.3.1-PS3.patch @@ -1,48 +1,5 @@ -# Updated for mac gdb 8.3.1-PS3 by humbertodias -diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index 5614cc3386c..a7942e6c37f 100644 ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -1100,6 +1100,7 @@ COMMON_SFILES = \ - remote-fileio.c \ - remote-notif.c \ - reverse.c \ -+ run-on-main-thread.c \ - rust-lang.c \ - sentinel-frame.c \ - ser-event.c \ -@@ -1362,6 +1363,7 @@ HFILES_NO_SRCDIR = \ - riscv-tdep.h \ - rs6000-aix-tdep.h \ - rs6000-tdep.h \ -+ run-on-main-thread.h \ - s390-linux-tdep.h \ - s390-tdep.h \ - score-tdep.h \ -diff --git a/gdb/python/lib/gdb/command/prompt.py b/gdb/python/lib/gdb/command/prompt.py -index 3d662a7d3f1..04b9e49c229 100644 ---- a/gdb/python/lib/gdb/command/prompt.py -+++ b/gdb/python/lib/gdb/command/prompt.py -@@ -45,7 +45,7 @@ The currently defined substitutions are: - self.hook_set = False - - def get_show_string (self, pvalue): -- if self.value is not '': -+ if self.value: - return "The extended prompt is: " + self.value - else: - return "The extended prompt is not set." -@@ -57,7 +57,7 @@ The currently defined substitutions are: - return "" - - def before_prompt_hook(self, current): -- if self.value is not '': -+ if self.value: - return gdb.prompt.substitute_prompt(self.value) - else: - return None diff --git a/gdb/python/python.c b/gdb/python/python.c -index c23db2c1261..422b61bedf6 100644 +index 67f362b852d0..4bdd2201abc3 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -28,14 +28,13 @@ @@ -61,7 +18,7 @@ index c23db2c1261..422b61bedf6 100644 /* Declared constants and enum for python stack printing. */ static const char python_excp_none[] = "none"; -@@ -228,13 +227,37 @@ gdbpy_enter::~gdbpy_enter () +@@ -228,13 +227,37 @@ m_error->restore (); @@ -100,7 +57,7 @@ index c23db2c1261..422b61bedf6 100644 /* Set the quit flag. */ static void -@@ -248,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) +@@ -248,6 +271,10 @@ static int gdbpy_check_quit_flag (const struct extension_language_defn *extlang) { @@ -111,7 +68,7 @@ index c23db2c1261..422b61bedf6 100644 return PyOS_InterruptOccurred (); } -@@ -942,60 +969,54 @@ gdbpy_source_script (const struct extension_language_defn *extlang, +@@ -942,60 +969,54 @@ /* A single event. */ struct gdbpy_event { @@ -124,20 +81,25 @@ index c23db2c1261..422b61bedf6 100644 + : m_func (func.release ()) + { + } - --/* All pending events. */ --static struct gdbpy_event *gdbpy_event_list; --/* The final link of the event list. */ --static struct gdbpy_event **gdbpy_event_list_end; ++ + gdbpy_event (gdbpy_event &&other) + : m_func (other.m_func) + { + other.m_func = nullptr; + } +-/* All pending events. */ +-static struct gdbpy_event *gdbpy_event_list; +-/* The final link of the event list. */ +-static struct gdbpy_event **gdbpy_event_list_end; +- -/* So that we can wake up the main thread even when it is blocked in - poll(). */ -static struct serial_event *gdbpy_serial_event; +- +-/* The file handler callback. This reads from the internal pipe, and +- then processes the Python event queue. This will always be run in +- the main gdb thread. */ + gdbpy_event (const gdbpy_event &other) + : m_func (other.m_func) + { @@ -145,29 +107,23 @@ index c23db2c1261..422b61bedf6 100644 + Py_XINCREF (m_func); + } --/* The file handler callback. This reads from the internal pipe, and -- then processes the Python event queue. This will always be run in -- the main gdb thread. */ +-static void +-gdbpy_run_events (int error, gdb_client_data client_data) +-{ +- gdbpy_enter enter_py (get_current_arch (), current_language); + ~gdbpy_event () + { + gdbpy_gil gil; + Py_XDECREF (m_func); + } - --static void --gdbpy_run_events (int error, gdb_client_data client_data) --{ -- gdbpy_enter enter_py (get_current_arch (), current_language); ++ + gdbpy_event &operator= (const gdbpy_event &other) = delete; - /* Clear the event fd. Do this before flushing the events list, so - that any new event post afterwards is sure to re-awake the event - loop. */ - serial_event_clear (gdbpy_serial_event); -+ void operator() () -+ { -+ gdbpy_enter enter_py (get_current_arch (), current_language); - +- - while (gdbpy_event_list) - { - /* Dispatching the event might push a new element onto the event @@ -176,7 +132,10 @@ index c23db2c1261..422b61bedf6 100644 - gdbpy_event_list = gdbpy_event_list->next; - if (gdbpy_event_list == NULL) - gdbpy_event_list_end = &gdbpy_event_list; -- ++ void operator() () ++ { ++ gdbpy_enter enter_py (get_current_arch (), current_language); + - gdbpy_ref<> call_result (PyObject_CallObject (item->event, NULL)); + gdbpy_ref<> call_result (PyObject_CallObject (m_func, NULL)); if (call_result == NULL) @@ -205,7 +164,7 @@ index c23db2c1261..422b61bedf6 100644 if (!PyArg_ParseTuple (args, "O", &func)) return NULL; -@@ -1007,38 +1028,13 @@ gdbpy_post_event (PyObject *self, PyObject *args) +@@ -1007,38 +1028,13 @@ return NULL; } @@ -247,7 +206,7 @@ index c23db2c1261..422b61bedf6 100644 /* This is the extension_language_ops.before_prompt "method". */ -@@ -1573,6 +1569,7 @@ finalize_python (void *ignore) +@@ -1573,6 +1569,7 @@ Py_Finalize (); @@ -255,7 +214,7 @@ index c23db2c1261..422b61bedf6 100644 restore_active_ext_lang (previous_active); } -@@ -1701,7 +1698,6 @@ do_start_initialization () +@@ -1701,7 +1698,6 @@ || gdbpy_initialize_linetable () < 0 || gdbpy_initialize_thread () < 0 || gdbpy_initialize_inferior () < 0 @@ -263,7 +222,7 @@ index c23db2c1261..422b61bedf6 100644 || gdbpy_initialize_eventregistry () < 0 || gdbpy_initialize_py_events () < 0 || gdbpy_initialize_event () < 0 -@@ -1736,8 +1732,7 @@ do_start_initialization () +@@ -1736,8 +1732,7 @@ return false; /* Release the GIL while gdb runs. */ @@ -273,11 +232,39 @@ index c23db2c1261..422b61bedf6 100644 make_final_cleanup (finalize_python, NULL); -diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c -new file mode 100644 -index 00000000000..86824b5af4a ---- /dev/null -+++ b/gdb/run-on-main-thread.c +--- /dev/null 2023-07-16 09:39:45.472000000 +0200 ++++ b/gdb/run-on-main-thread.h 2023-07-30 10:43:06.264134972 +0200 +@@ -0,0 +1,28 @@ ++/* Run a function on the main thread ++ Copyright (C) 2019 Free Software Foundation, Inc. ++ ++ This file is part of GDB. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef GDB_RUN_ON_MAIN_THREAD_H ++#define GDB_RUN_ON_MAIN_THREAD_H ++ ++#include ++ ++/* Send a runnable to the main thread. */ ++ ++extern void run_on_main_thread (std::function &&); ++ ++#endif /* GDB_RUN_ON_MAIN_THREAD_H */ +--- /dev/null 2023-07-16 09:39:45.472000000 +0200 ++++ b/gdb/run-on-main-thread.c 2023-07-30 10:43:03.510435316 +0200 @@ -0,0 +1,97 @@ +/* Run a function on the main thread + Copyright (C) 2019 Free Software Foundation, Inc. @@ -376,67 +363,41 @@ index 00000000000..86824b5af4a + runnable_event = make_serial_event (); + add_file_handler (serial_event_fd (runnable_event), run_events, nullptr); +} -diff --git a/gdb/run-on-main-thread.h b/gdb/run-on-main-thread.h -new file mode 100644 -index 00000000000..fd1a2c42532 ---- /dev/null -+++ b/gdb/run-on-main-thread.h -@@ -0,0 +1,28 @@ -+/* Run a function on the main thread -+ Copyright (C) 2019 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef GDB_RUN_ON_MAIN_THREAD_H -+#define GDB_RUN_ON_MAIN_THREAD_H -+ -+#include -+ -+/* Send a runnable to the main thread. */ -+ -+extern void run_on_main_thread (std::function &&); -+ -+#endif /* GDB_RUN_ON_MAIN_THREAD_H */ -diff --git a/readline/config.h.in b/readline/config.h.in -index c194e761a45..07b04fceb56 100644 ---- a/readline/config.h.in -+++ b/readline/config.h.in -@@ -234,7 +234,11 @@ - /* Definitions pulled in from aclocal.m4. */ - #undef VOID_SIGHANDLER - -+#if __APPLE__ -+#define GWINSZ_IN_SYS_IOCTL -+#else - #undef GWINSZ_IN_SYS_IOCTL -+#endif - - #undef STRUCT_WINSIZE_IN_SYS_IOCTL - -# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. -diff --git a/zlib/zutil.h b/zlib/zutil.h ---- a/zlib/zutil.h -+++ b/zlib/zutil.h -@@ -137,7 +137,7 @@ - # endif - #endif +--- a/gdb/Makefile.in 2023-07-30 10:45:06.611621149 +0200 ++++ b/gdb/Makefile.in 2023-07-30 10:46:04.284435216 +0200 +@@ -1100,6 +1100,7 @@ + remote-fileio.c \ + remote-notif.c \ + reverse.c \ ++ run-on-main-thread.c \ + rust-lang.c \ + sentinel-frame.c \ + ser-event.c \ +@@ -1362,6 +1363,7 @@ + riscv-tdep.h \ + rs6000-aix-tdep.h \ + rs6000-tdep.h \ ++ run-on-main-thread.h \ + s390-linux-tdep.h \ + s390-tdep.h \ + score-tdep.h \ +--- a/gdb/python/lib/gdb/command/prompt.py ++++ b/gdb/python/lib/gdb/command/prompt.py +@@ -45,7 +45,7 @@ def __init__(self): + self.hook_set = False --#if defined(MACOS) || defined(TARGET_OS_MAC) -+#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) - # define OS_CODE 7 - # ifndef Z_SOLO - # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os + def get_show_string (self, pvalue): +- if self.value is not '': ++ if self.value: + return "The extended prompt is: " + self.value + else: + return "The extended prompt is not set." +@@ -57,7 +57,7 @@ def get_set_string (self): + return "" + def before_prompt_hook(self, current): +- if self.value is not '': ++ if self.value: + return gdb.prompt.substitute_prompt(self.value) + else: + return None diff --git a/scripts/001-binutils-PPU.sh b/scripts/001-binutils-PPU.sh index dfc7c7395..4d54e0f85 100755 --- a/scripts/001-binutils-PPU.sh +++ b/scripts/001-binutils-PPU.sh @@ -2,7 +2,7 @@ set -eo pipefail # binutils-PPU.sh by Naomi Peori (naomi@peori.ca) -BINUTILS="binutils-2.42" +BINUTILS="binutils-2.22" source ../utils/utils.sh if [ ! -d ${BINUTILS} ]; then @@ -18,7 +18,7 @@ if [ ! -d ${BINUTILS} ]; then extract "../archives/${BINUTILS}.tar.bz2" ## Patch the source code. - cat ../patches/${BINUTILS}-PS3-PPU.patch | patch -p1 -d ${BINUTILS} + cat ../patches/${BINUTILS}-PS3.patch | patch -p1 -d ${BINUTILS} ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${BINUTILS} @@ -36,28 +36,19 @@ fi cd ${BINUTILS}/build-ppu ## Configure the build. -unset LDFLAGS ../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ - --with-gcc \ - --with-gnu-as \ - --with-gnu-ld \ - --enable-64-bit-bfd \ - --enable-lto \ - --disable-nls \ - --disable-shared \ - --disable-debug \ - --disable-dependency-tracking \ - --disable-werror \ - --disable-gprofng \ - --disable-install-libiberty \ - --with-system-zlib + --disable-nls \ + --disable-shared \ + --disable-debug \ + --disable-dependency-tracking \ + --disable-werror \ + --enable-64-bit-bfd \ + --with-gcc \ + --with-gnu-as \ + --with-gnu-ld ## Compile and install. -## Do not override libdir: binutils 2.42 installs libdep.la into -## $libdir/bfd-plugins and libtool requires that path to be absolute. PROCS="$(nproc --all 2>&1)" || ret=$? if [ ! -z $ret ]; then PROCS=4; fi ${MAKE:-make} -j $PROCS -${MAKE:-make} install -# Host libiberty can still land under prefix on some configure defaults. -rm -f "$PS3DEV/ppu/lib/libiberty.a" "$PS3DEV/ppu/lib64/libiberty.a" +${MAKE:-make} libdir=host-libs/lib MULTIOSDIR=. install diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 5175edef5..15a28c222 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -16,23 +16,34 @@ if [ ! -d ${GCC} ]; then ../config/get-config-scripts.sh ## Unpack the source code. - unpack_if_needed "../archives/${GCC}.tar.xz" "${GCC}" - unpack_if_needed "../archives/${NEWLIB}.tar.gz" "${NEWLIB}" + echo "Unpacking ${GCC}" + extract "../archives/${GCC}.tar.xz" + + if [ ! -d ${NEWLIB} ]; then + + echo "Unpacking ${NEWLIB}" + extract "../archives/${NEWLIB}.tar.gz" + + ## Patch the source code. + cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} + + ## Replace config.guess and config.sub + cp ../archives/config.guess ../archives/config.sub ${NEWLIB} + + fi ## Patch the source code. - apply_patch "../patches/${GCC}-PS3-PPU.patch" "${GCC}" - apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" + cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} ## Host GCC 16 / libc++ 17+: safe-ctype vs /, libcody char8_t - apply_patch "../patches/${GCC}-PS3-host.patch" "${GCC}" + cat ../patches/${GCC}-PS3-host.patch | patch -p1 -d ${GCC} ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then - apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" + cat ../patches/${GCC}-PS3-macos-arm64.patch | patch -p1 -d ${GCC} fi ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${GCC} - cp ../archives/config.guess ../archives/config.sub ${NEWLIB} ## Enter the source code directory. cd ${GCC} @@ -56,9 +67,6 @@ if [ ! -d ${GCC}/build-ppu ]; then fi -## newlib 1.20 config.sub rejects aarch64-apple-darwin (Apple Silicon). -refresh_config_scripts "${NEWLIB}" "${GCC}" - ## Enter the build directory. cd ${GCC}/build-ppu diff --git a/scripts/003-gdb-PPU.sh b/scripts/003-gdb-PPU.sh deleted file mode 100755 index 4866d57ce..000000000 --- a/scripts/003-gdb-PPU.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -# gdb-PPU.sh by Naomi Peori (naomi@peori.ca) - -GDB="gdb-8.3.1" -source ../utils/utils.sh - -if [ ! -d ${GDB} ]; then - - ## Download the source code. - ../download.sh ${GDB}.tar.xz - - ## Fetch config.guess and config.sub, falling back to copies if Savannah is unavailable - ../config/get-config-scripts.sh - - ## Unpack the source code. - unpack_if_needed "../archives/${GDB}.tar.xz" "${GDB}" - - ## Patch the source code. - apply_patch "../patches/${GDB}-PS3.patch" "${GDB}" - - ## Replace config.guess and config.sub - cp ../archives/config.guess ../archives/config.sub ${GDB} - -fi - -if [ ! -d ${GDB}/build-ppu ]; then - - ## Create the build directory. - mkdir ${GDB}/build-ppu - -fi - -## Enter the build directory. -cd ${GDB}/build-ppu - -## Configure the build. -## pyenv ships Python 3.10; gdb 8.3.1 cannot build against that ABI. -## Host GCC 15/16 default to C23; bundled readline expects pre-C23 -## unprototyped signal handlers (VOID_SIGHANDLER). -CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion" \ -CXXFLAGS="${CXXFLAGS:-} -std=gnu++17 -Wno-narrowing" \ -../configure --prefix="$PS3DEV/ppu" --target="powerpc64-ps3-elf" \ - --disable-multilib \ - --disable-nls \ - --disable-sim \ - --disable-werror \ - --with-python=no \ - --without-guile - -## Compile and install. -PROCS="$(nproc --all 2>&1)" || ret=$? -if [ ! -z $ret ]; then PROCS=4; fi -${MAKE:-make} -j $PROCS -${MAKE:-make} libdir="$(pwd)/host-libs/lib" install diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index 14b7e41b4..2fe535e14 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -14,10 +14,11 @@ if [ ! -d ${BINUTILS} ]; then ../config/get-config-scripts.sh ## Unpack the source code. - unpack_if_needed "../archives/${BINUTILS}.tar.bz2" "${BINUTILS}" + echo "Unpacking ${BINUTILS}" + extract "../archives/${BINUTILS}.tar.bz2" ## Patch the source code. - apply_patch "../patches/${BINUTILS}-PS3-SPU.patch" "${BINUTILS}" + cat ../patches/${BINUTILS}-PS3.patch | patch -p1 -d ${BINUTILS} ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${BINUTILS} @@ -46,8 +47,8 @@ CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversi --with-gcc \ --with-gnu-as \ --with-gnu-ld \ - --enable-lto \ - --with-system-zlib + --enable-lto \ + --with-system-zlib ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index da4b4ca6f..8310e67ff 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -16,24 +16,34 @@ if [ ! -d ${GCC} ]; then ../config/get-config-scripts.sh ## Unpack the source code. - unpack_if_needed "../archives/${GCC}.tar.xz" "${GCC}" - unpack_if_needed "../archives/${NEWLIB}.tar.gz" "${NEWLIB}" + echo "Unpacking ${GCC}" + extract "../archives/${GCC}.tar.xz" - ## Patch the source code. newlib is shared with the PPU step and - ## must not be unpacked/patched a second time. - apply_patch "../patches/${GCC}-PS3-SPU.patch" "${GCC}" - apply_patch "../patches/${NEWLIB}-PS3.patch" "${NEWLIB}" + if [ ! -d ${NEWLIB} ]; then + + echo "Unpacking ${NEWLIB}" + extract "../archives/${NEWLIB}.tar.gz" + + ## Patch the source code. + cat ../patches/${NEWLIB}-PS3.patch | patch -p1 -d ${NEWLIB} + + ## Replace config.guess and config.sub + cp ../archives/config.guess ../archives/config.sub ${NEWLIB} + + fi + + ## Patch the source code. + cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} ## Host GCC 16 / libc++ 17+: safe-ctype vs / - apply_patch "../patches/${GCC}-PS3-host.patch" "${GCC}" + cat ../patches/${GCC}-PS3-host.patch | patch -p1 -d ${GCC} ## Apple Silicon host_hooks / native aarch64 detect if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then - apply_patch "../patches/${GCC}-PS3-macos-arm64.patch" "${GCC}" + cat ../patches/${GCC}-PS3-macos-arm64.patch | patch -p1 -d ${GCC} fi ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${GCC} - cp ../archives/config.guess ../archives/config.sub ${NEWLIB} ## Enter the source code directory. cd ${GCC} @@ -57,9 +67,6 @@ if [ ! -d ${GCC}/build-spu ]; then fi -## newlib 1.20 config.sub rejects aarch64-apple-darwin (Apple Silicon). -refresh_config_scripts "${NEWLIB}" "${GCC}" - ## Enter the build directory. cd ${GCC}/build-spu diff --git a/scripts/007-gdb-SPU.sh b/scripts/007-gdb-SPU.sh deleted file mode 100755 index 48d9563d9..000000000 --- a/scripts/007-gdb-SPU.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail -# gdb-SPU.sh by Naomi Peori (naomi@peori.ca) - -GDB="gdb-8.3.1" -source ../utils/utils.sh - -if [ ! -d ${GDB} ]; then - - ## Download the source code. - ../download.sh ${GDB}.tar.xz - - ## Fetch config.guess and config.sub, falling back to copies if Savannah is unavailable - ../config/get-config-scripts.sh - - ## Unpack the source code. - unpack_if_needed "../archives/${GDB}.tar.xz" "${GDB}" - - ## Patch the source code. - apply_patch "../patches/${GDB}-PS3.patch" "${GDB}" - - ## Replace config.guess and config.sub - cp ../archives/config.guess ../archives/config.sub ${GDB} - -fi - -if [ ! -d ${GDB}/build-spu ]; then - - ## Create the build directory. - mkdir ${GDB}/build-spu - -fi - -## Enter the build directory. -cd ${GDB}/build-spu - -## Configure the build. -## pyenv ships Python 3.10; gdb 8.3.1 cannot build against that ABI. -## Host GCC 15/16 default to C23; bundled readline expects pre-C23 -## unprototyped signal handlers (VOID_SIGHANDLER). -CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion" \ -CXXFLAGS="${CXXFLAGS:-} -std=gnu++17 -Wno-narrowing" \ -../configure --prefix="$PS3DEV/spu" --target="spu" \ - --disable-nls \ - --disable-sim \ - --disable-werror \ - --with-python=no \ - --without-guile - -## Compile and install. -PROCS="$(nproc --all 2>&1)" || ret=$? -if [ ! -z $ret ]; then PROCS=4; fi -${MAKE:-make} -j $PROCS -${MAKE:-make} libdir="$(pwd)/host-libs/lib" install diff --git a/toolchain.sh b/toolchain.sh index cdf0d31dd..a6b1dc6a9 100755 --- a/toolchain.sh +++ b/toolchain.sh @@ -55,5 +55,5 @@ fi ## Run the build scripts. for SCRIPT in $BUILD_SCRIPTS; do echo ">>> Running: $SCRIPT" - "$SCRIPT" || { echo "$SCRIPT: Failed (exit $?)."; exit 1; } + "$SCRIPT" || { echo "$SCRIPT: Failed."; exit 1; } done diff --git a/utils/utils.sh b/utils/utils.sh index d37545d40..ea1011a90 100755 --- a/utils/utils.sh +++ b/utils/utils.sh @@ -31,62 +31,4 @@ extract() { echo " (pv not found, extracting without progress)" tar "${flag[@]}" -xf "$archive" "$@" fi -} - -# Unpack only if the source directory is not already present. -# Usage: unpack_if_needed -unpack_if_needed() { - local archive="$1" srcdir="$2" - if [ -d "$srcdir" ]; then - echo "Already unpacked: $srcdir" - return 0 - fi - echo "Unpacking $srcdir" - extract "$archive" -} - -# Apply a patch once. Shared trees (newlib) are patched by an earlier -# script; re-applying fails because new files already exist. -# Usage: apply_patch -apply_patch() { - local patchfile="$1" srcdir="$2" - if [ ! -f "$patchfile" ]; then - echo "apply_patch: missing $patchfile" >&2 - return 1 - fi - local stamp="$srcdir/.ps3-patched-$(basename "$patchfile")" - if [ -f "$stamp" ]; then - echo "Already patched: $srcdir ($(basename "$patchfile"))" - return 0 - fi - patch -p1 --batch --forward -d "$srcdir" < "$patchfile" - touch "$stamp" -} - -# Replace GNU config.guess/config.sub so hosts like aarch64-apple-darwin -# are recognized. newlib 1.20 (and other old trees) ship copies that reject -# Apple Silicon. Always refresh, including rebuilds after a failed configure. -# Usage: refresh_config_scripts [srcdir...] -refresh_config_scripts() { - if [ $# -lt 1 ]; then - echo "refresh_config_scripts: missing source directory" >&2 - return 1 - fi - ../config/get-config-scripts.sh - local src_guess="../archives/config.guess" - local src_sub="../archives/config.sub" - if [ ! -f "$src_guess" ] || [ ! -f "$src_sub" ]; then - echo "refresh_config_scripts: missing $src_guess or $src_sub" >&2 - return 1 - fi - local dest - for dest in "$@"; do - if [ ! -d "$dest" ]; then - echo "refresh_config_scripts: not a directory: $dest" >&2 - return 1 - fi - echo "Refreshing config.guess/config.sub in $dest" - find "$dest" -name config.guess -exec cp "$src_guess" {} \; - find "$dest" -name config.sub -exec cp "$src_sub" {} \; - done } \ No newline at end of file From 7234cb99b1988f297267364684188797f15dc080 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 11 Oct 2026 09:42:42 -0300 Subject: [PATCH 157/159] Let file_size stat the archive instead of reading it. --- download.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download.sh b/download.sh index 99df8510a..70095cc48 100755 --- a/download.sh +++ b/download.sh @@ -31,7 +31,7 @@ verify_sha256() { } file_size() { - wc -c < "$1" | tr -d ' ' + wc -c "$1" | awk '{print $1}' } # ----------------------------------------------------------------------------- From 52f101c746ba1c650c7adcac2fa5810adb596952 Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 11 Oct 2026 09:45:47 -0300 Subject: [PATCH 158/159] Require an archives.txt line instead of guessing the URL. --- download.sh | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/download.sh b/download.sh index 70095cc48..9ec8690c2 100755 --- a/download.sh +++ b/download.sh @@ -178,29 +178,6 @@ EOF done < "$ARCHIVE" } -# Guess a GNU/sourceware URL when archives.txt has no matching line. -guess_url() { - file="$1" - case "$file" in - binutils-*.tar.*) - printf 'https://ftpmirror.gnu.org/gnu/binutils/%s\n' "$file" - ;; - gcc-*.tar.*) - ver="${file%.tar.*}" - printf 'https://ftpmirror.gnu.org/gnu/gcc/%s/%s\n' "$ver" "$file" - ;; - newlib-*.tar.*) - printf 'https://sourceware.org/pub/newlib/%s\n' "$file" - ;; - gdb-*.tar.*) - printf 'https://ftpmirror.gnu.org/gnu/gdb/%s\n' "$file" - ;; - *) - return 1 - ;; - esac -} - run_one() { target="$1" found=0 @@ -218,17 +195,11 @@ EOF found=1 break done < "$ARCHIVE" - [ "$found" -eq 1 ] && return 0 - - if url=$(guess_url "$target"); then - echo "Not in $ARCHIVE; fetching $url" >&2 - download "-" "-" "$url" "$target" - return 0 - fi - - echo "Not found: $target" >&2 - echo "Add a line to archives/archives.txt or use a GNU/sourceware tarball name." >&2 - exit 1 + [ "$found" -eq 1 ] || { + echo "Not found: $target" >&2 + echo "Add a line to archives/archives.txt, including the SHA256." >&2 + exit 1 + } } # ----------------------------------------------------------------------------- From 22a9391735100e1a1876dcf13344236f373cc05a Mon Sep 17 00:00:00 2001 From: Humberto Dias Date: Sun, 11 Oct 2026 11:02:59 -0300 Subject: [PATCH 159/159] Drop the hand-rolled GCC host patches. Those fixes belong in the gcc repo's generated patch, not in split files applied by the build scripts. The download, SPU binutils, and toolchain.sh changes move to their own branches. --- download.sh | 96 ++----- patches/gcc-13.2.0-PS3-host.patch | 285 -------------------- patches/gcc-13.2.0-PS3-macos-arm64.patch | 32 --- patches/gcc-13.2.0-PS3.patch | 325 +++++++++++++++++++++-- patches/gcc-9.5.0-PS3-host.patch | 60 ----- patches/gcc-9.5.0-PS3-macos-arm64.patch | 105 -------- patches/gcc-9.5.0-PS3.patch | 269 ++++++++++++++----- scripts/002-gcc-newlib-PPU.sh | 7 - scripts/005-binutils-SPU.sh | 6 +- scripts/006-gcc-newlib-SPU.sh | 8 - scripts/009-ps3libraries.sh | 3 - 11 files changed, 516 insertions(+), 680 deletions(-) delete mode 100644 patches/gcc-13.2.0-PS3-host.patch delete mode 100644 patches/gcc-13.2.0-PS3-macos-arm64.patch delete mode 100644 patches/gcc-9.5.0-PS3-host.patch delete mode 100644 patches/gcc-9.5.0-PS3-macos-arm64.patch diff --git a/download.sh b/download.sh index 9ec8690c2..7807826dc 100755 --- a/download.sh +++ b/download.sh @@ -5,8 +5,7 @@ cd "$(dirname "$0")" cd archives || exit 1 ARCHIVE="archives.txt" -# 15s was aborting slow Sourceware transfers. Keep the partial file and resume. -WGET_OPTS=(--continue --tries=20 --timeout=60 --waitretry=5 --retry-connrefused --quiet --show-progress) +WGET="wget --tries=5 --timeout=15 --quiet --show-progress" # ----------------------------------------------------------------------------- # verify_sha256 @@ -30,67 +29,17 @@ verify_sha256() { return 0 } -file_size() { - wc -c "$1" | awk '{print $1}' -} - -# ----------------------------------------------------------------------------- -# mirror_urls -# Prints the primary URL plus GNU/kernel.org fallbacks. -# ----------------------------------------------------------------------------- -mirror_urls() { - url="$1" - file="$(basename "$url")" - printf '%s\n' "$url" - - case "$url" in - */binutils/releases/*|*/gnu/binutils/*) - printf '%s\n' \ - "https://ftpmirror.gnu.org/gnu/binutils/${file}" \ - "https://ftp.gnu.org/gnu/binutils/${file}" \ - "https://sourceware.org/pub/binutils/releases/${file}" \ - "https://mirrors.kernel.org/sourceware/binutils/releases/${file}" - ;; - */gcc/releases/*|*/gnu/gcc/*) - ver="${file%.tar.*}" - printf '%s\n' \ - "https://ftpmirror.gnu.org/gnu/gcc/${ver}/${file}" \ - "https://ftp.gnu.org/gnu/gcc/${ver}/${file}" \ - "https://sourceware.org/pub/gcc/releases/${ver}/${file}" \ - "https://gcc.gnu.org/pub/gcc/releases/${ver}/${file}" - ;; - */gdb/releases/*|*/gnu/gdb/*) - printf '%s\n' \ - "https://ftpmirror.gnu.org/gnu/gdb/${file}" \ - "https://ftp.gnu.org/gnu/gdb/${file}" \ - "https://sourceware.org/pub/gdb/releases/${file}" - ;; - */newlib/*) - printf '%s\n' \ - "https://sourceware.org/pub/newlib/${file}" \ - "https://mirrors.kernel.org/sourceware/newlib/${file}" - ;; - esac -} - # ----------------------------------------------------------------------------- -# fetch [url...] -# Resumes into dest; does not delete a partial file on failure. +# fetch # ----------------------------------------------------------------------------- fetch() { - dest="$1" - shift - url="" - for url in "$@"; do - [ -n "$url" ] || continue - echo " -> $url" - if wget "${WGET_OPTS[@]}" -O "$dest" "$url"; then - return 0 - fi - echo " !! failed, trying next mirror..." >&2 - done - echo " !! Download failed: ${1:-$url}" >&2 - return 1 + url="$1" + dest="$2" + $WGET -O "$dest" "$url" || { + echo " !! Download failed: $url" >&2 + rm -f "$dest" + return 1 + } } # ----------------------------------------------------------------------------- @@ -105,6 +54,7 @@ download() { printf '==> %s\n' "$file" + # If already present, verify immediately — size alone is not enough. if [ -f "$file" ]; then if [ "$sha" = "-" ]; then echo " -- no checksum, skipping re-download of existing file" @@ -114,27 +64,19 @@ download() { echo " -- already good" return 0 fi - actual=$(file_size "$file") - if [ "$size" != "-" ] && [ "$actual" -lt "$size" ]; then - echo " -- incomplete (${actual}/${size} bytes), resuming..." - else - echo " -- existing file failed verification, re-downloading..." - rm -f "$file" - fi + echo " -- existing file failed verification, re-downloading..." + rm -f "$file" fi - # Unique mirror list, primary URL first. - urls=$(mirror_urls "$url" | awk 'NF && !seen[$0]++') - - # shellcheck disable=SC2086 - fetch "$file" $urls + # First attempt + fetch "$url" "$file" + # Verify, with one retry on mismatch if [ "$sha" != "-" ]; then if ! verify_sha256 "$file" "$sha"; then - echo " -- checksum failed, retrying from another mirror..." + echo " -- retrying download..." rm -f "$file" - # shellcheck disable=SC2086 - fetch "$file" $urls + fetch "$url" "$file" verify_sha256 "$file" "$sha" || { rm -f "$file" echo " !! Giving up on $file" >&2 @@ -183,7 +125,6 @@ run_one() { found=0 while IFS= read -r line; do case "$line" in - \#*|"") continue ;; *"$target"*) ;; *) continue ;; esac @@ -197,7 +138,6 @@ EOF done < "$ARCHIVE" [ "$found" -eq 1 ] || { echo "Not found: $target" >&2 - echo "Add a line to archives/archives.txt, including the SHA256." >&2 exit 1 } } @@ -207,4 +147,4 @@ if [ "$#" -eq 0 ]; then run_all else run_one "$1" -fi +fi \ No newline at end of file diff --git a/patches/gcc-13.2.0-PS3-host.patch b/patches/gcc-13.2.0-PS3-host.patch deleted file mode 100644 index 7f586508d..000000000 --- a/patches/gcc-13.2.0-PS3-host.patch +++ /dev/null @@ -1,285 +0,0 @@ -# Host GCC 16 / libc++ 17+: include C++ headers before safe-ctype.h on every -# OS, and teach libcody about char8_t (u8"" is char8_t* under -fchar8_t). -# Packet (unsigned, size_t) vs Packet (unsigned, char8_t*) is ambiguous for -# integer 0 on C++20+ host compilers; cast BOOL payloads to size_t. -diff --git a/gcc/system.h b/gcc/system.h ---- a/gcc/system.h -+++ b/gcc/system.h -@@ -194,27 +194,9 @@ - #undef fread_unlocked - #undef fwrite_unlocked - --/* Include before "safe-ctype.h" to avoid GCC poisoning -- the ctype macros through safe-ctype.h */ -- --#ifdef __cplusplus --#ifdef INCLUDE_STRING --# include --#endif --#endif -- --/* There are an extraordinary number of issues with . -- The last straw is that it varies with the locale. Use libiberty's -- replacement instead. */ --#include "safe-ctype.h" -- --#include -- --#include -- --#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO --extern int errno; --#endif -+/* Include C++ headers before "safe-ctype.h". Host GCC 16 libstdc++ and -+ libc++ 17+ pull ctype names through //; the -+ poison macros break islower/toupper. */ - - #ifdef __cplusplus - #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -243,8 +225,24 @@ - # include - # include - # include -+# include -+# include -+# include - #endif - -+/* There are an extraordinary number of issues with . -+ The last straw is that it varies with the locale. Use libiberty's -+ replacement instead. */ -+#include "safe-ctype.h" -+ -+#include -+ -+#include -+ -+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO -+extern int errno; -+#endif -+ - /* Some of glibc's string inlines cause warnings. Plus we'd rather - rely on (and therefore test) GCC's string builtins. */ - #define __NO_STRING_INLINES -diff --git a/libcody/cody.hh b/libcody/cody.hh ---- a/libcody/cody.hh -+++ b/libcody/cody.hh -@@ -47,12 +47,21 @@ - - // C++11 doesn't have utf8 character literals :( - -+#if __cpp_char8_t >= 201811 - template -+constexpr char S2C (char8_t const (&s)[I]) -+{ -+ static_assert (I == 2, "only single octet strings may be converted"); -+ return s[0]; -+} -+#else -+template - constexpr char S2C (char const (&s)[I]) - { - static_assert (I == 2, "only single octet strings may be converted"); - return s[0]; - } -+#endif - - /// Internal buffering class. Used to concatenate outgoing messages - /// and Lex incoming ones. -@@ -122,7 +131,14 @@ - if (buffer.size () != lastBol) - Space (); - Append (str, maybe_quote, len); -+ } -+#if __cpp_char8_t >= 201811 -+ void AppendWord (char8_t const *str, bool maybe_quote = false, -+ size_t len = ~size_t (0)) -+ { -+ AppendWord ((const char *) str, maybe_quote, len); - } -+#endif - /// Add a word as with AppendWord - /// @param str the string to append - /// @param maybe_quote string might need quoting, as for Append -@@ -262,8 +278,14 @@ - } - Packet (unsigned c, std::string const &s) - : string (s), cat (STRING), code (c) -+ { -+ } -+#if __cpp_char8_t >= 201811 -+ Packet (unsigned c, const char8_t *s) -+ : string ((const char *) s), cat (STRING), code (c) - { - } -+#endif - Packet (unsigned c, std::vector &&v) - : vector (std::move (v)), cat (VECTOR), code (c) - { -diff --git a/libcody/client.cc b/libcody/client.cc ---- a/libcody/client.cc -+++ b/libcody/client.cc -@@ -97,7 +97,7 @@ - - static Packet CommunicationError (int err) - { -- std::string e {u8"communication error:"}; -+ std::string e {(const char *) u8"communication error:"}; - e.append (strerror (err)); - - return Packet (Client::PC_ERROR, std::move (e)); -@@ -110,33 +110,33 @@ - { - if (e == EINVAL) - { -- std::string msg (u8"malformed string '"); -+ std::string msg ((const char *) u8"malformed string '"); - msg.append (words[0]); -- msg.append (u8"'"); -+ msg.append ((const char *) u8"'"); - return Packet (Client::PC_ERROR, std::move (msg)); - } - else -- return Packet (Client::PC_ERROR, u8"missing response"); -+ return Packet (Client::PC_ERROR, (const char *) u8"missing response"); - } - - Assert (!words.empty ()); -- if (words[0] == u8"ERROR") -+ if (words[0] == (const char *) u8"ERROR") - return Packet (Client::PC_ERROR, -- words.size () == 2 ? words[1]: u8"malformed error response"); -+ words.size () == 2 ? words[1]: (const char *) u8"malformed error response"); - - if (isLast && !read.IsAtEnd ()) - return Packet (Client::PC_ERROR, -- std::string (u8"unexpected extra response")); -+ std::string ((const char *) u8"unexpected extra response")); - - Assert (code < Detail::RC_HWM); - Packet result (responseTable[code] (words)); - result.SetRequest (code); - if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ()) - { -- std::string msg {u8"malformed response '"}; -+ std::string msg {(const char *) u8"malformed response '"}; - - read.LexedLine (msg); -- msg.append (u8"'"); -+ msg.append ((const char *) u8"'"); - result.GetString () = std::move (msg); - } - else if (result.GetCode () == Client::PC_CONNECT) -@@ -199,7 +199,7 @@ - size_t alen, size_t ilen) - { - write.BeginLine (); -- write.AppendWord (u8"HELLO"); -+ write.AppendWord ((const char *) u8"HELLO"); - write.AppendInteger (Version); - write.AppendWord (agent, true, alen); - write.AppendWord (ident, true, ilen); -@@ -211,7 +211,7 @@ - // HELLO $version $agent [$flags] - Packet ConnectResponse (std::vector &words) - { -- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4)) -+ if (words[0] == (const char *) u8"HELLO" && (words.size () == 3 || words.size () == 4)) - { - char *eptr; - unsigned long val = strtoul (words[1].c_str (), &eptr, 10); -@@ -247,7 +247,7 @@ - // PATHNAME $dir | ERROR - Packet PathnameResponse (std::vector &words) - { -- if (words[0] == u8"PATHNAME" && words.size () == 2) -+ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2) - return Packet (Client::PC_PATHNAME, std::move (words[1])); - - return Packet (Client::PC_ERROR, u8""); -@@ -256,7 +256,7 @@ - // OK or ERROR - Packet OKResponse (std::vector &words) - { -- if (words[0] == u8"OK") -+ if (words[0] == (const char *) u8"OK") - return Packet (Client::PC_OK); - else - return Packet (Client::PC_ERROR, -@@ -319,11 +319,11 @@ - // PATHNAME $cmifile - Packet IncludeTranslateResponse (std::vector &words) - { -- if (words[0] == u8"BOOL" && words.size () == 2) -+ if (words[0] == (const char *) u8"BOOL" && words.size () == 2) - { -- if (words[1] == u8"FALSE") -+ if (words[1] == (const char *) u8"FALSE") -- return Packet (Client::PC_BOOL, 0); -+ return Packet (Client::PC_BOOL, size_t (0)); -- else if (words[1] == u8"TRUE") -+ else if (words[1] == (const char *) u8"TRUE") -- return Packet (Client::PC_BOOL, 1); -+ return Packet (Client::PC_BOOL, size_t (1)); - else - return Packet (Client::PC_ERROR, u8""); -diff --git a/libcody/server.cc b/libcody/server.cc ---- a/libcody/server.cc -+++ b/libcody/server.cc -@@ -36,12 +36,12 @@ - const requestTable[Detail::RC_HWM] = - { - // Same order as enum RequestCode -- RequestPair {u8"HELLO", nullptr}, -- RequestPair {u8"MODULE-REPO", ModuleRepoRequest}, -- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest}, -- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest}, -- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest}, -- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, -+ RequestPair {(const char *) u8"HELLO", nullptr}, -+ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest}, -+ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest}, -+ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest}, -+ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest}, -+ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, - }; - } - -@@ -135,21 +135,21 @@ - std::string msg; - - if (err > 0) -- msg = u8"error processing '"; -+ msg = (const char *) u8"error processing '"; - else if (ix >= Detail::RC_HWM) -- msg = u8"unrecognized '"; -+ msg = (const char *) u8"unrecognized '"; - else if (IsConnected () && ix == Detail::RC_CONNECT) -- msg = u8"already connected '"; -+ msg = (const char *) u8"already connected '"; - else if (!IsConnected () && ix != Detail::RC_CONNECT) -- msg = u8"not connected '"; -+ msg = (const char *) u8"not connected '"; - else -- msg = u8"malformed '"; -+ msg = (const char *) u8"malformed '"; - - read.LexedLine (msg); -- msg.append (u8"'"); -+ msg.append ((const char *) u8"'"); - if (err > 0) - { -- msg.append (u8" "); -+ msg.append ((const char *) u8" "); - msg.append (strerror (err)); - } - resolver->ErrorResponse (this, std::move (msg)); -@@ -176,7 +176,7 @@ - return nullptr; - - if (words.size () == 3) -- words.emplace_back (u8""); -+ words.emplace_back ((const char *) u8""); - unsigned version = ParseUnsigned (words[1]); - if (version == ~0u) - return nullptr; diff --git a/patches/gcc-13.2.0-PS3-macos-arm64.patch b/patches/gcc-13.2.0-PS3-macos-arm64.patch deleted file mode 100644 index 425f9bff9..000000000 --- a/patches/gcc-13.2.0-PS3-macos-arm64.patch +++ /dev/null @@ -1,32 +0,0 @@ -# Build GCC 13.2.0 as a cross compiler on Apple Silicon. -# host_detect_local_cpu / driver-aarch64.o are not linked for Darwin hosts, -# and host-darwin.cc must export host_hooks. -diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h ---- a/gcc/config/aarch64/aarch64.h -+++ b/gcc/config/aarch64/aarch64.h -@@ -1191,5 +1191,5 @@ - /* Extra specs when building a native AArch64-hosted compiler. - Option rewriting rules based on host system. */ --#if defined(__aarch64__) -+#if defined(__aarch64__) && !defined(__APPLE__) - extern const char *host_detect_local_cpu (int argc, const char **argv); - #define HAVE_LOCAL_CPU_DETECT -diff --git a/gcc/config/host-darwin.cc b/gcc/config/host-darwin.cc ---- a/gcc/config/host-darwin.cc -+++ b/gcc/config/host-darwin.cc -@@ -23,6 +23,8 @@ - #include "options.h" - #include "diagnostic-core.h" - #include "config/host-darwin.h" -+#include "hosthooks.h" -+#include "hosthooks-def.h" - #include - - /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the -@@ -180,4 +182,6 @@ - } - - return 1; - } -+ -+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/patches/gcc-13.2.0-PS3.patch b/patches/gcc-13.2.0-PS3.patch index df5564463..621f82db5 100644 --- a/patches/gcc-13.2.0-PS3.patch +++ b/patches/gcc-13.2.0-PS3.patch @@ -1,9 +1,5 @@ -# Original from https://github.com/ps3dev/ps3toolchain -# Updated to gcc 9.5.0 by Darjan Krijan [https://disc-kuraudo.eu] -# Updated to gcc 13.2.0 by luizfernandonb -# Updated to gcc 13.2.0 by humbertodias diff --git a/Makefile.in b/Makefile.in -index 06a9398e172..7419f7ed67a 100644 +index 06a9398e1..7419f7ed6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -28118,7 +28118,6 @@ check-libiberty: @@ -15,7 +11,7 @@ index 06a9398e172..7419f7ed67a 100644 install-libiberty: installdirs @: $(MAKE); $(unstage) diff --git a/gcc/config.gcc b/gcc/config.gcc -index 648b3dc2110..650d65fe28d 100644 +index 648b3dc21..650d65fe2 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2863,6 +2863,15 @@ pdp11-*-*) @@ -32,11 +28,11 @@ index 648b3dc2110..650d65fe28d 100644 + tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" + ;; powerpc-*-darwin*) - extra_options="${extra_options} ${cpu_type}/darwin.opt" - case ${target} in + extra_options="${extra_options} ${cpu_type}/darwin.opt" + case ${target} in diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h new file mode 100644 -index 00000000000..df93791e501 +index 000000000..df93791e5 --- /dev/null +++ b/gcc/config/rs6000/cell64lv2.h @@ -0,0 +1,584 @@ @@ -625,7 +621,7 @@ index 00000000000..df93791e501 +#undef TARGET_FLOAT128_ENABLE_TYPE +#define TARGET_FLOAT128_ENABLE_TYPE 1 diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc -index 196bcbe1ca3..ea3764278c9 100644 +index 196bcbe1c..ea3764278 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1178,6 +1178,10 @@ static bool rs6000_secondary_reload_move (enum rs6000_reg_type, @@ -661,7 +657,7 @@ index 196bcbe1ca3..ea3764278c9 100644 #include "gt-rs6000.h" diff --git a/gcc/configure b/gcc/configure -index c7b26d1927d..85e83d312f9 100755 +index c7b26d192..85e83d312 100755 --- a/gcc/configure +++ b/gcc/configure @@ -30787,12 +30787,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h @@ -680,7 +676,7 @@ index c7b26d1927d..85e83d312f9 100755 ;; *le-*-freebsd*) diff --git a/gcc/configure.ac b/gcc/configure.ac -index 09082e8ccae..96cccce56a2 100644 +index 09082e8cc..96cccce56 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6470,12 +6470,12 @@ EOF @@ -698,8 +694,295 @@ index 09082e8ccae..96cccce56a2 100644 emul_name="-melf64ppc" ;; *le-*-freebsd*) +diff --git a/gcc/system.h b/gcc/system.h +index cf45db3f9..10f051dcf 100644 +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...); + #undef fread_unlocked + #undef fwrite_unlocked + +-/* Include before "safe-ctype.h" to avoid GCC poisoning +- the ctype macros through safe-ctype.h */ +- +-#ifdef __cplusplus +-#ifdef INCLUDE_STRING +-# include +-#endif +-#endif +- +-/* There are an extraordinary number of issues with . +- The last straw is that it varies with the locale. Use libiberty's +- replacement instead. */ +-#include "safe-ctype.h" +- +-#include +- +-#include +- +-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +-extern int errno; +-#endif ++/* Include C++ standard headers before "safe-ctype.h" to avoid GCC ++ poisoning the ctype macros through safe-ctype.h */ + + #ifdef __cplusplus + #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +@@ -229,6 +210,9 @@ extern int errno; + #ifdef INCLUDE_SET + # include + #endif ++#ifdef INCLUDE_STRING ++# include ++#endif + #ifdef INCLUDE_VECTOR + # include + #endif +@@ -245,6 +229,19 @@ extern int errno; + # include + #endif + ++/* There are an extraordinary number of issues with . ++ The last straw is that it varies with the locale. Use libiberty's ++ replacement instead. */ ++#include "safe-ctype.h" ++ ++#include ++ ++#include ++ ++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO ++extern int errno; ++#endif ++ + /* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ + #define __NO_STRING_INLINES +diff --git a/libcody/client.cc b/libcody/client.cc +index ae69d190c..147fecdbe 100644 +--- a/libcody/client.cc ++++ b/libcody/client.cc +@@ -97,7 +97,7 @@ int Client::CommunicateWithServer () + + static Packet CommunicationError (int err) + { +- std::string e {u8"communication error:"}; ++ std::string e {(const char *) u8"communication error:"}; + e.append (strerror (err)); + + return Packet (Client::PC_ERROR, std::move (e)); +@@ -110,33 +110,34 @@ Packet Client::ProcessResponse (std::vector &words, + { + if (e == EINVAL) + { +- std::string msg (u8"malformed string '"); ++ std::string msg ((const char *) u8"malformed string '"); + msg.append (words[0]); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + return Packet (Client::PC_ERROR, std::move (msg)); + } + else +- return Packet (Client::PC_ERROR, u8"missing response"); ++ return Packet (Client::PC_ERROR, (const char *) u8"missing response"); + } + + Assert (!words.empty ()); +- if (words[0] == u8"ERROR") ++ if (words[0] == (const char *) u8"ERROR") + return Packet (Client::PC_ERROR, +- words.size () == 2 ? words[1]: u8"malformed error response"); ++ words.size () == 2 ? words[1] ++ : (const char *) u8"malformed error response"); + + if (isLast && !read.IsAtEnd ()) + return Packet (Client::PC_ERROR, +- std::string (u8"unexpected extra response")); ++ std::string ((const char *) u8"unexpected extra response")); + + Assert (code < Detail::RC_HWM); + Packet result (responseTable[code] (words)); + result.SetRequest (code); + if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ()) + { +- std::string msg {u8"malformed response '"}; ++ std::string msg {(const char *) u8"malformed response '"}; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + result.GetString () = std::move (msg); + } + else if (result.GetCode () == Client::PC_CONNECT) +@@ -199,7 +200,7 @@ Packet Client::Connect (char const *agent, char const *ident, + size_t alen, size_t ilen) + { + write.BeginLine (); +- write.AppendWord (u8"HELLO"); ++ write.AppendWord ((const char *) u8"HELLO"); + write.AppendInteger (Version); + write.AppendWord (agent, true, alen); + write.AppendWord (ident, true, ilen); +@@ -211,7 +212,8 @@ Packet Client::Connect (char const *agent, char const *ident, + // HELLO $version $agent [$flags] + Packet ConnectResponse (std::vector &words) + { +- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4)) ++ if (words[0] == (const char *) u8"HELLO" ++ && (words.size () == 3 || words.size () == 4)) + { + char *eptr; + unsigned long val = strtoul (words[1].c_str (), &eptr, 10); +@@ -247,7 +249,7 @@ Packet Client::ModuleRepo () + // PATHNAME $dir | ERROR + Packet PathnameResponse (std::vector &words) + { +- if (words[0] == u8"PATHNAME" && words.size () == 2) ++ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2) + return Packet (Client::PC_PATHNAME, std::move (words[1])); + + return Packet (Client::PC_ERROR, u8""); +@@ -256,7 +258,7 @@ Packet PathnameResponse (std::vector &words) + // OK or ERROR + Packet OKResponse (std::vector &words) + { +- if (words[0] == u8"OK") ++ if (words[0] == (const char *) u8"OK") + return Packet (Client::PC_OK); + else + return Packet (Client::PC_ERROR, +@@ -319,11 +321,11 @@ Packet Client::IncludeTranslate (char const *include, Flags flags, size_t ilen) + // PATHNAME $cmifile + Packet IncludeTranslateResponse (std::vector &words) + { +- if (words[0] == u8"BOOL" && words.size () == 2) ++ if (words[0] == (const char *) u8"BOOL" && words.size () == 2) + { +- if (words[1] == u8"FALSE") +- return Packet (Client::PC_BOOL, 0); +- else if (words[1] == u8"TRUE") ++ if (words[1] == (const char *) u8"FALSE") ++ return Packet (Client::PC_BOOL); ++ else if (words[1] == (const char *) u8"TRUE") + return Packet (Client::PC_BOOL, 1); + else + return Packet (Client::PC_ERROR, u8""); +diff --git a/libcody/cody.hh b/libcody/cody.hh +index 789ce9e70..93bce93aa 100644 +--- a/libcody/cody.hh ++++ b/libcody/cody.hh +@@ -47,12 +47,21 @@ namespace Detail { + + // C++11 doesn't have utf8 character literals :( + ++#if __cpp_char8_t >= 201811 ++template ++constexpr char S2C (char8_t const (&s)[I]) ++{ ++ static_assert (I == 2, "only single octet strings may be converted"); ++ return s[0]; ++} ++#else + template + constexpr char S2C (char const (&s)[I]) + { + static_assert (I == 2, "only single octet strings may be converted"); + return s[0]; + } ++#endif + + /// Internal buffering class. Used to concatenate outgoing messages + /// and Lex incoming ones. +@@ -123,6 +132,13 @@ public: + Space (); + Append (str, maybe_quote, len); + } ++#if __cpp_char8_t >= 201811 ++ void AppendWord (char8_t const *str, bool maybe_quote = false, ++ size_t len = ~size_t (0)) ++ { ++ AppendWord ((const char *) str, maybe_quote, len); ++ } ++#endif + /// Add a word as with AppendWord + /// @param str the string to append + /// @param maybe_quote string might need quoting, as for Append +@@ -264,6 +280,12 @@ public: + : string (s), cat (STRING), code (c) + { + } ++#if __cpp_char8_t >= 201811 ++ Packet (unsigned c, const char8_t *s) ++ : string ((const char *) s), cat (STRING), code (c) ++ { ++ } ++#endif + Packet (unsigned c, std::vector &&v) + : vector (std::move (v)), cat (VECTOR), code (c) + { +diff --git a/libcody/server.cc b/libcody/server.cc +index e2fa069bb..c18469fae 100644 +--- a/libcody/server.cc ++++ b/libcody/server.cc +@@ -36,12 +36,12 @@ static RequestPair + const requestTable[Detail::RC_HWM] = + { + // Same order as enum RequestCode +- RequestPair {u8"HELLO", nullptr}, +- RequestPair {u8"MODULE-REPO", ModuleRepoRequest}, +- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest}, +- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest}, +- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest}, +- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, ++ RequestPair {(const char *) u8"HELLO", nullptr}, ++ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest}, ++ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest}, ++ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest}, ++ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest}, ++ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, + }; + } + +@@ -135,21 +135,21 @@ void Server::ProcessRequests (void) + std::string msg; + + if (err > 0) +- msg = u8"error processing '"; ++ msg = (const char *) u8"error processing '"; + else if (ix >= Detail::RC_HWM) +- msg = u8"unrecognized '"; ++ msg = (const char *) u8"unrecognized '"; + else if (IsConnected () && ix == Detail::RC_CONNECT) +- msg = u8"already connected '"; ++ msg = (const char *) u8"already connected '"; + else if (!IsConnected () && ix != Detail::RC_CONNECT) +- msg = u8"not connected '"; ++ msg = (const char *) u8"not connected '"; + else +- msg = u8"malformed '"; ++ msg = (const char *) u8"malformed '"; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + if (err > 0) + { +- msg.append (u8" "); ++ msg.append ((const char *) u8" "); + msg.append (strerror (err)); + } + resolver->ErrorResponse (this, std::move (msg)); +@@ -176,7 +176,7 @@ Resolver *ConnectRequest (Server *s, Resolver *r, + return nullptr; + + if (words.size () == 3) +- words.emplace_back (u8""); ++ words.emplace_back ((const char *) u8""); + unsigned version = ParseUnsigned (words[1]); + if (version == ~0u) + return nullptr; diff --git a/libgcc/config.host b/libgcc/config.host -index 9d7212028d0..7ddde1dc464 100644 +index 9d7212028..7ddde1dc4 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1224,6 +1224,9 @@ powerpc-*-rtems*) @@ -714,23 +997,9 @@ index 9d7212028d0..7ddde1dc464 100644 tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" diff --git a/libgcc/config/rs6000/t-crtstuff-cell64lv2 b/libgcc/config/rs6000/t-crtstuff-cell64lv2 new file mode 100644 -index 00000000000..9eb9ca7ac35 +index 000000000..9eb9ca7ac --- /dev/null +++ b/libgcc/config/rs6000/t-crtstuff-cell64lv2 @@ -0,0 +1 @@ +CRTSTUFF_T_CFLAGS = -fno-asynchronous-unwind-tables \ No newline at end of file - -# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. -diff --git a/zlib/zutil.h b/zlib/zutil.h ---- a/zlib/zutil.h -+++ b/zlib/zutil.h -@@ -130,7 +130,7 @@ - # endif - #endif - --#if defined(MACOS) || defined(TARGET_OS_MAC) -+#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) - # define OS_CODE 7 - # ifndef Z_SOLO - # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/patches/gcc-9.5.0-PS3-host.patch b/patches/gcc-9.5.0-PS3-host.patch deleted file mode 100644 index 3306f48a8..000000000 --- a/patches/gcc-9.5.0-PS3-host.patch +++ /dev/null @@ -1,60 +0,0 @@ -# Host GCC 16 / libc++ 17+: include C++ headers before safe-ctype.h on every OS. -diff --git a/gcc/system.h b/gcc/system.h ---- a/gcc/system.h -+++ b/gcc/system.h -@@ -194,27 +194,9 @@ - #undef fread_unlocked - #undef fwrite_unlocked - --/* Include before "safe-ctype.h" to avoid GCC poisoning -- the ctype macros through safe-ctype.h */ -- --#ifdef __cplusplus --#ifdef INCLUDE_STRING --# include --#endif --#endif -- --/* There are an extraordinary number of issues with . -- The last straw is that it varies with the locale. Use libiberty's -- replacement instead. */ --#include "safe-ctype.h" -- --#include -- --#include -- --#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO --extern int errno; --#endif -+/* Include C++ headers before "safe-ctype.h". Host GCC 16 libstdc++ and -+ libc++ 17+ pull ctype names through //; the -+ poison macros break islower/toupper. */ - - #ifdef __cplusplus - #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) -@@ -235,8 +217,24 @@ - # include - # include - # include -+# include -+# include -+# include - #endif - -+/* There are an extraordinary number of issues with . -+ The last straw is that it varies with the locale. Use libiberty's -+ replacement instead. */ -+#include "safe-ctype.h" -+ -+#include -+ -+#include -+ -+#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO -+extern int errno; -+#endif -+ - /* Some of glibc's string inlines cause warnings. Plus we'd rather - rely on (and therefore test) GCC's string builtins. */ - #define __NO_STRING_INLINES diff --git a/patches/gcc-9.5.0-PS3-macos-arm64.patch b/patches/gcc-9.5.0-PS3-macos-arm64.patch deleted file mode 100644 index 1442b1a90..000000000 --- a/patches/gcc-9.5.0-PS3-macos-arm64.patch +++ /dev/null @@ -1,105 +0,0 @@ -# Build GCC 9.5.0 as a cross compiler on Apple Silicon. -diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h ---- a/gcc/config/aarch64/aarch64.h -+++ b/gcc/config/aarch64/aarch64.h -@@ -1088,6 +1088,6 @@ - #define MCPU_TO_MARCH_SPEC_FUNCTIONS \ - { "rewrite_mcpu", aarch64_rewrite_mcpu }, - --#if defined(__aarch64__) -+#if defined(__aarch64__) && !defined(__APPLE__) - extern const char *host_detect_local_cpu (int argc, const char **argv); - #define HAVE_LOCAL_CPU_DETECT -diff --git a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c ---- a/gcc/config/host-darwin.c -+++ b/gcc/config/host-darwin.c -@@ -22,6 +22,8 @@ - #include "coretypes.h" - #include "diagnostic-core.h" - #include "config/host-darwin.h" -+#include "hosthooks.h" -+#include "hosthooks-def.h" - - /* Yes, this is really supposed to work. */ - /* This allows for a pagesize of 16384, which we have on Darwin20, but should -@@ -76,5 +76,7 @@ - gcc_assert (!ret || mmap_result == addr); - } - - return ret; - } -+ -+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; -diff --git a/gcc/config.host b/gcc/config.host -index 816a0f06cb..2d9bf9ed48 100644 ---- a/gcc/config.host -+++ b/gcc/config.host -@@ -99,7 +99,8 @@ case ${host} in - esac - - case ${host} in -- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) -+ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ -+ aarch64*-*-darwin*) - case ${target} in - aarch64*-*-*) - host_extra_gcc_objs="driver-aarch64.o" -@@ -251,6 +252,10 @@ case ${host} in - host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" - host_lto_plugin_soname=liblto_plugin-0.dll - ;; -+ aarch64*-*-darwin*) -+ out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o" -+ host_xmake_file="${host_xmake_file} aarch64/x-darwin" -+ ;; - i[34567]86-*-darwin* | x86_64-*-darwin*) - out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o" - host_xmake_file="${host_xmake_file} i386/x-darwin" -diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c -new file mode 100644 -index 0000000000..d70f2df3bf ---- /dev/null -+++ b/gcc/config/aarch64/host-aarch64-darwin.c -@@ -0,0 +1,33 @@ -+/* aarch64/arm64-darwin host-specific hook definitions. -+ -+Copyright The GNU Toolchain Authors. -+ -+This file is part of GCC. -+ -+GCC is free software; you can redistribute it and/or modify it under -+the terms of the GNU General Public License as published by the Free -+Software Foundation; either version 3, or (at your option) any later -+version. -+ -+GCC is distributed in the hope that it will be useful, but WITHOUT ANY -+WARRANTY; without even the implied warranty of MERCHANTABILITY or -+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+for more details. -+ -+You should have received a copy of the GNU General Public License -+along with GCC; see the file COPYING3. If not see -+. */ -+ -+#define IN_TARGET_CODE 1 -+ -+#include "config.h" -+#include "system.h" -+#include "coretypes.h" -+#include "hosthooks.h" -+#include "hosthooks-def.h" -+#include "config/host-darwin.h" -+ -+/* Darwin doesn't do anything special for arm64/aarch64 hosts; this file -+ exists just to include the generic config/host-darwin.h. */ -+ -+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; -diff --git a/gcc/config/aarch64/x-darwin b/gcc/config/aarch64/x-darwin -new file mode 100644 -index 0000000000..6d788d5e89 ---- /dev/null -+++ b/gcc/config/aarch64/x-darwin -@@ -0,0 +1,3 @@ -+host-aarch64-darwin.o : $(srcdir)/config/aarch64/host-aarch64-darwin.c -+ $(COMPILE) $< -+ $(POSTCOMPILE) diff --git a/patches/gcc-9.5.0-PS3.patch b/patches/gcc-9.5.0-PS3.patch index 5c65bb271..e394a67d9 100644 --- a/patches/gcc-9.5.0-PS3.patch +++ b/patches/gcc-9.5.0-PS3.patch @@ -1,8 +1,113 @@ -# Original from https://github.com/ps3dev/ps3toolchain -# Updated to gcc 9.5.0 by Darjan Krijan [https://disc-kuraudo.eu] -diff '--color=auto' -urN a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h ---- a/gcc/config/rs6000/cell64lv2.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/gcc/config/rs6000/cell64lv2.h 2023-01-01 17:58:23.274094209 +0100 +diff --git a/Makefile.in b/Makefile.in +index 64e091ba71..33570f9dad 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -27294,7 +27294,6 @@ check-libiberty: + .PHONY: install-libiberty maybe-install-libiberty + maybe-install-libiberty: + @if libiberty +-maybe-install-libiberty: install-libiberty + + install-libiberty: installdirs + @: $(MAKE); $(unstage) +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 94885c7d75..3a2d236656 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -2587,6 +2587,15 @@ pdp11-*-*) + # tmake_file="${tmake_file} rs6000/t-fprules" + # extra_headers= + # ;; ++powerpc64-ps3-elf) ++ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" ++ tm_file="rs6000/biarch64.h ${tm_file} rs6000/cell64lv2.h" ++ if test x${enable_secureplt} = xyes; then ++ tm_file="rs6000/secureplt.h ${tm_file}" ++ fi ++ extra_options="${extra_options} rs6000/sysv4.opt" ++ tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" ++ ;; + powerpc-*-darwin*) + extra_options="${extra_options} ${cpu_type}/darwin.opt" + case ${target} in +diff --git a/gcc/config.host b/gcc/config.host +index 816a0f06cb..2d9bf9ed48 100644 +--- a/gcc/config.host ++++ b/gcc/config.host +@@ -99,7 +99,8 @@ case ${host} in + esac + + case ${host} in +- aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia*) ++ aarch64*-*-freebsd* | aarch64*-*-linux* | aarch64*-*-fuchsia* |\ ++ aarch64*-*-darwin*) + case ${target} in + aarch64*-*-*) + host_extra_gcc_objs="driver-aarch64.o" +@@ -251,6 +252,10 @@ case ${host} in + host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o" + host_lto_plugin_soname=liblto_plugin-0.dll + ;; ++ aarch64*-*-darwin*) ++ out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o" ++ host_xmake_file="${host_xmake_file} aarch64/x-darwin" ++ ;; + i[34567]86-*-darwin* | x86_64-*-darwin*) + out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o" + host_xmake_file="${host_xmake_file} i386/x-darwin" +diff --git a/gcc/config/aarch64/host-aarch64-darwin.c b/gcc/config/aarch64/host-aarch64-darwin.c +new file mode 100644 +index 0000000000..d70f2df3bf +--- /dev/null ++++ b/gcc/config/aarch64/host-aarch64-darwin.c +@@ -0,0 +1,33 @@ ++/* aarch64/arm64-darwin host-specific hook definitions. ++ ++Copyright The GNU Toolchain Authors. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify it under ++the terms of the GNU General Public License as published by the Free ++Software Foundation; either version 3, or (at your option) any later ++version. ++ ++GCC is distributed in the hope that it will be useful, but WITHOUT ANY ++WARRANTY; without even the implied warranty of MERCHANTABILITY or ++FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++for more details. ++ ++You should have received a copy of the GNU General Public License ++along with GCC; see the file COPYING3. If not see ++. */ ++ ++#define IN_TARGET_CODE 1 ++ ++#include "config.h" ++#include "system.h" ++#include "coretypes.h" ++#include "hosthooks.h" ++#include "hosthooks-def.h" ++#include "config/host-darwin.h" ++ ++/* Darwin doesn't do anything special for arm64/aarch64 hosts; this file ++ exists just to include the generic config/host-darwin.h. */ ++ ++const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; +diff --git a/gcc/config/aarch64/x-darwin b/gcc/config/aarch64/x-darwin +new file mode 100644 +index 0000000000..6d788d5e89 +--- /dev/null ++++ b/gcc/config/aarch64/x-darwin +@@ -0,0 +1,3 @@ ++host-aarch64-darwin.o : $(srcdir)/config/aarch64/host-aarch64-darwin.c ++ $(COMPILE) $< ++ $(POSTCOMPILE) +diff --git a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cell64lv2.h +new file mode 100644 +index 0000000000..31ebbd9552 +--- /dev/null ++++ b/gcc/config/rs6000/cell64lv2.h @@ -0,0 +1,587 @@ +/* Definitions of target machine for GNU compiler, + for 64 bit PowerPC linux. @@ -591,33 +696,36 @@ diff '--color=auto' -urN a/gcc/config/rs6000/cell64lv2.h b/gcc/config/rs6000/cel + enabling the __float128 keyword. */ +#undef TARGET_FLOAT128_ENABLE_TYPE +#define TARGET_FLOAT128_ENABLE_TYPE 1 -diff '--color=auto' -urN a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c ---- a/gcc/config/rs6000/rs6000.c 2022-05-27 09:21:11.000000000 +0200 -+++ b/gcc/config/rs6000/rs6000.c 2023-01-01 18:00:32.742783224 +0100 -@@ -1424,6 +1424,10 @@ +diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c +index 991dcca18e..68900a85c8 100644 +--- a/gcc/config/rs6000/rs6000.c ++++ b/gcc/config/rs6000/rs6000.c +@@ -1424,6 +1424,10 @@ rtl_opt_pass *make_pass_analyze_swaps (gcc::context*); static bool rs6000_keep_leaf_when_profiled () __attribute__ ((unused)); static tree rs6000_fold_builtin (tree, int, tree *, bool); +#ifdef POWERPC_CELL64LV2 -+static bool rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode); ++static bool rs6000_cell64lv2_valid_pointer_mode (scalar_int_mode); +#endif + /* Hash table stuff for keeping track of TOC entries. */ struct GTY((for_user)) toc_hash_struct -@@ -39732,7 +39736,18 @@ +@@ -39732,7 +39736,20 @@ rs6000_mangle_decl_assembler_name (tree decl, tree id) return id; } - +#ifdef POWERPC_CELL64LV2 ++ +#undef TARGET_VALID_POINTER_MODE +#define TARGET_VALID_POINTER_MODE rs6000_cell64lv2_valid_pointer_mode + +static bool -+rs6000_cell64lv2_valid_pointer_mode(scalar_int_mode mode) ++rs6000_cell64lv2_valid_pointer_mode (scalar_int_mode mode) +{ -+ return (mode == SImode || (TARGET_64BIT && mode == DImode) || mode == ptr_mode || mode == Pmode); ++ return (mode == SImode || (TARGET_64BIT && mode == DImode) ++ || mode == ptr_mode || mode == Pmode); +} + +#endif @@ -625,29 +733,11 @@ diff '--color=auto' -urN a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000 struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-rs6000.h" -diff '--color=auto' -urN a/gcc/config.gcc b/gcc/config.gcc ---- a/gcc/config.gcc 2022-05-27 09:21:10.000000000 +0200 -+++ b/gcc/config.gcc 2023-01-01 14:28:35.684278963 +0100 -@@ -2587,6 +2587,15 @@ - # tmake_file="${tmake_file} rs6000/t-fprules" - # extra_headers= - # ;; -+powerpc64-ps3-elf) -+ tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h usegas.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/default64.h" -+ tm_file="rs6000/biarch64.h ${tm_file} rs6000/cell64lv2.h" -+ if test x${enable_secureplt} = xyes; then -+ tm_file="rs6000/secureplt.h ${tm_file}" -+ fi -+ extra_options="${extra_options} rs6000/sysv4.opt" -+ tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm" -+ ;; - powerpc-*-darwin*) - extra_options="${extra_options} ${cpu_type}/darwin.opt" - case ${target} in -diff '--color=auto' -urN a/gcc/configure b/gcc/configure ---- a/gcc/configure 2022-05-27 09:21:46.000000000 +0200 -+++ b/gcc/configure 2023-01-01 14:52:19.312078588 +0100 -@@ -28944,12 +28944,12 @@ +diff --git a/gcc/configure b/gcc/configure +index 8c25a18fa0..60d12e6bc4 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -28944,12 +28944,12 @@ $as_echo "#define HAVE_LD_PPC_GNU_ATTR_LONG_DOUBLE 1" >>confdefs.h esac case "$target:$tm_file" in @@ -662,10 +752,11 @@ diff '--color=auto' -urN a/gcc/configure b/gcc/configure emul_name="-melf64ppc" ;; *le-*-freebsd*) -diff '--color=auto' -urN a/gcc/configure.ac b/gcc/configure.ac ---- a/gcc/configure.ac 2022-05-27 09:21:11.000000000 +0200 -+++ b/gcc/configure.ac 2023-01-01 14:51:42.742384668 +0100 -@@ -5671,12 +5671,12 @@ +diff --git a/gcc/configure.ac b/gcc/configure.ac +index d67f72df8a..2f7fc60c0c 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -5671,12 +5671,12 @@ EOF esac case "$target:$tm_file" in @@ -680,10 +771,75 @@ diff '--color=auto' -urN a/gcc/configure.ac b/gcc/configure.ac emul_name="-melf64ppc" ;; *le-*-freebsd*) -diff '--color=auto' -urN a/libgcc/config.host b/libgcc/config.host ---- a/libgcc/config.host 2022-05-27 09:21:12.000000000 +0200 -+++ b/libgcc/config.host 2023-01-01 14:29:07.913987821 +0100 -@@ -1134,6 +1134,8 @@ +diff --git a/gcc/system.h b/gcc/system.h +index d04f8fd336..97be99e4a0 100644 +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...); + #undef fread_unlocked + #undef fwrite_unlocked + +-/* Include before "safe-ctype.h" to avoid GCC poisoning +- the ctype macros through safe-ctype.h */ +- +-#ifdef __cplusplus +-#ifdef INCLUDE_STRING +-# include +-#endif +-#endif +- +-/* There are an extraordinary number of issues with . +- The last straw is that it varies with the locale. Use libiberty's +- replacement instead. */ +-#include "safe-ctype.h" +- +-#include +- +-#include +- +-#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +-extern int errno; +-#endif ++/* Include C++ standard headers before "safe-ctype.h" to avoid GCC ++ poisoning the ctype macros through safe-ctype.h */ + + #ifdef __cplusplus + #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) +@@ -229,6 +210,9 @@ extern int errno; + #ifdef INCLUDE_SET + # include + #endif ++#ifdef INCLUDE_STRING ++# include ++#endif + #ifdef INCLUDE_VECTOR + # include + #endif +@@ -237,6 +221,19 @@ extern int errno; + # include + #endif + ++/* There are an extraordinary number of issues with . ++ The last straw is that it varies with the locale. Use libiberty's ++ replacement instead. */ ++#include "safe-ctype.h" ++ ++#include ++ ++#include ++ ++#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO ++extern int errno; ++#endif ++ + /* Some of glibc's string inlines cause warnings. Plus we'd rather + rely on (and therefore test) GCC's string builtins. */ + #define __NO_STRING_INLINES +diff --git a/libgcc/config.host b/libgcc/config.host +index 0486a0135e..842252d106 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -1134,6 +1134,8 @@ powerpc-*-rtems*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-crtstuff-pic t-fdpbit" extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o" ;; @@ -692,28 +848,3 @@ diff '--color=auto' -urN a/libgcc/config.host b/libgcc/config.host powerpc*-*-linux*) tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc" tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000" -diff '--color=auto' -urN a/Makefile.in b/Makefile.in ---- a/Makefile.in 2022-05-27 09:21:10.000000000 +0200 -+++ b/Makefile.in 2023-01-01 14:54:20.241067239 +0100 -@@ -27294,7 +27294,6 @@ - .PHONY: install-libiberty maybe-install-libiberty - maybe-install-libiberty: - @if libiberty --maybe-install-libiberty: install-libiberty - - install-libiberty: installdirs - @: $(MAKE); $(unstage) - -# Apple Clang 17+ defines TARGET_OS_MAC; do not stub fdopen() on macOS. -diff --git a/zlib/zutil.h b/zlib/zutil.h ---- a/zlib/zutil.h -+++ b/zlib/zutil.h -@@ -137,7 +137,7 @@ - # endif - #endif - --#if defined(MACOS) || defined(TARGET_OS_MAC) -+#if defined(MACOS) || (defined(TARGET_OS_MAC) && !defined(__APPLE__)) - # define OS_CODE 7 - # ifndef Z_SOLO - # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os diff --git a/scripts/002-gcc-newlib-PPU.sh b/scripts/002-gcc-newlib-PPU.sh index 15a28c222..b6166ec52 100755 --- a/scripts/002-gcc-newlib-PPU.sh +++ b/scripts/002-gcc-newlib-PPU.sh @@ -35,13 +35,6 @@ if [ ! -d ${GCC} ]; then ## Patch the source code. cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} - ## Host GCC 16 / libc++ 17+: safe-ctype vs /, libcody char8_t - cat ../patches/${GCC}-PS3-host.patch | patch -p1 -d ${GCC} - ## Apple Silicon host_hooks / native aarch64 detect - if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then - cat ../patches/${GCC}-PS3-macos-arm64.patch | patch -p1 -d ${GCC} - fi - ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${GCC} diff --git a/scripts/005-binutils-SPU.sh b/scripts/005-binutils-SPU.sh index 2fe535e14..b2c2c2186 100755 --- a/scripts/005-binutils-SPU.sh +++ b/scripts/005-binutils-SPU.sh @@ -36,8 +36,6 @@ fi cd ${BINUTILS}/build-spu ## Configure the build. -## Host GCC 15/16 default to C23; binutils 2.22 uses K&R-era C. -CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-implicit-function-declaration" \ ../configure --prefix="$PS3DEV/spu" --target="spu" \ --disable-nls \ --disable-shared \ @@ -46,9 +44,7 @@ CFLAGS="${CFLAGS:-} -std=gnu17 -Wno-incompatible-pointer-types -Wno-int-conversi --disable-werror \ --with-gcc \ --with-gnu-as \ - --with-gnu-ld \ - --enable-lto \ - --with-system-zlib + --with-gnu-ld ## Compile and install. PROCS="$(nproc --all 2>&1)" || ret=$? diff --git a/scripts/006-gcc-newlib-SPU.sh b/scripts/006-gcc-newlib-SPU.sh index 8310e67ff..625abf940 100755 --- a/scripts/006-gcc-newlib-SPU.sh +++ b/scripts/006-gcc-newlib-SPU.sh @@ -35,13 +35,6 @@ if [ ! -d ${GCC} ]; then ## Patch the source code. cat ../patches/${GCC}-PS3.patch | patch -p1 -d ${GCC} - ## Host GCC 16 / libc++ 17+: safe-ctype vs / - cat ../patches/${GCC}-PS3-host.patch | patch -p1 -d ${GCC} - ## Apple Silicon host_hooks / native aarch64 detect - if [[ $(uname -s) == 'Darwin' && $(uname -m) == 'arm64' ]]; then - cat ../patches/${GCC}-PS3-macos-arm64.patch | patch -p1 -d ${GCC} - fi - ## Replace config.guess and config.sub cp ../archives/config.guess ../archives/config.sub ${GCC} @@ -71,7 +64,6 @@ fi cd ${GCC}/build-spu ## Configure the build. -unset CFLAGS CXXFLAGS LDFLAGS CFLAGS_FOR_TARGET="-Os -fpic -ffast-math -ftree-vectorize -funroll-loops -fschedule-insns -mdual-nops -mwarn-reloc" \ CFLAGS="-Wno-int-conversion" \ CXXFLAGS="-Wno-int-conversion" \ diff --git a/scripts/009-ps3libraries.sh b/scripts/009-ps3libraries.sh index 3d899dda1..1236e6235 100755 --- a/scripts/009-ps3libraries.sh +++ b/scripts/009-ps3libraries.sh @@ -10,9 +10,6 @@ fi source ../utils/utils.sh -## Host CC/CXX (common in Docker) makes autotools skip powerpc64-ps3-elf-gcc. -unset CC CXX CPP - ## Download the source code. ../download.sh ps3libraries.tar.gz