├── .dockerignore ├── .github └── workflows │ └── build.yml ├── .gitignore ├── Makefile ├── README.md ├── gcc-2.5.7-psx.Dockerfile ├── gcc-2.5.7.Dockerfile ├── gcc-2.6.0-psx.Dockerfile ├── gcc-2.6.0.Dockerfile ├── gcc-2.6.3-psx.Dockerfile ├── gcc-2.6.3.Dockerfile ├── gcc-2.7.0.Dockerfile ├── gcc-2.7.1.Dockerfile ├── gcc-2.7.2-psx.Dockerfile ├── gcc-2.7.2.1.Dockerfile ├── gcc-2.7.2.2.Dockerfile ├── gcc-2.7.2.3.Dockerfile ├── gcc-2.7.2.Dockerfile ├── gcc-2.8.0-psx.Dockerfile ├── gcc-2.8.0.Dockerfile ├── gcc-2.8.1-psx.Dockerfile ├── gcc-2.8.1.Dockerfile ├── gcc-2.91.66-psx.Dockerfile ├── gcc-2.91.66.Dockerfile ├── gcc-2.95.2-psx.Dockerfile ├── gcc-2.95.2.Dockerfile ├── patches ├── cccp-2.5.7.c.patch ├── cccp-2.6.0.c.patch ├── collect2-2.6.0.c.patch ├── config.sub.patch ├── configure.patch ├── g++-2.5.7.c.patch ├── g++-2.6.0.c.patch ├── g++-2.6.3.c.patch ├── gcc-2.5.7.c.patch ├── gcc-2.6.0.c.patch ├── gvarargs-2.5.7.h.patch ├── mips-2.5.7.h.patch ├── mips.patch ├── mipsel-2.5.patch ├── mipsel-2.6.patch ├── mipsel-2.7.patch ├── mipsel-2.8.patch ├── obstack-2.5.7.h.patch ├── obstack-2.7.2.h.patch ├── obstack-2.8.0.h.patch ├── obstack-2.8.1.h.patch ├── obstack-2.91.66.h.patch ├── obstack-2.95.2.h.patch ├── psx-2.5.7.patch ├── psx-2.91.patch ├── psx.patch ├── sdbout-2.6.0.c.patch └── sdbout-2.6.3.c.patch └── tests ├── little_endian.c └── section_attribute.c /.dockerignore: -------------------------------------------------------------------------------- 1 | build-*/ 2 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Compile GCC 2 | on: 3 | push: 4 | tags: '*' 5 | branches: [master] 6 | paths-ignore: 7 | - README.md 8 | pull_request: 9 | branches: [master] 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | version: 17 | - 2.5.7 18 | - 2.5.7-psx 19 | - 2.6.0 20 | - 2.6.0-psx 21 | - 2.6.3 22 | - 2.6.3-psx 23 | - 2.7.0 24 | - 2.7.1 25 | - 2.7.2 26 | - 2.7.2-psx 27 | - 2.7.2.1 28 | - 2.7.2.2 29 | - 2.7.2.3 30 | - 2.8.0 31 | - 2.8.0-psx 32 | - 2.8.1 33 | - 2.8.1-psx 34 | - 2.91.66 35 | - 2.91.66-psx 36 | - 2.95.2 37 | - 2.95.2-psx 38 | name: Build GCC ${{ matrix.version }} 39 | steps: 40 | - name: Clone repository 41 | uses: actions/checkout@v4 42 | - name: Build GCC 43 | run: VERSION=${{ matrix.version }} make 44 | - name: Create release archive 45 | shell: bash 46 | run: | 47 | cd build-gcc-${{ matrix.version }} 48 | tar -czvf ../gcc-${{ matrix.version }}.tar.gz * 49 | - name: Create artifact 50 | uses: actions/upload-artifact@v4 51 | with: 52 | name: gcc-${{ matrix.version }} 53 | path: gcc-${{ matrix.version }}.tar.gz 54 | - name: Publish release 55 | uses: softprops/action-gh-release@v2 56 | if: startsWith(github.ref, 'refs/tags/') 57 | with: 58 | files: | 59 | gcc-${{ matrix.version }}.tar.gz 60 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build-*/ 2 | gcc-*/ 3 | sources/ 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: check-version 2 | docker build -f gcc-$(VERSION).Dockerfile --target export --output build-gcc-$(VERSION) . 3 | 4 | clean: 5 | rm -rf build-gcc-*/ 6 | 7 | check-version: 8 | ifndef VERSION 9 | $(error You must specify a VERSION e.g. `make VERSION=2.8.1`) 10 | endif 11 | ifeq ($(wildcard gcc-$(VERSION).Dockerfile),) 12 | $(error Building GCC $(VERSION) is not currently supported) 13 | endif 14 | 15 | .PHONY: all check-version 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Old GCC 2 | 3 | Run `VERSION=2.7.2.2 make` to build an old version of GCC. 4 | 5 | Alternatively use one of the prebuild binaries available from the [Releases](https://github.com/decompals/old-gcc/releases) page. 6 | 7 | **Currently supported versions:** 8 | - GCC 2.5.7 9 | - GCC 2.6.0 10 | - GCC 2.6.3 11 | - GCC 2.7.0 12 | - GCC 2.7.1 13 | - GCC 2.7.2 14 | - GCC 2.7.2.1 15 | - GCC 2.7.2.2 16 | - GCC 2.7.2.3 17 | - GCC 2.8.0 18 | - GCC 2.8.1 19 | - GCC 2.91.66 20 | - GCC 2.95.22 21 | 22 | **NOTE:** All the builds target the `mipsel` architecture. GCC 2.7.0 and above can be passed `-meb` to target big endian at runtime. 23 | -------------------------------------------------------------------------------- /gcc-2.5.7-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://www.nic.funet.fi/index/gnu/funet/historical-funet-gnu-area-from-early-1990s/gcc-2.5.7.tar.gz 8 | RUN tar xzf gcc-2.5.7.tar.gz 9 | 10 | WORKDIR /work/gcc-2.5.7 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 gvarargs.h -i ../patches/gvarargs-2.5.7.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.0.c.patch 16 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.5.7.h.patch 17 | RUN patch -u -p1 collect2.c -i ../patches/collect2-2.6.0.c.patch 18 | RUN patch -u -p1 cccp.c -i ../patches/cccp-2.5.7.c.patch 19 | RUN patch -u -p1 gcc.c -i ../patches/gcc-2.5.7.c.patch 20 | RUN patch -u -p1 g++.c -i ../patches/g++-2.5.7.c.patch 21 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mips-2.5.7.h.patch 22 | RUN patch -su -p1 < ../patches/psx-2.5.7.patch 23 | RUN touch insn-config.h 24 | 25 | RUN ./configure \ 26 | --target=mips-sony-psx \ 27 | --prefix=/opt/cross \ 28 | --with-endian-little \ 29 | --with-gnu-as \ 30 | --host=i386-pc-linux \ 31 | --build=i386-pc-linux 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -march=i686 -DHAVE_STRERROR" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -help &1 | grep -- -msoft-float 38 | 39 | RUN mv xgcc gcc 40 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ || true 41 | 42 | FROM scratch AS export 43 | COPY --from=build /build/* . 44 | -------------------------------------------------------------------------------- /gcc-2.5.7.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://www.nic.funet.fi/index/gnu/funet/historical-funet-gnu-area-from-early-1990s/gcc-2.5.7.tar.gz 8 | RUN tar xzf gcc-2.5.7.tar.gz 9 | 10 | WORKDIR /work/gcc-2.5.7 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 gvarargs.h -i ../patches/gvarargs-2.5.7.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.0.c.patch 16 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.5.7.h.patch 17 | RUN patch -u -p1 collect2.c -i ../patches/collect2-2.6.0.c.patch 18 | RUN patch -u -p1 cccp.c -i ../patches/cccp-2.5.7.c.patch 19 | RUN patch -u -p1 gcc.c -i ../patches/gcc-2.5.7.c.patch 20 | RUN patch -u -p1 g++.c -i ../patches/g++-2.5.7.c.patch 21 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.5.patch 22 | 23 | RUN ./configure \ 24 | --target=mips-linux-gnu \ 25 | --prefix=/opt/cross \ 26 | --with-endian-little \ 27 | --with-gnu-as \ 28 | --host=i386-pc-linux \ 29 | --build=i386-pc-linux 30 | 31 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -DHAVE_STRERROR" 32 | 33 | COPY tests /work/tests 34 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 35 | 36 | RUN mv xgcc gcc 37 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 38 | 39 | FROM scratch AS export 40 | COPY --from=build /build/* . 41 | -------------------------------------------------------------------------------- /gcc-2.6.0-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://www.nic.funet.fi/index/gnu/funet/historical-funet-gnu-area-from-early-1990s/gcc-2.6.0.tar.gz 8 | RUN tar xzf gcc-2.6.0.tar.gz 9 | 10 | WORKDIR /work/gcc-2.6.0 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.0.c.patch 16 | RUN patch -u -p1 collect2.c -i ../patches/collect2-2.6.0.c.patch 17 | RUN patch -u -p1 cccp.c -i ../patches/cccp-2.6.0.c.patch 18 | RUN patch -u -p1 gcc.c -i ../patches/gcc-2.6.0.c.patch 19 | RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.0.c.patch 20 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.6.patch 21 | RUN patch -su -p1 < ../patches/psx-2.5.7.patch 22 | 23 | RUN ./configure \ 24 | --target=mips-sony-psx \ 25 | --prefix=/opt/cross \ 26 | --with-endian-little \ 27 | --with-gnu-as \ 28 | --host=i386-pc-linux \ 29 | --build=i386-pc-linux 30 | 31 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -DHAVE_STRERROR" 32 | 33 | COPY tests /work/tests 34 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 35 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 36 | RUN ./cc1 -quiet -help &1 | grep -- -msoft-float 37 | 38 | RUN mv xgcc gcc 39 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 40 | 41 | FROM scratch AS export 42 | COPY --from=build /build/* . 43 | -------------------------------------------------------------------------------- /gcc-2.6.0.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://www.nic.funet.fi/index/gnu/funet/historical-funet-gnu-area-from-early-1990s/gcc-2.6.0.tar.gz 8 | RUN tar xzf gcc-2.6.0.tar.gz 9 | 10 | WORKDIR /work/gcc-2.6.0 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.0.c.patch 16 | RUN patch -u -p1 collect2.c -i ../patches/collect2-2.6.0.c.patch 17 | RUN patch -u -p1 cccp.c -i ../patches/cccp-2.6.0.c.patch 18 | RUN patch -u -p1 gcc.c -i ../patches/gcc-2.6.0.c.patch 19 | RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.0.c.patch 20 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.6.patch 21 | 22 | RUN ./configure \ 23 | --target=mips-linux-gnu \ 24 | --prefix=/opt/cross \ 25 | --with-endian-little \ 26 | --with-gnu-as \ 27 | --host=i386-pc-linux \ 28 | --build=i386-pc-linux 29 | 30 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -DHAVE_STRERROR" 31 | 32 | COPY tests /work/tests 33 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 34 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 35 | 36 | RUN mv xgcc gcc 37 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 38 | 39 | FROM scratch AS export 40 | COPY --from=build /build/* . 41 | -------------------------------------------------------------------------------- /gcc-2.6.3-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget https://mirrors.slackware.com/slackware/slackware-2.2.0/source/d/gcc/gcc-2.6.3.tar.gz 8 | RUN tar xzf gcc-2.6.3.tar.gz 9 | 10 | WORKDIR /work/gcc-2.6.3 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.3.c.patch 16 | RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.3.c.patch 17 | RUN patch -su -p1 < ../patches/psx-2.5.7.patch 18 | 19 | RUN touch -c cp/parse.y cp/parse.h cp/parse.c 20 | RUN touch insn-config.h 21 | 22 | RUN ./configure \ 23 | --target=mips-sony-psx \ 24 | --prefix=/opt/cross \ 25 | --with-endian-little \ 26 | --with-gnu-as \ 27 | --host=i386-pc-linux \ 28 | --build=i386-pc-linux 29 | 30 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -march=i686 -DHAVE_STRERROR" 31 | 32 | COPY tests /work/tests 33 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 34 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 35 | RUN ./cc1 -quiet -help &1 | grep -- -msoft-float 36 | 37 | RUN mv xgcc gcc 38 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ || true 39 | 40 | FROM scratch AS export 41 | COPY --from=build /build/* . 42 | -------------------------------------------------------------------------------- /gcc-2.6.3.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget https://mirrors.slackware.com/slackware/slackware-2.2.0/source/d/gcc/gcc-2.6.3.tar.gz 8 | RUN tar xzf gcc-2.6.3.tar.gz 9 | 10 | WORKDIR /work/gcc-2.6.3 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.3.c.patch 16 | RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.3.c.patch 17 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.6.patch 18 | 19 | RUN touch -c cp/parse.y cp/parse.h cp/parse.c 20 | 21 | RUN ./configure \ 22 | --target=mips-linux-gnu \ 23 | --prefix=/opt/cross \ 24 | --with-endian-little \ 25 | --with-gnu-as \ 26 | --host=i386-pc-linux \ 27 | --build=i386-pc-linux 28 | 29 | 30 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static -Dbsd4_4 -Dmips -DHAVE_STRERROR" 31 | 32 | COPY tests /work/tests 33 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 34 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 35 | 36 | RUN mv xgcc gcc 37 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ || true 38 | 39 | FROM scratch AS export 40 | COPY --from=build /build/* . 41 | -------------------------------------------------------------------------------- /gcc-2.7.0.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://ftp.fibranet.cat/Linux/historic/slackware-3.0/source/d/gcc/gcc-2.7.0.tar.gz 8 | RUN tar xzf gcc-2.7.0.tar.gz 9 | 10 | WORKDIR /work/gcc-2.7.0 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 configure -i ../patches/configure.patch 16 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 17 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 18 | 19 | RUN ./configure \ 20 | --target=mips-linux-gnu \ 21 | --prefix=/opt/cross \ 22 | --with-endian-little \ 23 | --with-gnu-as \ 24 | --disable-gprof \ 25 | --disable-gdb \ 26 | --disable-werror \ 27 | --host=i386-pc-linux \ 28 | --build=i386-pc-linux 29 | 30 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 31 | 32 | COPY tests /work/tests 33 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 34 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 35 | 36 | RUN mv xgcc gcc 37 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 38 | 39 | FROM scratch AS export 40 | COPY --from=build /build/* . 41 | -------------------------------------------------------------------------------- /gcc-2.7.1.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | WORKDIR /work 7 | RUN wget http://ftp.sunet.se/mirror/archive/ftp.sunet.se/pub/vendor/sun/freeware/SOURCES/gcc-2.7.1.tar.gz 8 | RUN tar xzf gcc-2.7.1.tar.gz 9 | 10 | WORKDIR /work/gcc-2.7.1 11 | COPY patches /work/patches 12 | RUN sed -i -- 's/include /include /g' *.c 13 | 14 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 15 | RUN patch -u -p1 configure -i ../patches/configure.patch 16 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 17 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 18 | 19 | RUN ./configure \ 20 | --target=mips-linux-gnu \ 21 | --prefix=/opt/cross \ 22 | --with-endian-little \ 23 | --with-gnu-as \ 24 | --disable-gprof \ 25 | --disable-gdb \ 26 | --disable-werror \ 27 | --host=i386-pc-linux \ 28 | --build=i386-pc-linux 29 | 30 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 31 | 32 | COPY tests /work/tests 33 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 34 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 35 | 36 | RUN mv xgcc gcc 37 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 38 | 39 | FROM scratch AS export 40 | COPY --from=build /build/* . 41 | -------------------------------------------------------------------------------- /gcc-2.7.2-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.7.2 7 | ENV GNUPATH=old-gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | 15 | COPY patches /work/patches 16 | RUN sed -i -- 's/include /include /g' *.c 17 | 18 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 19 | RUN patch -u -p1 configure -i ../patches/configure.patch 20 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 21 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 22 | RUN patch -su -p1 < ../patches/psx-2.5.7.patch 23 | 24 | RUN ./configure \ 25 | --target=mips-sony-psx \ 26 | --prefix=/opt/cross \ 27 | --with-endian-little \ 28 | --with-gnu-as \ 29 | --disable-gprof \ 30 | --disable-gdb \ 31 | --disable-werror \ 32 | --host=i386-pc-linux \ 33 | --build=i386-pc-linux 34 | 35 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 36 | 37 | COPY tests /work/tests 38 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 39 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 40 | RUN ./cc1 -quiet -help &1 | grep -- -msoft-float 41 | 42 | RUN mv xgcc gcc 43 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 44 | 45 | FROM scratch AS export 46 | COPY --from=build /build/* . 47 | -------------------------------------------------------------------------------- /gcc-2.7.2.1.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.7.2.1 7 | ENV GNUPATH=old-gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | 28 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 29 | RUN patch -u -p1 configure -i ../patches/configure.patch 30 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 31 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 38 | 39 | RUN mv xgcc gcc 40 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 41 | 42 | FROM scratch AS export 43 | COPY --from=build /build/* . 44 | -------------------------------------------------------------------------------- /gcc-2.7.2.2.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.7.2.2 7 | ENV GNUPATH=old-gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | 28 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 29 | RUN patch -u -p1 configure -i ../patches/configure.patch 30 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 31 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 38 | 39 | RUN mv xgcc gcc 40 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 41 | 42 | FROM scratch AS export 43 | COPY --from=build /build/* . 44 | -------------------------------------------------------------------------------- /gcc-2.7.2.3.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.7.2.3 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | 28 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 29 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 30 | 31 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 32 | 33 | COPY tests /work/tests 34 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 35 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 36 | 37 | RUN mv xgcc gcc 38 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 39 | 40 | FROM scratch AS export 41 | COPY --from=build /build/* . 42 | -------------------------------------------------------------------------------- /gcc-2.7.2.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.7.2 7 | ENV GNUPATH=old-gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | 28 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch 29 | RUN patch -u -p1 configure -i ../patches/configure.patch 30 | RUN patch -u -p1 config.sub -i ../patches/config.sub.patch 31 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 38 | 39 | RUN mv xgcc gcc 40 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 41 | 42 | FROM scratch AS export 43 | COPY --from=build /build/* . 44 | -------------------------------------------------------------------------------- /gcc-2.8.0-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.8.0 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | 15 | COPY patches /work/patches 16 | RUN sed -i -- 's/include /include /g' *.c 17 | 18 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.8.0.h.patch 19 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mips.patch 20 | RUN patch -su -p1 < ../patches/psx.patch 21 | 22 | RUN ./configure \ 23 | --target=mips-sony-psx \ 24 | --prefix=/opt/cross \ 25 | --with-endian-little \ 26 | --with-gnu-as \ 27 | --disable-gprof \ 28 | --disable-gdb \ 29 | --disable-werror \ 30 | --host=i386-pc-linux \ 31 | --build=i386-pc-linux 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 38 | RUN ./cc1 -version &1 | grep -- -msoft-float 39 | RUN ./cc1 -version &1 | grep -- -msplit-addresses 40 | RUN ./cc1 -version &1 | grep -- -mgpopt 41 | 42 | RUN mv xgcc gcc 43 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 44 | 45 | FROM scratch AS export 46 | COPY --from=build /build/* . 47 | -------------------------------------------------------------------------------- /gcc-2.8.0.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.8.0 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.8.0.h.patch 28 | 29 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.8.patch 30 | 31 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 32 | 33 | COPY tests /work/tests 34 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 35 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 36 | 37 | RUN mv xgcc gcc 38 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 39 | 40 | FROM scratch AS export 41 | COPY --from=build /build/* . 42 | -------------------------------------------------------------------------------- /gcc-2.8.1-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.8.1 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | 15 | COPY patches /work/patches 16 | RUN sed -i -- 's/include /include /g' *.c 17 | 18 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.8.1.h.patch 19 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mips.patch 20 | RUN patch -su -p1 < ../patches/psx.patch 21 | 22 | RUN ./configure \ 23 | --target=mips-sony-psx \ 24 | --prefix=/opt/cross \ 25 | --with-endian-little \ 26 | --with-gnu-as \ 27 | --disable-gprof \ 28 | --disable-gdb \ 29 | --disable-werror \ 30 | --host=i386-pc-linux \ 31 | --build=i386-pc-linux 32 | 33 | RUN touch insn-config.h 34 | 35 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 36 | 37 | COPY tests /work/tests 38 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 39 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 40 | RUN ./cc1 -version &1 | grep -- -msoft-float 41 | RUN ./cc1 -version &1 | grep -- -msplit-addresses 42 | RUN ./cc1 -version &1 | grep -- -mgpopt 43 | 44 | RUN mv xgcc gcc 45 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 46 | 47 | FROM scratch AS export 48 | COPY --from=build /build/* . 49 | -------------------------------------------------------------------------------- /gcc-2.8.1.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.8.1 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION} 14 | RUN ./configure \ 15 | --target=mips-linux-gnu \ 16 | --prefix=/opt/cross \ 17 | --with-endian-little \ 18 | --with-gnu-as \ 19 | --disable-gprof \ 20 | --disable-gdb \ 21 | --disable-werror \ 22 | --host=i386-pc-linux \ 23 | --build=i386-pc-linux 24 | 25 | COPY patches /work/patches 26 | RUN sed -i -- 's/include /include /g' *.c 27 | RUN patch -u -p1 obstack.h -i ../patches/obstack-2.8.1.h.patch 28 | 29 | RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.8.patch 30 | 31 | RUN touch insn-config.h 32 | 33 | RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 34 | 35 | COPY tests /work/tests 36 | RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 37 | RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c 38 | 39 | RUN mv xgcc gcc 40 | RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ 41 | 42 | FROM scratch AS export 43 | COPY --from=build /build/* . 44 | -------------------------------------------------------------------------------- /gcc-2.91.66-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.91.66 7 | 8 | WORKDIR /work 9 | RUN wget https://gcc.gnu.org/pub/gcc/old-releases/egcs/egcs-1.1.2.tar.bz2 10 | RUN mkdir -p /work/gcc-${VERSION}/ 11 | RUN tar xjf egcs-1.1.2.tar.bz2 --strip-components=1 -C gcc-${VERSION} 12 | 13 | WORKDIR /work/gcc-${VERSION}/ 14 | 15 | COPY patches /work/patches 16 | 17 | RUN sed -i -- 's/include /include /g' **/*.c 18 | RUN patch -u -p1 gcc/obstack.h -i ../patches/obstack-${VERSION}.h.patch 19 | RUN patch -u -p1 gcc/config/mips/mips.h -i ../patches/mips.patch 20 | RUN patch -su -p1 < ../patches/psx-2.91.patch 21 | 22 | RUN for dir in libiberty gcc; do \ 23 | cd /work/gcc-${VERSION}/${dir}; \ 24 | ./configure \ 25 | --target=mips-sony-psx \ 26 | --prefix=/opt/cross \ 27 | --with-endian-little \ 28 | --with-gnu-as \ 29 | --disable-gprof \ 30 | --disable-gdb \ 31 | --disable-werror \ 32 | --host=i386-pc-linux \ 33 | --build=i386-pc-linux; \ 34 | done 35 | 36 | RUN make -C libiberty/ CFLAGS="-std=gnu89 -m32 -static" 37 | RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 38 | 39 | COPY tests /work/tests 40 | RUN ./gcc/cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 41 | RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c 42 | RUN ./gcc/cc1 -version &1 | grep -- -msoft-float 43 | RUN ./gcc/cc1 -version &1 | grep -- -msplit-addresses 44 | RUN ./gcc/cc1 -version &1 | grep -- -mgpopt 45 | 46 | RUN mv ./gcc/xgcc ./gcc/gcc 47 | RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/ 48 | 49 | FROM scratch AS export 50 | COPY --from=build /build/* . 51 | -------------------------------------------------------------------------------- /gcc-2.91.66.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ARG VERSION=2.91.66 7 | ENV VERSION=${VERSION} 8 | 9 | WORKDIR /work 10 | RUN wget https://gcc.gnu.org/pub/gcc/old-releases/egcs/egcs-1.1.2.tar.bz2 11 | RUN mkdir -p /work/gcc-${VERSION}/ 12 | RUN tar xjf egcs-1.1.2.tar.bz2 --strip-components=1 -C gcc-${VERSION} 13 | 14 | WORKDIR /work/gcc-${VERSION}/ 15 | RUN for dir in libiberty gcc; do \ 16 | cd /work/gcc-${VERSION}/${dir}; \ 17 | ./configure \ 18 | --target=mips-linux-gnu \ 19 | --prefix=/opt/cross \ 20 | --with-endian-little \ 21 | --with-gnu-as \ 22 | --disable-gprof \ 23 | --disable-gdb \ 24 | --disable-werror \ 25 | --host=i386-pc-linux \ 26 | --build=i386-pc-linux; \ 27 | done 28 | 29 | COPY patches /work/patches 30 | 31 | RUN sed -i -- 's/include /include /g' **/*.c 32 | RUN patch -u -p1 gcc/obstack.h -i ../patches/obstack-${VERSION}.h.patch 33 | RUN patch -u -p1 gcc/config/mips/mips.h -i ../patches/mipsel-2.8.patch 34 | 35 | RUN make -C libiberty/ CFLAGS="-std=gnu89 -m32 -static" 36 | RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 37 | 38 | COPY tests /work/tests 39 | RUN ./gcc/cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 40 | RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c 41 | 42 | RUN mv ./gcc/xgcc ./gcc/gcc 43 | RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/ 44 | 45 | FROM scratch AS export 46 | COPY --from=build /build/* . 47 | -------------------------------------------------------------------------------- /gcc-2.95.2-psx.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ENV VERSION=2.95.2 7 | ENV GNUPATH=gnu 8 | 9 | WORKDIR /work 10 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 11 | RUN tar xzf gcc-${VERSION}.tar.gz 12 | 13 | WORKDIR /work/gcc-${VERSION}/ 14 | 15 | COPY patches /work/patches 16 | 17 | RUN sed -i -- 's/include /include /g' **/*.c 18 | RUN patch -u -p1 include/obstack.h -i ../patches/obstack-${VERSION}.h.patch 19 | RUN patch -u -p1 gcc/config/mips/mips.h -i ../patches/mips.patch 20 | RUN patch -su -p1 < ../patches/psx-2.91.patch 21 | 22 | 23 | RUN for dir in libiberty gcc; do \ 24 | cd /work/gcc-${VERSION}/${dir}; \ 25 | ./configure \ 26 | --target=mips-sony-psx \ 27 | --prefix=/opt/cross \ 28 | --with-endian-little \ 29 | --with-gnu-as \ 30 | --disable-gprof \ 31 | --disable-gdb \ 32 | --disable-werror \ 33 | --host=i386-pc-linux \ 34 | --build=i386-pc-linux; \ 35 | done 36 | 37 | RUN make -C libiberty/ CFLAGS="-std=gnu89 -m32 -static" 38 | RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 39 | 40 | COPY tests /work/tests 41 | RUN ./gcc/cc1 -mel -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 42 | RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c 43 | RUN ./gcc/cc1 -version &1 | grep -- -msoft-float 44 | RUN ./gcc/cc1 -version &1 | grep -- -msplit-addresses 45 | RUN ./gcc/cc1 -version &1 | grep -- -mgpopt 46 | 47 | RUN mv ./gcc/xgcc ./gcc/gcc 48 | RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/ 49 | 50 | FROM scratch AS export 51 | COPY --from=build /build/* . 52 | -------------------------------------------------------------------------------- /gcc-2.95.2.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal as build 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | RUN apt-get update 4 | RUN apt-get install -y build-essential gcc gcc-multilib wget 5 | 6 | ARG VERSION=2.95.2 7 | ENV VERSION=${VERSION} 8 | ENV GNUPATH=gnu 9 | 10 | WORKDIR /work 11 | RUN wget https://ftp.gnu.org/${GNUPATH}/gcc/gcc-${VERSION}.tar.gz 12 | RUN tar xzf gcc-${VERSION}.tar.gz 13 | 14 | WORKDIR /work/gcc-${VERSION}/ 15 | RUN for dir in libiberty gcc; do \ 16 | cd /work/gcc-${VERSION}/${dir}; \ 17 | ./configure \ 18 | --target=mips-linux-gnu \ 19 | --prefix=/opt/cross \ 20 | --with-endian-little \ 21 | --with-gnu-as \ 22 | --disable-gprof \ 23 | --disable-gdb \ 24 | --disable-werror \ 25 | --host=i386-pc-linux \ 26 | --build=i386-pc-linux; \ 27 | done 28 | 29 | COPY patches /work/patches 30 | 31 | RUN sed -i -- 's/include /include /g' **/*.c 32 | RUN patch -u -p1 include/obstack.h -i ../patches/obstack-${VERSION}.h.patch 33 | RUN patch -u -p1 gcc/config/mips/mips.h -i ../patches/mipsel-2.8.patch 34 | 35 | RUN make -C libiberty/ CFLAGS="-std=gnu89 -m32 -static" 36 | RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -static" 37 | 38 | COPY tests /work/tests 39 | RUN ./gcc/cc1 -mel -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s 40 | RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c 41 | 42 | RUN mv ./gcc/xgcc ./gcc/gcc 43 | RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/ 44 | 45 | FROM scratch AS export 46 | COPY --from=build /build/* . 47 | -------------------------------------------------------------------------------- /patches/cccp-2.5.7.c.patch: -------------------------------------------------------------------------------- 1 | diff --git "a/cccp.c" "b/cccp.c" 2 | index 77ecb76..6cca1cb 100644 3 | --- "a/cccp.c" 4 | +++ "b/cccp.c" 5 | @@ -186,12 +186,20 @@ extern char *getenv (); 6 | extern FILE *fdopen (); 7 | extern char *version_string; 8 | extern struct tm *localtime (); 9 | +#ifndef VMS 10 | +#ifndef HAVE_STRERROR 11 | extern int sys_nerr; 12 | #if defined(bsd4_4) 13 | extern const char *const sys_errlist[]; 14 | #else 15 | extern char *sys_errlist[]; 16 | #endif 17 | +#else /* HAVE_STERRROR */ 18 | +char *strerror (); 19 | +#endif 20 | +#else /* VMS */ 21 | +char *strerror (int,...); 22 | +#endif 23 | extern int parse_escape (); 24 | 25 | #ifndef errno 26 | @@ -8014,6 +8022,39 @@ change_newlines (start, length) 27 | 28 | return obp - start; 29 | } 30 | + 31 | +/* 32 | + * my_strerror - return the descriptive text associated with an `errno' code. 33 | + */ 34 | + 35 | +char * 36 | +my_strerror (errnum) 37 | + int errnum; 38 | +{ 39 | + char *result; 40 | + 41 | +#ifndef VMS 42 | +#ifndef HAVE_STRERROR 43 | + result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0); 44 | +#else 45 | + result = strerror (errnum); 46 | +#endif 47 | +#else /* VMS */ 48 | + /* VAXCRTL's strerror() takes an optional second argument, which only 49 | + matters when the first argument is EVMSERR. However, it's simplest 50 | + just to pass it unconditionally. `vaxc$errno' is declared in 51 | + , and maintained by the library in parallel with `errno'. 52 | + We assume that caller's `errnum' either matches the last setting of 53 | + `errno' by the library or else does not have the value `EVMSERR'. */ 54 | + 55 | + result = strerror (errnum, vaxc$errno); 56 | +#endif 57 | + 58 | + if (!result) 59 | + result = "undocumented I/O error"; 60 | + 61 | + return result; 62 | +} 63 | 64 | /* 65 | * error - print error message and increment count of errors. 66 | @@ -8062,10 +8103,7 @@ error_from_errno (name) 67 | if (ip != NULL) 68 | fprintf (stderr, "%s:%d: ", ip->nominal_fname, ip->lineno); 69 | 70 | - if (errno < sys_nerr) 71 | - fprintf (stderr, "%s: %s\n", name, sys_errlist[errno]); 72 | - else 73 | - fprintf (stderr, "%s: undocumented I/O error\n", name); 74 | + fprintf (stderr, "%s: %s\n", name, my_strerror (errno)); 75 | 76 | errors++; 77 | } 78 | @@ -9018,10 +9056,7 @@ perror_with_name (name) 79 | char *name; 80 | { 81 | fprintf (stderr, "%s: ", progname); 82 | - if (errno < sys_nerr) 83 | - fprintf (stderr, "%s: %s\n", name, sys_errlist[errno]); 84 | - else 85 | - fprintf (stderr, "%s: undocumented I/O error\n", name); 86 | + fprintf (stderr, "%s: %s\n", name, my_strerror (errno)); 87 | errors++; 88 | } 89 | 90 | -------------------------------------------------------------------------------- /patches/cccp-2.6.0.c.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.6.0/cccp.c 1994-07-11 20:07:09.000000000 +0100 2 | +++ gcc-2.6.0/cccp_patched.c 2023-09-19 16:53:35.176357949 +0100 3 | @@ -186,12 +186,20 @@ 4 | extern FILE *fdopen (); 5 | extern char *version_string; 6 | extern struct tm *localtime (); 7 | +#ifndef VMS 8 | +#ifndef HAVE_STRERROR 9 | extern int sys_nerr; 10 | #if defined(bsd4_4) || defined(__NetBSD__) 11 | extern const char *const sys_errlist[]; 12 | #else 13 | extern char *sys_errlist[]; 14 | #endif 15 | +#else /* HAVE_STERRROR */ 16 | +char *strerror (); 17 | +#endif 18 | +#else /* VMS */ 19 | +char *strerror (int,...); 20 | +#endif 21 | extern int parse_escape (); 22 | 23 | #ifndef errno 24 | @@ -8382,6 +8390,39 @@ 25 | 26 | return obp - start; 27 | } 28 | + 29 | +/* 30 | + * my_strerror - return the descriptive text associated with an `errno' code. 31 | + */ 32 | + 33 | +char * 34 | +my_strerror (errnum) 35 | + int errnum; 36 | +{ 37 | + char *result; 38 | + 39 | +#ifndef VMS 40 | +#ifndef HAVE_STRERROR 41 | + result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0); 42 | +#else 43 | + result = strerror (errnum); 44 | +#endif 45 | +#else /* VMS */ 46 | + /* VAXCRTL's strerror() takes an optional second argument, which only 47 | + matters when the first argument is EVMSERR. However, it's simplest 48 | + just to pass it unconditionally. `vaxc$errno' is declared in 49 | + , and maintained by the library in parallel with `errno'. 50 | + We assume that caller's `errnum' either matches the last setting of 51 | + `errno' by the library or else does not have the value `EVMSERR'. */ 52 | + 53 | + result = strerror (errnum, vaxc$errno); 54 | +#endif 55 | + 56 | + if (!result) 57 | + result = "undocumented I/O error"; 58 | + 59 | + return result; 60 | +} 61 | 62 | /* 63 | * error - print error message and increment count of errors. 64 | @@ -8430,10 +8471,7 @@ 65 | if (ip != NULL) 66 | fprintf (stderr, "%s:%d: ", ip->nominal_fname, ip->lineno); 67 | 68 | - if (errno < sys_nerr) 69 | - fprintf (stderr, "%s: %s\n", name, sys_errlist[errno]); 70 | - else 71 | - fprintf (stderr, "%s: undocumented I/O error\n", name); 72 | + fprintf (stderr, "%s: %s\n", name, my_strerror (errno)); 73 | 74 | errors++; 75 | } 76 | @@ -9392,10 +9430,7 @@ 77 | char *name; 78 | { 79 | fprintf (stderr, "%s: ", progname); 80 | - if (errno < sys_nerr) 81 | - fprintf (stderr, "%s: %s\n", name, sys_errlist[errno]); 82 | - else 83 | - fprintf (stderr, "%s: undocumented I/O error\n", name); 84 | + fprintf (stderr, "%s: %s\n", name, my_strerror (errno)); 85 | errors++; 86 | } 87 | 88 | -------------------------------------------------------------------------------- /patches/collect2-2.6.0.c.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.6.0/collect2.c 1994-07-11 19:08:16.000000000 +0000 2 | +++ gcc-2.6.0/collect2_patched.c 2023-09-19 17:04:06.184446915 +0000 3 | @@ -292,6 +292,11 @@ 4 | my_strerror (e) 5 | int e; 6 | { 7 | + 8 | +#ifdef HAVE_STRERROR 9 | + return strerror (e); 10 | + 11 | +#else 12 | static char buffer[30]; 13 | 14 | if (!e) 15 | @@ -302,8 +307,9 @@ 16 | 17 | sprintf (buffer, "Unknown error %d", e); 18 | return buffer; 19 | +#endif 20 | } 21 | - 22 | + 23 | /* Delete tempfiles and exit function. */ 24 | 25 | static void 26 | -------------------------------------------------------------------------------- /patches/config.sub.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.7.2.2/config.sub 1995-06-15 22:01:49.000000000 +0100 2 | +++ gcc-2.7.2.3/config.sub 1997-06-24 19:42:50.000000000 +0100 3 | @@ -62,11 +62,21 @@ 4 | ;; 5 | esac 6 | 7 | -# Separate what the user gave into CPU-COMPANY and OS (if any). 8 | -basic_machine=`echo $1 | sed 's/-[^-]*$//'` 9 | -if [ $basic_machine != $1 ] 10 | -then os=`echo $1 | sed 's/.*-/-/'` 11 | -else os=; fi 12 | +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). 13 | +# Here we must recognize all the valid KERNEL-OS combinations. 14 | +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` 15 | +case $maybe_os in 16 | + linux-gnu*) 17 | + os=-$maybe_os 18 | + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` 19 | + ;; 20 | + *) 21 | + basic_machine=`echo $1 | sed 's/-[^-]*$//'` 22 | + if [ $basic_machine != $1 ] 23 | + then os=`echo $1 | sed 's/.*-/-/'` 24 | + else os=; fi 25 | + ;; 26 | +esac 27 | -------------------------------------------------------------------------------- /patches/configure.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.7.2.2/configure 1997-01-30 22:20:15.000000000 +0000 2 | +++ gcc-2.7.2.3/configure 1997-08-13 18:23:24.000000000 +0100 3 | @@ -2389,2 +2401,4 @@ 4 | case $machine in 5 | + *-*-linux-gnu*) 6 | + ;; # Existing Linux/GNU systems do not use the GNU setup. 7 | *-*-gnu*) 8 | -------------------------------------------------------------------------------- /patches/g++-2.5.7.c.patch: -------------------------------------------------------------------------------- 1 | diff --git "a/g++.c" "b/g++.c" 2 | index 1ae3157..d4b94ee 100644 3 | --- "a/g++.c" 4 | +++ "b/g++.c" 5 | @@ -36,6 +36,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 6 | #include 7 | #include 8 | #include /* May get R_OK, etc. on some systems. */ 9 | +#include 10 | 11 | /* Defined to the name of the compiler; if using a cross compiler, the 12 | Makefile should compile this file with the proper name 13 | @@ -62,12 +63,24 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 14 | #endif 15 | #endif 16 | 17 | -extern int errno, sys_nerr; 18 | -#if defined(bsd4_4) 19 | +#ifndef errno 20 | +extern int errno; 21 | +#endif 22 | + 23 | +#ifndef VMS 24 | +#ifndef HAVE_STRERROR 25 | +extern int sys_nerr; 26 | +#if defined(bsd4_4) || defined(__NetBSD__) 27 | extern const char *const sys_errlist[]; 28 | #else 29 | extern char *sys_errlist[]; 30 | #endif 31 | +#else /* HAVE_STERRROR */ 32 | +char *strerror (); 33 | +#endif 34 | +#else /* VMS */ 35 | +char *strerror (int,...); 36 | +#endif 37 | 38 | /* Name with which this program was invoked. */ 39 | static char *programname; 40 | @@ -178,10 +191,14 @@ pfatal_with_name (name) 41 | { 42 | char *s; 43 | 44 | +#ifndef HAVE_STRERROR 45 | if (errno < sys_nerr) 46 | s = concat ("%s: ", sys_errlist[errno], ""); 47 | else 48 | s = "cannot open %s"; 49 | +#else 50 | + s = strerror (errno); 51 | +#endif 52 | fatal (s, name); 53 | } 54 | 55 | @@ -249,12 +266,15 @@ perror_exec (name) 56 | char *name; 57 | { 58 | char *s; 59 | - 60 | + 61 | +#ifndef HAVE_STRERROR 62 | if (errno < sys_nerr) 63 | - s = concat ("installation problem, cannot exec %s: ", 64 | - sys_errlist[errno], ""); 65 | + s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno], ""); 66 | else 67 | s = "installation problem, cannot exec %s"; 68 | +#else 69 | + s = strerror (errno); 70 | +#endif 71 | error (s, name); 72 | } 73 | 74 | -------------------------------------------------------------------------------- /patches/g++-2.6.0.c.patch: -------------------------------------------------------------------------------- 1 | --- cp/g++.c 1994-07-11 22:24:32.000000000 +0000 2 | +++ cp/g++_patched.c 2023-09-19 17:35:06.256145393 +0000 3 | @@ -40,6 +40,7 @@ 4 | #include 5 | #include 6 | #include /* May get R_OK, etc. on some systems. */ 7 | +#include 8 | 9 | /* Defined to the name of the compiler; if using a cross compiler, the 10 | Makefile should compile this file with the proper name 11 | @@ -78,12 +79,24 @@ 12 | #endif 13 | #endif 14 | 15 | -extern int errno, sys_nerr; 16 | +#ifndef errno 17 | +extern int errno; 18 | +#endif 19 | + 20 | +#ifndef VMS 21 | +#ifndef HAVE_STRERROR 22 | +extern int sys_nerr; 23 | #if defined(bsd4_4) || defined(__NetBSD__) 24 | extern const char *const sys_errlist[]; 25 | #else 26 | extern char *sys_errlist[]; 27 | #endif 28 | +#else /* HAVE_STERRROR */ 29 | +char *strerror (); 30 | +#endif 31 | +#else /* VMS */ 32 | +char *strerror (int,...); 33 | +#endif 34 | 35 | /* Name with which this program was invoked. */ 36 | static char *programname; 37 | @@ -204,10 +217,14 @@ 38 | { 39 | char *s; 40 | 41 | +#ifndef HAVE_STRERROR 42 | if (errno < sys_nerr) 43 | s = concat ("%s: ", sys_errlist[errno], ""); 44 | else 45 | s = "cannot open %s"; 46 | +#else 47 | + s = strerror (errno); 48 | +#endif 49 | fatal (s, name); 50 | } 51 | 52 | @@ -276,11 +293,14 @@ 53 | { 54 | char *s; 55 | 56 | +#ifndef HAVE_STRERROR 57 | if (errno < sys_nerr) 58 | - s = concat ("installation problem, cannot exec %s: ", 59 | - sys_errlist[errno], ""); 60 | + s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno], ""); 61 | else 62 | s = "installation problem, cannot exec %s"; 63 | +#else 64 | + s = strerror (errno); 65 | +#endif 66 | error (s, name); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /patches/g++-2.6.3.c.patch: -------------------------------------------------------------------------------- 1 | --- cp/g++.c 1994-10-29 11:17:44.000000000 +0000 2 | +++ cp/g++-patched.c 2023-10-08 08:48:51.000932344 +0000 3 | @@ -83,12 +83,16 @@ 4 | extern int errno; 5 | #endif 6 | 7 | +#ifndef HAVE_STRERROR 8 | extern int sys_nerr; 9 | #if defined(bsd4_4) || defined(__NetBSD__) 10 | extern const char *const sys_errlist[]; 11 | #else 12 | extern char *sys_errlist[]; 13 | #endif 14 | +#else /* HAVE_STERRROR */ 15 | +char *strerror (); 16 | +#endif 17 | 18 | /* Name with which this program was invoked. */ 19 | static char *programname; 20 | @@ -209,10 +213,14 @@ 21 | { 22 | char *s; 23 | 24 | +#ifndef HAVE_STRERROR 25 | if (errno < sys_nerr) 26 | s = concat ("%s: ", sys_errlist[errno], ""); 27 | else 28 | s = "cannot open %s"; 29 | +#else 30 | + s = strerror (errno); 31 | +#endif 32 | fatal (s, name); 33 | } 34 | 35 | @@ -281,11 +289,14 @@ 36 | { 37 | char *s; 38 | 39 | +#ifndef HAVE_STRERROR 40 | if (errno < sys_nerr) 41 | - s = concat ("installation problem, cannot exec %s: ", 42 | - sys_errlist[errno], ""); 43 | + s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno], ""); 44 | else 45 | s = "installation problem, cannot exec %s"; 46 | +#else 47 | + s = strerror (errno); 48 | +#endif 49 | error (s, name); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /patches/gcc-2.5.7.c.patch: -------------------------------------------------------------------------------- 1 | diff --git "a/gcc.c" "b/gcc.c" 2 | index 5b17123..ffddca4 100644 3 | --- "a/gcc.c" 4 | +++ "b/gcc.c" 5 | @@ -35,6 +35,7 @@ compilation is specified by a string called a "spec". */ 6 | #include 7 | #include 8 | #include /* May get R_OK, etc. on some systems. */ 9 | +#include 10 | 11 | #include "config.h" 12 | #include "obstack.h" 13 | @@ -103,12 +104,24 @@ compilation is specified by a string called a "spec". */ 14 | extern void free (); 15 | extern char *getenv (); 16 | 17 | -extern int errno, sys_nerr; 18 | +#ifndef errno 19 | +extern int errno; 20 | +#endif 21 | + 22 | +#ifndef VMS 23 | +#ifndef HAVE_STRERROR 24 | +extern int sys_nerr; 25 | #if defined(bsd4_4) 26 | extern const char *const sys_errlist[]; 27 | #else 28 | extern char *sys_errlist[]; 29 | #endif 30 | +#else /* HAVE_STERRROR */ 31 | +char *strerror (); 32 | +#endif 33 | +#else /* VMS */ 34 | +char *strerror (int,...); 35 | +#endif 36 | 37 | extern int execv (), execvp (); 38 | 39 | @@ -4104,10 +4117,14 @@ pfatal_with_name (name) 40 | { 41 | char *s; 42 | 43 | +#ifndef HAVE_STRERROR 44 | if (errno < sys_nerr) 45 | s = concat ("%s: ", sys_errlist[errno], ""); 46 | else 47 | s = "cannot open %s"; 48 | +#else 49 | + s = strerror (errno); 50 | +#endif 51 | fatal (s, name); 52 | } 53 | 54 | @@ -4116,11 +4133,15 @@ perror_with_name (name) 55 | char *name; 56 | { 57 | char *s; 58 | - 59 | + 60 | +#ifndef HAVE_STRERROR 61 | if (errno < sys_nerr) 62 | s = concat ("%s: ", sys_errlist[errno], ""); 63 | else 64 | s = "cannot open %s"; 65 | +#else 66 | + s = strerror (errno); 67 | +#endif 68 | error (s, name); 69 | } 70 | 71 | @@ -4130,11 +4151,16 @@ perror_exec (name) 72 | { 73 | char *s; 74 | 75 | +#ifndef HAVE_STRERROR 76 | if (errno < sys_nerr) 77 | s = concat ("installation problem, cannot exec %s: ", 78 | sys_errlist[errno], ""); 79 | + s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno], ""); 80 | else 81 | s = "installation problem, cannot exec %s"; 82 | +#else 83 | + s = strerror (errno); 84 | +#endif 85 | error (s, name); 86 | } 87 | 88 | -------------------------------------------------------------------------------- /patches/gcc-2.6.0.c.patch: -------------------------------------------------------------------------------- 1 | --- gcc.c 1994-07-11 19:08:58.000000000 +0000 2 | +++ gcc_patched.c 2023-09-19 17:38:56.429907831 +0000 3 | @@ -35,6 +35,7 @@ 4 | #include 5 | #include 6 | #include /* May get R_OK, etc. on some systems. */ 7 | +#include 8 | 9 | #include "config.h" 10 | #include "obstack.h" 11 | @@ -131,12 +132,24 @@ 12 | extern void free (); 13 | extern char *getenv (); 14 | 15 | -extern int errno, sys_nerr; 16 | +#ifndef errno 17 | +extern int errno; 18 | +#endif 19 | + 20 | +#ifndef VMS 21 | +#ifndef HAVE_STRERROR 22 | +extern int sys_nerr; 23 | #if defined(bsd4_4) || defined(__NetBSD__) 24 | extern const char *const sys_errlist[]; 25 | #else 26 | extern char *sys_errlist[]; 27 | #endif 28 | +#else /* HAVE_STERRROR */ 29 | +char *strerror (); 30 | +#endif 31 | +#else /* VMS */ 32 | +char *strerror (int,...); 33 | +#endif 34 | 35 | extern int execv (), execvp (); 36 | 37 | @@ -4455,10 +4468,14 @@ 38 | { 39 | char *s; 40 | 41 | +#ifndef HAVE_STRERROR 42 | if (errno < sys_nerr) 43 | s = concat ("%s: ", sys_errlist[errno], ""); 44 | else 45 | s = "cannot open %s"; 46 | +#else 47 | + s = strerror (errno); 48 | +#endif 49 | fatal (s, name); 50 | } 51 | 52 | @@ -4468,10 +4485,14 @@ 53 | { 54 | char *s; 55 | 56 | +#ifndef HAVE_STRERROR 57 | if (errno < sys_nerr) 58 | s = concat ("%s: ", sys_errlist[errno], ""); 59 | else 60 | s = "cannot open %s"; 61 | +#else 62 | + s = strerror (errno); 63 | +#endif 64 | error (s, name); 65 | } 66 | 67 | @@ -4481,11 +4502,14 @@ 68 | { 69 | char *s; 70 | 71 | +#ifndef HAVE_STRERROR 72 | if (errno < sys_nerr) 73 | - s = concat ("installation problem, cannot exec %s: ", 74 | - sys_errlist[errno], ""); 75 | + s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno], ""); 76 | else 77 | s = "installation problem, cannot exec %s"; 78 | +#else 79 | + s = strerror (errno); 80 | +#endif 81 | error (s, name); 82 | } 83 | 84 | -------------------------------------------------------------------------------- /patches/gvarargs-2.5.7.h.patch: -------------------------------------------------------------------------------- 1 | diff --git "a/gvarargs.h" "b/gvarargs.h" 2 | index ba3b4e2..41d509c 100644 3 | --- "a/gvarargs.h" 4 | +++ "b/gvarargs.h" 5 | @@ -62,11 +62,7 @@ 6 | /* In GCC version 2, we want an ellipsis at the end of the declaration 7 | of the argument list. GCC version 1 can't parse it. */ 8 | 9 | -#if __GNUC__ > 1 10 | -#define __va_ellipsis ... 11 | -#else 12 | #define __va_ellipsis 13 | -#endif 14 | 15 | /* These macros implement traditional (non-ANSI) varargs 16 | for GNU C. */ 17 | -------------------------------------------------------------------------------- /patches/mips-2.5.7.h.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1993-11-15 06:54:12.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-22 09:50:03.011252767 +0000 3 | @@ -519,10 +519,6 @@ 4 | #error "Define CPP_SPEC in the appropriate tm.h file" 5 | #endif 6 | 7 | -#ifndef LINK_SPEC 8 | - #error "Define LINK_SPEC in the appropriate tm.h file" 9 | -#endif 10 | - 11 | #ifndef LIB_SPEC 12 | #error "Define LIB_SPEC in the appropriate tm.h file" 13 | #endif 14 | @@ -556,10 +552,7 @@ 15 | #define ASM_SPEC "\ 16 | %{!mgas: \ 17 | %{!mrnames: %{!.s:-nocpp} %{.s: %{cpp} %{nocpp}}} \ 18 | - %{pipe: %e-pipe is not supported.} \ 19 | - %{EB} %{!EB:-EB} \ 20 | - %{EL: %e-EL not supported} \ 21 | - %{mips1} %{mips2} %{mips3} \ 22 | + %{EB} %{EL} %{mips1} %{mips2} %{mips3} \ 23 | %{noasmopt:-O0} \ 24 | %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}} \ 25 | %{g} %{g0} %{g1} %{g2} %{g3} %{v} %{K} \ 26 | -------------------------------------------------------------------------------- /patches/mips.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1997-12-29 00:34:57.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-14 22:29:18.785172634 +0000 3 | @@ -1153,6 +1156,22 @@ 4 | #define ASM_OUTPUT_DESTRUCTOR(file, name) 5 | 6 | #endif /* 0 */ 7 | + 8 | +/* A C statement to output something to the assembler file to switch to section 9 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 10 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 11 | + define this macro in such cases. */ 12 | + 13 | +#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \ 14 | +do { \ 15 | + extern FILE *asm_out_text_file; \ 16 | + if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 17 | + fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ 18 | + else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ 19 | + fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \ 20 | + else \ 21 | + fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \ 22 | +} while (0) 23 | 24 | /* Target machine storage layout */ 25 | 26 | -------------------------------------------------------------------------------- /patches/mipsel-2.5.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1993-11-15 06:54:12.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-14 22:48:19.932635363 +0000 3 | @@ -545,8 +545,8 @@ 4 | /* Names to predefine in the preprocessor for this target machine. */ 5 | 6 | #ifndef CPP_PREDEFINES 7 | -#define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43 \ 8 | --D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_BSD43 \ 9 | +#define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEL -DR3000 -DSYSTYPE_BSD43 \ 10 | +-D_mips -D_unix -D_host_mips -D_MIPSEL -D_R3000 -D_SYSTYPE_BSD43 \ 11 | -Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)" 12 | #endif 13 | 14 | @@ -881,6 +881,11 @@ 15 | */ 16 | #define BITS_BIG_ENDIAN 0 17 | 18 | +/* Force little-endian */ 19 | +#define MIPSEL 20 | +#define BYTES_BIG_ENDIAN 0 21 | +#define WORDS_BIG_ENDIAN 0 22 | + 23 | /* Define this if most significant byte of a word is the lowest numbered. */ 24 | #ifndef BYTES_BIG_ENDIAN 25 | #ifndef DECSTATION 26 | -------------------------------------------------------------------------------- /patches/mipsel-2.6.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1994-07-11 18:22:16.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-14 20:32:41.282369333 +0000 3 | @@ -544,8 +544,8 @@ 4 | /* Names to predefine in the preprocessor for this target machine. */ 5 | 6 | #ifndef CPP_PREDEFINES 7 | -#define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEB -DR3000 -DSYSTYPE_BSD43 \ 8 | --D_mips -D_unix -D_host_mips -D_MIPSEB -D_R3000 -D_SYSTYPE_BSD43 \ 9 | +#define CPP_PREDEFINES "-Dmips -Dunix -Dhost_mips -DMIPSEL -DR3000 -DSYSTYPE_BSD43 \ 10 | +-D_mips -D_unix -D_host_mips -D_MIPSEL -D_R3000 -D_SYSTYPE_BSD43 \ 11 | -Asystem(unix) -Asystem(bsd) -Acpu(mips) -Amachine(mips)" 12 | #endif 13 | 14 | @@ -901,6 +901,11 @@ 15 | */ 16 | #define BITS_BIG_ENDIAN 0 17 | 18 | +/* Force little-endian */ 19 | +#define MIPSEL 20 | +#define BYTES_BIG_ENDIAN 0 21 | +#define WORDS_BIG_ENDIAN 0 22 | + 23 | /* Define this if most significant byte of a word is the lowest numbered. */ 24 | #ifndef BYTES_BIG_ENDIAN 25 | #ifndef DECSTATION 26 | @@ -3678,3 +3683,10 @@ 27 | #define NO_BUILTIN_PTRDIFF_TYPE 28 | #define PTRDIFF_TYPE (TARGET_LONG64 ? "long int" : "int") 29 | #endif 30 | + 31 | +/* Assemble generic sections. 32 | + This is currently only used to support section attributes. */ 33 | + 34 | +#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \ 35 | + do { fprintf (FILE, ".section\t\"%s\"\n", NAME); } while (0) 36 | + 37 | -------------------------------------------------------------------------------- /patches/mipsel-2.7.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1995-06-15 19:32:41.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-14 22:31:00.506591160 +0000 3 | @@ -406,6 +406,9 @@ 4 | | TARGET_ENDIAN_DEFAULT)} \ 5 | } 6 | 7 | +/* Default little-endian */ 8 | +#define TARGET_ENDIAN_DEFAULT 0 9 | + 10 | /* Default target_flags if no switches are specified */ 11 | 12 | #ifndef TARGET_DEFAULT 13 | @@ -954,6 +957,22 @@ 14 | #define ASM_OUTPUT_DESTRUCTOR(file, name) 15 | 16 | #endif /* 0 */ 17 | + 18 | +/* A C statement to output something to the assembler file to switch to section 19 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 20 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 21 | + define this macro in such cases. */ 22 | + 23 | +#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \ 24 | +do { \ 25 | + extern FILE *asm_out_text_file; \ 26 | + if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 27 | + fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ 28 | + else if ((DECL) && TREE_READONLY (DECL)) \ 29 | + fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \ 30 | + else \ 31 | + fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \ 32 | +} while (0) 33 | 34 | /* Target machine storage layout */ 35 | 36 | -------------------------------------------------------------------------------- /patches/mipsel-2.8.patch: -------------------------------------------------------------------------------- 1 | --- config/mips/mips.h 1997-12-29 00:34:57.000000000 +0000 2 | +++ config/mips/mips-patched.h 2023-11-14 22:29:18.785172634 +0000 3 | @@ -441,6 +441,9 @@ 4 | | TARGET_ENDIAN_DEFAULT)} \ 5 | } 6 | 7 | +/* Default little-endian */ 8 | +#define TARGET_ENDIAN_DEFAULT 0 9 | + 10 | /* Default target_flags if no switches are specified */ 11 | 12 | #ifndef TARGET_DEFAULT 13 | @@ -1153,6 +1156,22 @@ 14 | #define ASM_OUTPUT_DESTRUCTOR(file, name) 15 | 16 | #endif /* 0 */ 17 | + 18 | +/* A C statement to output something to the assembler file to switch to section 19 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 20 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 21 | + define this macro in such cases. */ 22 | + 23 | +#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \ 24 | +do { \ 25 | + extern FILE *asm_out_text_file; \ 26 | + if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ 27 | + fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ 28 | + else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ 29 | + fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \ 30 | + else \ 31 | + fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \ 32 | +} while (0) 33 | 34 | /* Target machine storage layout */ 35 | -------------------------------------------------------------------------------- /patches/obstack-2.5.7.h.patch: -------------------------------------------------------------------------------- 1 | diff --git "a/obstack.h" "b/obstack.h" 2 | index d4335cf..18448b8 100644 3 | --- "a/obstack.h" 4 | +++ "b/obstack.h" 5 | @@ -327,7 +327,7 @@ __extension__ \ 6 | ({ struct obstack *__o = (OBSTACK); \ 7 | ((__o->next_free + sizeof (void *) > __o->chunk_limit) \ 8 | ? (_obstack_newchunk (__o, sizeof (void *)), 0) : 0), \ 9 | - *((void **)__o->next_free)++ = ((void *)datum); \ 10 | + *((void **)__o->next_free) = ((void *)datum); __o->next_free += sizeof (void *); \ 11 | (void) 0; }) 12 | 13 | #define obstack_int_grow(OBSTACK,datum) \ 14 | -------------------------------------------------------------------------------- /patches/obstack-2.7.2.h.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.7.2.3/obstack.h 1995-11-26 19:57:13.000000000 +0000 2 | +++ gcc-2.7.2.3/obstack_patched.h 2022-01-13 14:54:06.341509600 +0000 3 | @@ -338,7 +338,10 @@ 4 | if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ 5 | _obstack_newchunk (__o, sizeof (void *)); \ 6 | if (!__o->alloc_failed) \ 7 | - *((void **)__o->next_free)++ = ((void *)datum); \ 8 | + { \ 9 | + *((void **)__o->next_free) = ((void *)datum); \ 10 | + __o->next_free += sizeof (void *); \ 11 | + } \ 12 | (void) 0; }) 13 | 14 | #define obstack_int_grow(OBSTACK,datum) \ 15 | -------------------------------------------------------------------------------- /patches/obstack-2.8.0.h.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.8.0/obstack.h 1997-10-27 00:14:42.000000000 +0000 2 | +++ gcc-2.8.0/obstack_patched.h 2023-09-10 09:11:36.902206085 +0000 3 | @@ -424,7 +424,8 @@ 4 | ({ struct obstack *__o = (OBSTACK); \ 5 | if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ 6 | _obstack_newchunk (__o, sizeof (void *)); \ 7 | - *((void **)__o->next_free)++ = ((void *)datum); \ 8 | + *((void **)__o->next_free) = ((void *)datum); \ 9 | + __o->next_free += sizeof (void *); \ 10 | (void) 0; }) 11 | 12 | #define obstack_int_grow(OBSTACK,datum) \ 13 | -------------------------------------------------------------------------------- /patches/obstack-2.8.1.h.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.8.1/obstack.h 1998-02-20 13:21:47.000000000 +0000 2 | +++ gcc-2.8.1/obstack_patched.h 2022-01-12 05:30:24.443626800 +0000 3 | @@ -418,7 +418,8 @@ 4 | ({ struct obstack *__o = (OBSTACK); \ 5 | if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ 6 | _obstack_newchunk (__o, sizeof (void *)); \ 7 | - *((void **)__o->next_free)++ = ((void *)datum); \ 8 | + *((void **)__o->next_free) = ((void *)datum); \ 9 | + __o->next_free += sizeof (void *); \ 10 | (void) 0; }) 11 | 12 | # define obstack_int_grow(OBSTACK,datum) \ 13 | -------------------------------------------------------------------------------- /patches/obstack-2.91.66.h.patch: -------------------------------------------------------------------------------- 1 | --- obstack.h 1998-05-05 23:17:18.000000000 +0000 2 | +++ obstack_patched.h 2023-08-14 20:03:25.162798764 +0000 3 | @@ -417,7 +417,8 @@ 4 | ({ struct obstack *__o = (OBSTACK); \ 5 | if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ 6 | _obstack_newchunk (__o, sizeof (void *)); \ 7 | - *((void **)__o->next_free)++ = ((void *)datum); \ 8 | + *((void **)__o->next_free) = ((void *)datum); \ 9 | + __o->next_free += sizeof (void *); \ 10 | (void) 0; }) 11 | 12 | # define obstack_int_grow(OBSTACK,datum) \ 13 | -------------------------------------------------------------------------------- /patches/obstack-2.95.2.h.patch: -------------------------------------------------------------------------------- 1 | --- include/obstack.h 1998-09-05 12:25:19.000000000 +0000 2 | +++ include/obstack_patched.h 2022-01-25 21:13:02.988292815 +0000 3 | @@ -417,7 +417,8 @@ 4 | ({ struct obstack *__o = (OBSTACK); \ 5 | if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ 6 | _obstack_newchunk (__o, sizeof (void *)); \ 7 | - *((void **)__o->next_free)++ = ((void *)datum); \ 8 | + *((void **)__o->next_free) = ((void *)datum); \ 9 | + __o->next_free += sizeof (void *); \ 10 | (void) 0; }) 11 | 12 | # define obstack_int_grow(OBSTACK,datum) \ 13 | -------------------------------------------------------------------------------- /patches/psx-2.5.7.patch: -------------------------------------------------------------------------------- 1 | diff --color -ruN -p1 gcc-2.6.3/config/mips/psx.h gcc-2.6.3-psx/config/mips/psx.h 2 | --- gcc-2.6.3/config/mips/psx.h 1970-01-01 01:00:00.000000000 +0100 3 | +++ gcc-2.6.3-psx/config/mips/psx.h 2023-03-26 13:52:13.400875920 +0100 4 | @@ -0,0 +1,108 @@ 5 | +/* Definitions of target machine for GNU compiler. Iris version. 6 | + Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. 7 | + 8 | +This file is part of GNU CC. 9 | + 10 | +GNU CC is free software; you can redistribute it and/or modify 11 | +it under the terms of the GNU General Public License as published by 12 | +the Free Software Foundation; either version 2, or (at your option) 13 | +any later version. 14 | + 15 | +GNU CC is distributed in the hope that it will be useful, 16 | +but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | +GNU General Public License for more details. 19 | + 20 | +You should have received a copy of the GNU General Public License 21 | +along with GNU CC; see the file COPYING. If not, write to 22 | +the Free Software Foundation, 59 Temple Place - Suite 330, 23 | +Boston, MA 02111-1307, USA. */ 24 | + 25 | + 26 | +/* Definitions by GIL for PSX */ 27 | + 28 | +#define TARGET_DEFAULT (MASK_GAS+MASK_SOFT_FLOAT) 29 | + 30 | +#define CPP_PREDEFINES "-Dmips -DMIPSEL" 31 | + 32 | +#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" 33 | + 34 | +#define CPP_SPEC "\ 35 | +%{!ansi:-D__EXTENSIONS__} -D_MIPSEL \ 36 | +%{.S: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 37 | +%{.s: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 38 | +%{.cc: -D_LANGUAGE_C_PLUS_PLUS} \ 39 | +%{.cxx: -D_LANGUAGE_C_PLUS_PLUS} \ 40 | +%{.C: -D_LANGUAGE_C_PLUS_PLUS} \ 41 | +%{.m: -D_LANGUAGE_OBJECTIVE_C} \ 42 | +%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \ 43 | +%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ 44 | +%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ 45 | +%{mips3:-U__mips -D__mips=3}" 46 | + 47 | +#define LIB_SPEC \ 48 | + "%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s" 49 | + 50 | +#define MACHINE_TYPE "Sony Playstation" 51 | + 52 | +#define TARGET_ENDIAN_DEFAULT 0 53 | + 54 | +/* A C statement to output something to the assembler file to switch to section 55 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 56 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 57 | + define this macro in such cases. */ 58 | + 59 | +#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \ 60 | + fprintf (FILE, "\t.section %s,\"aw\",@progbits\n", (NAME)) 61 | + 62 | +/* GIL: R3000 machine supports ISA 1 */ 63 | +#define MIPS_ISA_DEFAULT 1 64 | +/* GIL: set to r3000 */ 65 | +#define MIPS_CPU_STRING_DEFAULT "R3000" 66 | + 67 | +/* End of GIL for PSX */ 68 | + 69 | + 70 | +#define SGI_TARGET 1 /* inform other mips files this is SGI */ 71 | + 72 | +/* Always use 1 for .file number. I [meissner@osf.org] wonder why 73 | + IRIS needs this. */ 74 | + 75 | +#define SET_FILE_NUMBER() ++num_source_filenames 76 | + 77 | +/* Put out a label after a .loc. I [meissner@osf.org] wonder why 78 | + IRIS needs this. */ 79 | + 80 | +#define LABEL_AFTER_LOC(STREAM) fprintf (STREAM, "LM%d:\n", ++sym_lineno) 81 | + 82 | +#define STACK_ARGS_ADJUST(SIZE) \ 83 | +{ \ 84 | + SIZE.constant += 4; \ 85 | + if (SIZE.constant < 32) \ 86 | + SIZE.constant = 32; \ 87 | +} 88 | + 89 | +/* Do not allow `$' in identifiers. */ 90 | + 91 | +#define DOLLARS_IN_IDENTIFIERS 0 92 | + 93 | +/* Tell G++ not to create constructors or destructors with $'s in them. */ 94 | + 95 | +#define NO_DOLLAR_IN_LABEL 1 96 | + 97 | +/* Specify wchar_t type. */ 98 | +#define WCHAR_TYPE "unsigned char" 99 | +#define WCHAR_TYPE_SIZE BITS_PER_UNIT 100 | + 101 | +/* Generate calls to memcpy, etc., not bcopy, etc. */ 102 | +#define TARGET_MEM_FUNCTIONS 103 | + 104 | +/* Xeeynamo: force to use little-endian */ 105 | +#define MIPSEL 106 | +#define BYTES_BIG_ENDIAN 0 107 | +#define WORDS_BIG_ENDIAN 0 108 | + 109 | +/* Plain char is unsigned in the SGI compiler. */ 110 | +#define DEFAULT_SIGNED_CHAR 0 111 | + 112 | +#include "mips/mips.h" 113 | diff --color -ruN -p1 gcc-2.6.3/config/mips/xm-psx.h gcc-2.6.3-psx/config/mips/xm-psx.h 114 | --- gcc-2.6.3/config/mips/xm-psx.h 1970-01-01 01:00:00.000000000 +0100 115 | +++ gcc-2.6.3-psx/config/mips/xm-psx.h 2023-03-26 13:52:13.402875923 +0100 116 | @@ -0,0 +1,12 @@ 117 | +#define USG 118 | + 119 | +#include "mips/xm-mips.h" 120 | + 121 | +#define USG 122 | +#define HAVE_VPRINTF 123 | + 124 | +/* 125 | +#define bcopy(a,b,c) memcpy (b,a,c) 126 | +#define bzero(a,b) memset (a,0,b) 127 | +#define bcmp(a,b,c) memcmp (a,b,c) 128 | +*/ 129 | \ No newline at end of file 130 | diff --color -ruN -p1 gcc-2.6.3/config.sub gcc-2.6.3-psx/config.sub 131 | --- gcc-2.6.3/config.sub 1994-10-26 18:23:05.000000000 +0000 132 | +++ gcc-2.6.3-psx/config.sub 2023-03-26 13:53:36.046989327 +0100 133 | @@ -420,2 +420,6 @@ case $basic_machine in 134 | ;; 135 | + psx) 136 | + basic_machine=mips-sony 137 | + os=-psx 138 | + ;; 139 | rtpc | rtpc-*) 140 | @@ -636,2 +640,5 @@ case $os in 141 | ;; 142 | + -psx) 143 | + os=-psx 144 | + ;; 145 | -none) 146 | diff --color -ruN -p1 gcc-2.6.3/configure gcc-2.6.3-psx/configure 147 | --- gcc-2.6.3/configure 1994-11-23 22:26:27.000000000 +0000 148 | +++ gcc-2.6.3-psx/configure 2023-03-26 13:54:03.941012094 +0100 149 | @@ -1471,2 +1471,20 @@ for machine in $canon_build $canon_host 150 | ;; 151 | + mips-sony-psx*) # Sony Playstation 152 | + tm_file=mips/psx.h 153 | + xm_file=mips/xm-psx.h 154 | + elf=yes 155 | + gnu_ld=yes 156 | + gas=yes 157 | + DEFS=-Dpsx -D__psx__ -D__psx 158 | + if [ x$gas = xyes ] 159 | + then 160 | + tmake_file=mips/t-mips-gas 161 | + else 162 | + extra_passes="mips-tfile mips-tdump" 163 | + fi 164 | + if [ x$gnu_ld != xyes ] 165 | + then 166 | + use_collect2=yes 167 | + fi 168 | + ;; 169 | mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0. 170 | -------------------------------------------------------------------------------- /patches/psx-2.91.patch: -------------------------------------------------------------------------------- 1 | diff --color -ruN -p1 gcc-2.6.3/gcc/config/mips/psx.h gcc-2.6.3-psx/gcc/config/mips/psx.h 2 | --- gcc-2.6.3/gcc/config/mips/psx.h 1970-01-01 01:00:00.000000000 +0100 3 | +++ gcc-2.6.3-psx/gcc/config/mips/psx.h 2023-03-26 13:52:13.400875920 +0100 4 | @@ -0,0 +1,108 @@ 5 | +/* Definitions of target machine for GNU compiler. Iris version. 6 | + Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. 7 | + 8 | +This file is part of GNU CC. 9 | + 10 | +GNU CC is free software; you can redistribute it and/or modify 11 | +it under the terms of the GNU General Public License as published by 12 | +the Free Software Foundation; either version 2, or (at your option) 13 | +any later version. 14 | + 15 | +GNU CC is distributed in the hope that it will be useful, 16 | +but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | +GNU General Public License for more details. 19 | + 20 | +You should have received a copy of the GNU General Public License 21 | +along with GNU CC; see the file COPYING. If not, write to 22 | +the Free Software Foundation, 59 Temple Place - Suite 330, 23 | +Boston, MA 02111-1307, USA. */ 24 | + 25 | + 26 | +/* Definitions by GIL for PSX */ 27 | + 28 | +#define TARGET_DEFAULT (MASK_GAS+MASK_SOFT_FLOAT+MASK_GPOPT+MASK_SPLIT_ADDR) 29 | + 30 | +#define CPP_PREDEFINES "-Dmips -DMIPSEL" 31 | + 32 | +#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" 33 | + 34 | +#define CPP_SPEC "\ 35 | +%{!ansi:-D__EXTENSIONS__} -D_MIPSEL \ 36 | +%{.S: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 37 | +%{.s: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 38 | +%{.cc: -D_LANGUAGE_C_PLUS_PLUS} \ 39 | +%{.cxx: -D_LANGUAGE_C_PLUS_PLUS} \ 40 | +%{.C: -D_LANGUAGE_C_PLUS_PLUS} \ 41 | +%{.m: -D_LANGUAGE_OBJECTIVE_C} \ 42 | +%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \ 43 | +%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ 44 | +%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ 45 | +%{mips3:-U__mips -D__mips=3}" 46 | + 47 | +#define LIB_SPEC \ 48 | + "%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s" 49 | + 50 | +#define MACHINE_TYPE "Sony Playstation" 51 | + 52 | +#define TARGET_ENDIAN_DEFAULT 0 53 | + 54 | +/* A C statement to output something to the assembler file to switch to section 55 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 56 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 57 | + define this macro in such cases. */ 58 | + 59 | +#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \ 60 | + fprintf (FILE, "\t.section %s,\"aw\",@progbits\n", (NAME)) 61 | + 62 | +/* GIL: R3000 machine supports ISA 1 */ 63 | +#define MIPS_ISA_DEFAULT 1 64 | +/* GIL: set to r3000 */ 65 | +#define MIPS_CPU_STRING_DEFAULT "R3000" 66 | + 67 | +/* End of GIL for PSX */ 68 | + 69 | + 70 | +#define SGI_TARGET 1 /* inform other mips files this is SGI */ 71 | + 72 | +/* Always use 1 for .file number. I [meissner@osf.org] wonder why 73 | + IRIS needs this. */ 74 | + 75 | +#define SET_FILE_NUMBER() ++num_source_filenames 76 | + 77 | +/* Put out a label after a .loc. I [meissner@osf.org] wonder why 78 | + IRIS needs this. */ 79 | + 80 | +#define LABEL_AFTER_LOC(STREAM) fprintf (STREAM, "LM%d:\n", ++sym_lineno) 81 | + 82 | +#define STACK_ARGS_ADJUST(SIZE) \ 83 | +{ \ 84 | + SIZE.constant += 4; \ 85 | + if (SIZE.constant < 32) \ 86 | + SIZE.constant = 32; \ 87 | +} 88 | + 89 | +/* Do not allow `$' in identifiers. */ 90 | + 91 | +#define DOLLARS_IN_IDENTIFIERS 0 92 | + 93 | +/* Tell G++ not to create constructors or destructors with $'s in them. */ 94 | + 95 | +#define NO_DOLLAR_IN_LABEL 1 96 | + 97 | +/* Specify wchar_t type. */ 98 | +#define WCHAR_TYPE "unsigned char" 99 | +#define WCHAR_TYPE_SIZE BITS_PER_UNIT 100 | + 101 | +/* Generate calls to memcpy, etc., not bcopy, etc. */ 102 | +#define TARGET_MEM_FUNCTIONS 103 | + 104 | +/* Xeeynamo: force to use little-endian */ 105 | +#define MIPSEL 106 | +#define BYTES_BIG_ENDIAN 0 107 | +#define WORDS_BIG_ENDIAN 0 108 | + 109 | +/* Plain char is unsigned in the SGI compiler. */ 110 | +#define DEFAULT_SIGNED_CHAR 0 111 | + 112 | +#include "mips/mips.h" 113 | diff --color -ruN -p1 gcc-2.6.3/gcc/config/mips/xm-psx.h gcc-2.6.3-psx/gcc/config/mips/xm-psx.h 114 | --- gcc-2.6.3/gcc/config/mips/xm-psx.h 1970-01-01 01:00:00.000000000 +0100 115 | +++ gcc-2.6.3-psx/gcc/config/mips/xm-psx.h 2023-03-26 13:52:13.402875923 +0100 116 | @@ -0,0 +1,12 @@ 117 | +#define USG 118 | + 119 | +#include "mips/xm-mips.h" 120 | + 121 | +#define USG 122 | +#define HAVE_VPRINTF 123 | + 124 | +/* 125 | +#define bcopy(a,b,c) memcpy (b,a,c) 126 | +#define bzero(a,b) memset (a,0,b) 127 | +#define bcmp(a,b,c) memcmp (a,b,c) 128 | +*/ 129 | \ No newline at end of file 130 | diff --color -ruN -p1 gcc-2.6.3/config.sub gcc-2.6.3-psx/config.sub 131 | --- gcc-2.6.3/config.sub 1994-10-26 18:23:05.000000000 +0000 132 | +++ gcc-2.6.3-psx/config.sub 2023-03-26 13:53:36.046989327 +0100 133 | @@ -420,2 +420,6 @@ case $basic_machine in 134 | ;; 135 | + psx) 136 | + basic_machine=mips-sony 137 | + os=-psx 138 | + ;; 139 | rtpc | rtpc-*) 140 | @@ -636,2 +640,5 @@ case $os in 141 | ;; 142 | + -psx) 143 | + os=-psx 144 | + ;; 145 | -none) 146 | diff --color -ruN -p1 gcc-2.6.3/gcc/configure gcc-2.6.3-psx/gcc/configure 147 | --- gcc-2.6.3/gcc/configure 1994-11-23 22:26:27.000000000 +0000 148 | +++ gcc-2.6.3-psx/gcc/configure 2023-03-26 13:54:03.941012094 +0100 149 | @@ -1471,2 +1471,20 @@ for machine in $canon_build $canon_host 150 | ;; 151 | + mips-sony-psx*) # Sony Playstation 152 | + tm_file=mips/psx.h 153 | + xm_file=mips/xm-psx.h 154 | + elf=yes 155 | + gnu_ld=yes 156 | + gas=yes 157 | + DEFS=-Dpsx -D__psx__ -D__psx 158 | + if [ x$gas = xyes ] 159 | + then 160 | + tmake_file=mips/t-mips-gas 161 | + else 162 | + extra_passes="mips-tfile mips-tdump" 163 | + fi 164 | + if [ x$gnu_ld != xyes ] 165 | + then 166 | + use_collect2=yes 167 | + fi 168 | + ;; 169 | mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0. 170 | -------------------------------------------------------------------------------- /patches/psx.patch: -------------------------------------------------------------------------------- 1 | diff --color -ruN -p1 gcc-2.6.3/config/mips/psx.h gcc-2.6.3-psx/config/mips/psx.h 2 | --- gcc-2.6.3/config/mips/psx.h 1970-01-01 01:00:00.000000000 +0100 3 | +++ gcc-2.6.3-psx/config/mips/psx.h 2023-03-26 13:52:13.400875920 +0100 4 | @@ -0,0 +1,108 @@ 5 | +/* Definitions of target machine for GNU compiler. Iris version. 6 | + Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc. 7 | + 8 | +This file is part of GNU CC. 9 | + 10 | +GNU CC is free software; you can redistribute it and/or modify 11 | +it under the terms of the GNU General Public License as published by 12 | +the Free Software Foundation; either version 2, or (at your option) 13 | +any later version. 14 | + 15 | +GNU CC is distributed in the hope that it will be useful, 16 | +but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | +GNU General Public License for more details. 19 | + 20 | +You should have received a copy of the GNU General Public License 21 | +along with GNU CC; see the file COPYING. If not, write to 22 | +the Free Software Foundation, 59 Temple Place - Suite 330, 23 | +Boston, MA 02111-1307, USA. */ 24 | + 25 | + 26 | +/* Definitions by GIL for PSX */ 27 | + 28 | +#define TARGET_DEFAULT (MASK_GAS+MASK_SOFT_FLOAT+MASK_GPOPT+MASK_SPLIT_ADDR) 29 | + 30 | +#define CPP_PREDEFINES "-Dmips -DMIPSEL" 31 | + 32 | +#define STARTFILE_SPEC "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" 33 | + 34 | +#define CPP_SPEC "\ 35 | +%{!ansi:-D__EXTENSIONS__} -D_MIPSEL \ 36 | +%{.S: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 37 | +%{.s: -D_LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ 38 | +%{.cc: -D_LANGUAGE_C_PLUS_PLUS} \ 39 | +%{.cxx: -D_LANGUAGE_C_PLUS_PLUS} \ 40 | +%{.C: -D_LANGUAGE_C_PLUS_PLUS} \ 41 | +%{.m: -D_LANGUAGE_OBJECTIVE_C} \ 42 | +%{!.S: %{!.s: %{!.cc: %{!.cxx: %{!.C: %{!.m: -D_LANGUAGE_C %{!ansi:-DLANGUAGE_C}}}}}}} \ 43 | +%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ 44 | +%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ 45 | +%{mips3:-U__mips -D__mips=3}" 46 | + 47 | +#define LIB_SPEC \ 48 | + "%{!p:%{!pg:%{!static:%{!g*:-lc_s}} -lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s" 49 | + 50 | +#define MACHINE_TYPE "Sony Playstation" 51 | + 52 | +#define TARGET_ENDIAN_DEFAULT 0 53 | + 54 | +/* A C statement to output something to the assembler file to switch to section 55 | + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or 56 | + NULL_TREE. Some target formats do not support arbitrary sections. Do not 57 | + define this macro in such cases. */ 58 | + 59 | +#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \ 60 | + fprintf (FILE, "\t.section %s,\"aw\",@progbits\n", (NAME)) 61 | + 62 | +/* GIL: R3000 machine supports ISA 1 */ 63 | +#define MIPS_ISA_DEFAULT 1 64 | +/* GIL: set to r3000 */ 65 | +#define MIPS_CPU_STRING_DEFAULT "R3000" 66 | + 67 | +/* End of GIL for PSX */ 68 | + 69 | + 70 | +#define SGI_TARGET 1 /* inform other mips files this is SGI */ 71 | + 72 | +/* Always use 1 for .file number. I [meissner@osf.org] wonder why 73 | + IRIS needs this. */ 74 | + 75 | +#define SET_FILE_NUMBER() ++num_source_filenames 76 | + 77 | +/* Put out a label after a .loc. I [meissner@osf.org] wonder why 78 | + IRIS needs this. */ 79 | + 80 | +#define LABEL_AFTER_LOC(STREAM) fprintf (STREAM, "LM%d:\n", ++sym_lineno) 81 | + 82 | +#define STACK_ARGS_ADJUST(SIZE) \ 83 | +{ \ 84 | + SIZE.constant += 4; \ 85 | + if (SIZE.constant < 32) \ 86 | + SIZE.constant = 32; \ 87 | +} 88 | + 89 | +/* Do not allow `$' in identifiers. */ 90 | + 91 | +#define DOLLARS_IN_IDENTIFIERS 0 92 | + 93 | +/* Tell G++ not to create constructors or destructors with $'s in them. */ 94 | + 95 | +#define NO_DOLLAR_IN_LABEL 1 96 | + 97 | +/* Specify wchar_t type. */ 98 | +#define WCHAR_TYPE "unsigned char" 99 | +#define WCHAR_TYPE_SIZE BITS_PER_UNIT 100 | + 101 | +/* Generate calls to memcpy, etc., not bcopy, etc. */ 102 | +#define TARGET_MEM_FUNCTIONS 103 | + 104 | +/* Xeeynamo: force to use little-endian */ 105 | +#define MIPSEL 106 | +#define BYTES_BIG_ENDIAN 0 107 | +#define WORDS_BIG_ENDIAN 0 108 | + 109 | +/* Plain char is unsigned in the SGI compiler. */ 110 | +#define DEFAULT_SIGNED_CHAR 0 111 | + 112 | +#include "mips/mips.h" 113 | diff --color -ruN -p1 gcc-2.6.3/config/mips/xm-psx.h gcc-2.6.3-psx/config/mips/xm-psx.h 114 | --- gcc-2.6.3/config/mips/xm-psx.h 1970-01-01 01:00:00.000000000 +0100 115 | +++ gcc-2.6.3-psx/config/mips/xm-psx.h 2023-03-26 13:52:13.402875923 +0100 116 | @@ -0,0 +1,12 @@ 117 | +#define USG 118 | + 119 | +#include "mips/xm-mips.h" 120 | + 121 | +#define USG 122 | +#define HAVE_VPRINTF 123 | + 124 | +/* 125 | +#define bcopy(a,b,c) memcpy (b,a,c) 126 | +#define bzero(a,b) memset (a,0,b) 127 | +#define bcmp(a,b,c) memcmp (a,b,c) 128 | +*/ 129 | \ No newline at end of file 130 | diff --color -ruN -p1 gcc-2.6.3/config.sub gcc-2.6.3-psx/config.sub 131 | --- gcc-2.6.3/config.sub 1994-10-26 18:23:05.000000000 +0000 132 | +++ gcc-2.6.3-psx/config.sub 2023-03-26 13:53:36.046989327 +0100 133 | @@ -420,2 +420,6 @@ case $basic_machine in 134 | ;; 135 | + psx) 136 | + basic_machine=mips-sony 137 | + os=-psx 138 | + ;; 139 | rtpc | rtpc-*) 140 | @@ -636,2 +640,5 @@ case $os in 141 | ;; 142 | + -psx) 143 | + os=-psx 144 | + ;; 145 | -none) 146 | diff --color -ruN -p1 gcc-2.6.3/configure gcc-2.6.3-psx/configure 147 | --- gcc-2.6.3/configure 1994-11-23 22:26:27.000000000 +0000 148 | +++ gcc-2.6.3-psx/configure 2023-03-26 13:54:03.941012094 +0100 149 | @@ -1471,2 +1471,20 @@ for machine in $canon_build $canon_host 150 | ;; 151 | + mips-sony-psx*) # Sony Playstation 152 | + tm_file=mips/psx.h 153 | + xm_file=mips/xm-psx.h 154 | + elf=yes 155 | + gnu_ld=yes 156 | + gas=yes 157 | + DEFS=-Dpsx -D__psx__ -D__psx 158 | + if [ x$gas = xyes ] 159 | + then 160 | + tmake_file=mips/t-mips-gas 161 | + else 162 | + extra_passes="mips-tfile mips-tdump" 163 | + fi 164 | + if [ x$gnu_ld != xyes ] 165 | + then 166 | + use_collect2=yes 167 | + fi 168 | + ;; 169 | mips-sony-sysv*) # Sony NEWS 3800 with NEWSOS5.0. 170 | -------------------------------------------------------------------------------- /patches/sdbout-2.6.0.c.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.6.0/sdbout.c 1994-09-30 22:23:57.000000000 +0100 2 | +++ gcc-2.7.1/sdbout.c 1995-06-15 13:07:11.000000000 +0100 3 | @@ -56,2 +57,2 @@ 4 | -#if defined(USG) && !defined(MIPS) && !defined (hpux) 5 | +#if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) 6 | #include 7 | -------------------------------------------------------------------------------- /patches/sdbout-2.6.3.c.patch: -------------------------------------------------------------------------------- 1 | --- gcc-2.6.3/sdbout.c 1994-09-30 22:23:57.000000000 +0100 2 | +++ gcc-2.7.1/sdbout.c 1995-06-15 13:07:11.000000000 +0100 3 | @@ -56,2 +57,2 @@ 4 | -#if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(WINNT) 5 | +#if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) 6 | #include 7 | -------------------------------------------------------------------------------- /tests/little_endian.c: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | unsigned int field; 3 | } Foo; 4 | 5 | unsigned char bar(Foo* foo) { 6 | return foo->field; 7 | } 8 | -------------------------------------------------------------------------------- /tests/section_attribute.c: -------------------------------------------------------------------------------- 1 | int some_var __attribute__((section(".data"))) = 100; 2 | --------------------------------------------------------------------------------