Skip to content

Commit 123f476

Browse files
authored
Update -psx builds to match PSYQ compiler default flags (#29)
* Update -psx builds to match PSYQ compiler default flags * Fixup flag tests for 2.8.x
1 parent 07b37c9 commit 123f476

12 files changed

+224
-14
lines changed

gcc-2.5.7-psx.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3434

3535
COPY tests /work/tests
3636
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 </dev/null 2>&1 | grep -- -msoft-float
3738

3839
RUN mv xgcc gcc
3940
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ || true

gcc-2.6.0-psx.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN patch -u -p1 cccp.c -i ../patches/cccp-2.6.0.c.patch
1818
RUN patch -u -p1 gcc.c -i ../patches/gcc-2.6.0.c.patch
1919
RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.0.c.patch
2020
RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.6.patch
21-
RUN patch -su -p1 < ../patches/psx.patch
21+
RUN patch -su -p1 < ../patches/psx-2.5.7.patch
2222

2323
RUN ./configure \
2424
--target=mips-sony-psx \
@@ -33,6 +33,7 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3333
COPY tests /work/tests
3434
RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
3535
RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c
36+
RUN ./cc1 -quiet -help </dev/null 2>&1 | grep -- -msoft-float
3637

3738
RUN mv xgcc gcc
3839
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/

gcc-2.6.3-psx.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN sed -i -- 's/include <varargs.h>/include <stdarg.h>/g' *.c
1414
RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch
1515
RUN patch -u -p1 sdbout.c -i ../patches/sdbout-2.6.3.c.patch
1616
RUN patch -u -p1 cp/g++.c -i ../patches/g++-2.6.3.c.patch
17-
RUN patch -su -p1 < ../patches/psx.patch
17+
RUN patch -su -p1 < ../patches/psx-2.5.7.patch
1818

1919
RUN touch -c cp/parse.y cp/parse.h cp/parse.c
2020
RUN touch insn-config.h
@@ -32,6 +32,7 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3232
COPY tests /work/tests
3333
RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
3434
RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c
35+
RUN ./cc1 -quiet -help </dev/null 2>&1 | grep -- -msoft-float
3536

3637
RUN mv xgcc gcc
3738
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/ || true

gcc-2.7.2-psx.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RUN patch -u -p1 obstack.h -i ../patches/obstack-2.7.2.h.patch
1919
RUN patch -u -p1 configure -i ../patches/configure.patch
2020
RUN patch -u -p1 config.sub -i ../patches/config.sub.patch
2121
RUN patch -u -p1 config/mips/mips.h -i ../patches/mipsel-2.7.patch
22-
RUN patch -su -p1 < ../patches/psx.patch
22+
RUN patch -su -p1 < ../patches/psx-2.5.7.patch
2323

2424
RUN ./configure \
2525
--target=mips-sony-psx \
@@ -37,6 +37,7 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3737
COPY tests /work/tests
3838
RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
3939
RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c
40+
RUN ./cc1 -quiet -help </dev/null 2>&1 | grep -- -msoft-float
4041

4142
RUN mv xgcc gcc
4243
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/

gcc-2.8.0-psx.Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY patches /work/patches
1616
RUN sed -i -- 's/include <varargs.h>/include <stdarg.h>/g' *.c
1717

1818
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/mipsel-2.8.patch
19+
RUN patch -u -p1 config/mips/mips.h -i ../patches/mips.patch
2020
RUN patch -su -p1 < ../patches/psx.patch
2121

2222
RUN ./configure \
@@ -35,6 +35,9 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3535
COPY tests /work/tests
3636
RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
3737
RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c
38+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -msoft-float
39+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -msplit-addresses
40+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -mgpopt
3841

3942
RUN mv xgcc gcc
4043
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/

gcc-2.8.1-psx.Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPY patches /work/patches
1616
RUN sed -i -- 's/include <varargs.h>/include <stdarg.h>/g' *.c
1717

1818
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/mipsel-2.8.patch
19+
RUN patch -u -p1 config/mips/mips.h -i ../patches/mips.patch
2020
RUN patch -su -p1 < ../patches/psx.patch
2121

2222
RUN ./configure \
@@ -37,6 +37,9 @@ RUN make --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m32 -stati
3737
COPY tests /work/tests
3838
RUN ./cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
3939
RUN ./cc1 -quiet -O2 /work/tests/section_attribute.c
40+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -msoft-float
41+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -msplit-addresses
42+
RUN ./cc1 -version </dev/null 2>&1 | grep -- -mgpopt
4043

4144
RUN mv xgcc gcc
4245
RUN mkdir /build && cp cpp cc1 gcc cc1plus g++ /build/

gcc-2.91.66-psx.Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ COPY patches /work/patches
1616

1717
RUN sed -i -- 's/include <varargs.h>/include <stdarg.h>/g' **/*.c
1818
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/mipsel-2.8.patch
20-
RUN patch -su -p1 < ../patches/psx.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
2121

2222
RUN for dir in libiberty gcc; do \
2323
cd /work/gcc-${VERSION}/${dir}; \
@@ -39,6 +39,9 @@ RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m3
3939
COPY tests /work/tests
4040
RUN ./gcc/cc1 -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
4141
RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c
42+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -msoft-float
43+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -msplit-addresses
44+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -mgpopt
4245

4346
RUN mv ./gcc/xgcc ./gcc/gcc
4447
RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/

gcc-2.95.2-psx.Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ COPY patches /work/patches
1616

1717
RUN sed -i -- 's/include <varargs.h>/include <stdarg.h>/g' **/*.c
1818
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/mipsel-2.8.patch
20-
RUN patch -su -p1 < ../patches/psx.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+
2122

2223
RUN for dir in libiberty gcc; do \
2324
cd /work/gcc-${VERSION}/${dir}; \
@@ -39,6 +40,9 @@ RUN make -C gcc/ --jobs $(nproc) cpp cc1 xgcc cc1plus g++ CFLAGS="-std=gnu89 -m3
3940
COPY tests /work/tests
4041
RUN ./gcc/cc1 -mel -quiet -O2 /work/tests/little_endian.c && grep -E 'lbu\s\$2,0\(\$4\)' /work/tests/little_endian.s
4142
RUN ./gcc/cc1 -quiet -O2 /work/tests/section_attribute.c
43+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -msoft-float
44+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -msplit-addresses
45+
RUN ./gcc/cc1 -version </dev/null 2>&1 | grep -- -mgpopt
4246

4347
RUN mv ./gcc/xgcc ./gcc/gcc
4448
RUN mkdir /build && cp ./gcc/cpp ./gcc/cc1 ./gcc/gcc ./gcc/cc1plus ./gcc/g++ /build/

patches/mips.patch

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+

patches/mipsel-2.8.patch

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
@@ -441,6 +441,9 @@
44
| TARGET_ENDIAN_DEFAULT)} \
55
}
6-
6+
77
+/* Default little-endian */
88
+#define TARGET_ENDIAN_DEFAULT -MASK_BIG_ENDIAN
99
+
1010
/* Default target_flags if no switches are specified */
11-
11+
1212
#ifndef TARGET_DEFAULT
1313
@@ -1153,6 +1156,22 @@
1414
#define ASM_OUTPUT_DESTRUCTOR(file, name)
15-
15+
1616
#endif /* 0 */
1717
+
1818
+/* A C statement to output something to the assembler file to switch to section
@@ -32,4 +32,3 @@
3232
+} while (0)
3333

3434
/* Target machine storage layout */
35-

0 commit comments

Comments
 (0)