Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade GCC version (PPU-SPU) #121

Open
wants to merge 136 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
1a930c0
add gcc-ppu-spu v13.2.0
humbertodias Mar 5, 2024
868e7f8
ignore mac .DS_Store
humbertodias Mar 5, 2024
d044950
[fix] github actions
humbertodias Mar 5, 2024
b237a9a
[gha] python dependency name fixed for ubuntu-latest
humbertodias Mar 5, 2024
57d3d7a
[gha] install python2 manually
humbertodias Mar 5, 2024
de37a37
[gha] sudo required
humbertodias Mar 5, 2024
eac7e4f
[gha] add g++ with c11 support
humbertodias Mar 5, 2024
2f2633f
specific patch file for gcc ppu
humbertodias Mar 5, 2024
afb604f
[gha] unnecessary -get
humbertodias Mar 5, 2024
66979e9
gcc 9.5.0 for spu
humbertodias Mar 5, 2024
3445df8
ppu only for c lang
humbertodias Mar 5, 2024
319554b
[ppu] add c++
humbertodias Mar 5, 2024
c48e4e1
[ppu] fix for _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE=0
humbertodias Mar 5, 2024
6c44881
[ppu] HAVE_STRUCT_DIRENT_D_TYPE=0
humbertodias Mar 5, 2024
5af633b
[ppu] HAVE_STRUCT_DIRENT_D_TYPE=0
humbertodias Mar 5, 2024
5e818ab
spu-gcc 7.20
humbertodias Mar 5, 2024
4a6b6f7
add c++ lang for spu-gcc
humbertodias Mar 5, 2024
3be7a7d
alias sed='gsed' for mac
humbertodias Mar 5, 2024
e489a56
gsed alias for macOS
humbertodias Mar 5, 2024
4fc062a
add python2-dev and libssl-dev for psl1ght build
humbertodias Mar 5, 2024
9cb47c7
[gha] only ubuntu for while
humbertodias Mar 5, 2024
b26dbb0
[gha] set default shell to bash
humbertodias Mar 5, 2024
10609f0
[gha] use ~/.bashrc
humbertodias Mar 5, 2024
2a64760
[gha] mac already have python installed
humbertodias Mar 5, 2024
1e96642
[gha] get current arch
humbertodias Mar 5, 2024
a3f0d38
[gha] checkout@v4
humbertodias Mar 6, 2024
6ccca08
[gha] replace apple python for [email protected]
humbertodias Mar 6, 2024
c54ad20
binutils-2.42
humbertodias Mar 6, 2024
fc97138
ppu gcc remove -Werror=format-security
humbertodias Mar 6, 2024
dad8ba2
[ppu] avoiding switch case duplication on dir-common.h
humbertodias Mar 6, 2024
14c882c
[spu] gcc-9.5.0
humbertodias Mar 6, 2024
ba86afa
Revert "binutils-2.42"
humbertodias Mar 6, 2024
75b6197
[ppu] binutils-2.42
humbertodias Mar 6, 2024
df37178
[ci] add macos-latest
humbertodias Mar 6, 2024
a38290b
[ci-mac] remove python
humbertodias Mar 6, 2024
a4ef882
[ci-mac] add python2 manually
humbertodias Mar 6, 2024
f1e532f
[ci-mac] sudo required
humbertodias Mar 6, 2024
98a03e5
[docker] update ubuntu to 24.04 the last LTS
humbertodias Mar 6, 2024
eec7d6b
[spu] enable GWINSZ_IN_SYS_IOCTL using mac compiler
humbertodias Mar 6, 2024
9b064af
[spu-gdb] moving fix for mac to patch file
humbertodias Mar 6, 2024
02de5f4
[ci] docker hub
humbertodias Mar 6, 2024
f5bf275
[ci] add python11 with diskutils module
humbertodias Mar 6, 2024
0886e06
[ci] python 2.7
humbertodias Mar 6, 2024
62c2bfc
Revert "[ci] python 2.7"
humbertodias Mar 6, 2024
c5de509
[ci] install python manually for macos
humbertodias Mar 6, 2024
6ec4cc5
[ci] [email protected] support disktutils
humbertodias Mar 6, 2024
39c17bf
[ci] mac already have python installed
humbertodias Mar 6, 2024
bbced14
[ci] pip install python-config
humbertodias Mar 6, 2024
6eba504
[ci] macos-13
humbertodias Mar 6, 2024
bb22459
[ci] brew install python3
humbertodias Mar 6, 2024
a033745
[ci] unlink python3 first
humbertodias Mar 6, 2024
a12fccb
[ci] show python installed version
humbertodias Mar 6, 2024
59e1c5f
[ci] mac install makeinfo
humbertodias Mar 6, 2024
be59dce
[ci] uninstall py3.12 for downgrading to 3.11
humbertodias Mar 6, 2024
5ed350f
[ci] brew uninstall --ignore-dependencies python3
humbertodias Mar 6, 2024
25b89ed
ignoring .vscode
humbertodias Mar 6, 2024
c019c46
[ci] install python3.11 using pyenv
humbertodias Mar 6, 2024
335c8c4
[ci] checking python-config
humbertodias Mar 6, 2024
a6ca9a7
[ci] alias python-config
humbertodias Mar 6, 2024
f7ae248
Update deploy.yaml
humbertodias Mar 6, 2024
af9ea70
Update deploy.yaml
humbertodias Mar 6, 2024
38eeddb
Update deploy.yaml
humbertodias Mar 6, 2024
22026d3
Update deploy.yaml
humbertodias Mar 6, 2024
b09a226
Update deploy.yaml
humbertodias Mar 6, 2024
e3eaebd
Update deploy.yaml
humbertodias Mar 6, 2024
b82e917
[ci] add ubuntu-latest
humbertodias Mar 6, 2024
4140ac8
[docker] add python 3.11.8 using pyenv
humbertodias Mar 6, 2024
e018f59
[ci] only ubuntu. mas is taking too long
humbertodias Mar 6, 2024
422541b
[docker] typo
humbertodias Mar 6, 2024
31d0609
Update Dockerfile
humbertodias Mar 7, 2024
a8b1513
Update Dockerfile
humbertodias Mar 7, 2024
53a74e1
Update Dockerfile
humbertodias Mar 7, 2024
46f2dbc
Update deploy-docker.yaml
humbertodias Mar 9, 2024
fddd3ad
CFLAGS=-fno-asynchronous-unwind-tables
humbertodias Mar 11, 2024
aba3190
Update deploy-docker.yaml
humbertodias Mar 11, 2024
1fb2289
Update Dockerfile
humbertodias Mar 11, 2024
c07bfc4
add PATH=/portlibs/ppu/bin
humbertodias Mar 11, 2024
9056e95
Update 009-ps3libraries.sh
humbertodias Mar 14, 2024
755d941
Update Dockerfile
humbertodias Mar 14, 2024
dd90084
Update deploy.yaml
humbertodias Mar 14, 2024
21a85b4
Update 009-ps3libraries.sh
humbertodias Mar 14, 2024
e892486
add PATH=$PATH:$PS3DEV/portlibs/ppu/bin
humbertodias Mar 15, 2024
d8e237a
PKG_CONFIG_PATH=$PS3DEV/portlibs/ppu/lib/pkgconfig
humbertodias Mar 15, 2024
1cc315a
rm tmp files
humbertodias Mar 15, 2024
504fe34
Update Dockerfile
humbertodias Mar 15, 2024
1416700
python 3.10 + pycrypto + nvidia-cg-toolkit
humbertodias Mar 16, 2024
e7bc2ca
newlib fix to avoid duplicated values on dirent_type
humbertodias Mar 19, 2024
04ddabf
typo 006-gcc-newlib-SPU.sh
humbertodias Mar 19, 2024
4d23a17
install nvidia-cg-toolkit only for x68 arch
humbertodias Apr 3, 2024
16a0243
docker multi-stage image
humbertodias Apr 3, 2024
a4910a8
add base stage
humbertodias Apr 6, 2024
8997114
download source code only if directory doesn't exist
humbertodias Apr 6, 2024
dea2c90
enabling linux/arm
humbertodias Apr 6, 2024
c450e53
typo
humbertodias Apr 6, 2024
6729efb
skip arm
humbertodias Apr 6, 2024
08351b7
typo
humbertodias Apr 6, 2024
1520f52
ci x86 install nvidia-cg-toolkit
humbertodias Apr 6, 2024
9d48317
sudo
humbertodias Apr 6, 2024
900a37d
add linux/arm64
humbertodias Apr 6, 2024
72bbba7
architecture: [x64, arm64]
humbertodias Apr 6, 2024
b5dee46
doc: how to build multi platform image
humbertodias Apr 6, 2024
627a9c4
release tagname with arch
humbertodias Apr 6, 2024
73d3c69
upload/download artifact
humbertodias Apr 7, 2024
26bfb46
publish-release
humbertodias Apr 7, 2024
b6399bc
Compress ps3dev folder
humbertodias Apr 7, 2024
b5dcf2d
Download all Artifact
humbertodias Apr 7, 2024
0be0b57
typo
humbertodias Apr 7, 2024
6812c43
typo
humbertodias Apr 7, 2024
2eac023
typo
humbertodias Apr 7, 2024
1bc901f
typo
humbertodias Apr 7, 2024
9395268
tag auto creation
humbertodias Apr 7, 2024
883f535
create-tag@v1
humbertodias Apr 7, 2024
8f655f9
tag name semantic version
humbertodias Apr 7, 2024
77a966e
steps.semver.outputs.semver
humbertodias Apr 7, 2024
9e951a7
Check if Tag Exists
humbertodias Apr 7, 2024
8175a5a
git fetch --tags
humbertodias Apr 7, 2024
52dbd3c
create tag on publish job
humbertodias Apr 7, 2024
10fd234
needs.build.outputs.sha8
humbertodias Apr 7, 2024
f18bd35
add macos-latest
humbertodias Apr 7, 2024
72718dc
docker build/push without qemu
humbertodias Apr 7, 2024
edca12c
arch[x64,arm64]
humbertodias Apr 7, 2024
dc963ff
ubuntu arm not supported for gha
humbertodias Apr 7, 2024
ccf1da7
add qemu
humbertodias Apr 7, 2024
5b403d9
qemu matrix platform
humbertodias Apr 8, 2024
1c8468e
typo
humbertodias Apr 8, 2024
f2df629
typo
humbertodias Apr 8, 2024
5b1eeaf
platforms: ${{ matrix.platform }}
humbertodias Apr 8, 2024
03ef1e6
typo
humbertodias Apr 8, 2024
49b062e
macos-14
humbertodias Apr 8, 2024
2ae5696
source ~/.bashrc
humbertodias Apr 8, 2024
e30a10b
typo
humbertodias Apr 8, 2024
fb853f0
force loading .bashrc
humbertodias Apr 8, 2024
1acdfb5
pyenv init --path
humbertodias Apr 8, 2024
1defaf3
macos-latest
humbertodias Apr 8, 2024
5f7ca93
remove arm64
humbertodias Apr 8, 2024
da9c7f7
recursive file path
humbertodias Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/deploy-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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
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
169 changes: 112 additions & 57 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,68 +1,123 @@
name: Build toolchain docker image
name: ci

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
workflow_dispatch:
repository_dispatch:
types: [run_build]

jobs:
Docker:
runs-on: ubuntu-latest
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 }}

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@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: startsWith(matrix.os, 'ubuntu')
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 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
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 gnu-sed texinfo
echo "alias sed='gsed'" >> ~/.bashrc

# check current version
python --version
#python-config --libs

# 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
pip install python-config
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
echo 'pyenv global 3.11.0' >> ~/.bashrc
echo 'echo bashrc loaded' >> ~/.bashrc

- name: Runs all the stages in the shell
run: |
${{ steps.login.outputs.buildx }} --file Dockerfile .
- name: Clear
if: always()
. ~/.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
run: |
rm -rf ${HOME}/.docker/config.json
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

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
build/
.idea/**
.DS_Store
ps3dev
.vscode
57 changes: 40 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
FROM ubuntu:xenial
LABEL maintainer="[email protected]"

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

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 \
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

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}/

FROM base as builder
RUN mkdir /build
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 /build/toolchain.sh

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
ENV PKG_CONFIG_PATH ${PS3DEV}/portlibs/ppu/lib/pkgconfig
COPY --from=builder ${PS3DEV} ${PS3DEV}

# 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
File renamed without changes.
75 changes: 75 additions & 0 deletions patches/binutils-2.42-PS3-PPU.patch
Original file line number Diff line number Diff line change
@@ -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;
Loading