From aed730910a773997a824643348b67c5da721b9ce Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 21 Jan 2023 12:04:51 -0300 Subject: [PATCH 01/11] Set gcc-11 in mac builds --- .github/workflows/build.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 771a5c6..9f26006 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,14 +13,16 @@ jobs: OS: 'ubuntu-20.04', CFLAGS: '-static -fno-stack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', HOST: 'i386-pc-linux', - ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-linux.tar.gz' + ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-linux.tar.gz', + HOST_GCC: 'gcc' + } + - { + OS: 'macos-12', + CFLAGS: '-DDARWIN -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', + HOST: 'i386-apple-darwin', + ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz', + HOST_GCC: 'gcc-11' } - # - { - # OS: 'macos-latest', - # CFLAGS: '-DDARWIN -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', - # HOST: 'i386-apple-darwin', - # ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz' - # } name: Building binutils for ${{ matrix.TARGET.OS }} steps: @@ -35,7 +37,7 @@ jobs: - name: Configure for mips shell: bash run: | - ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} + CC=${{ matrix.HOST_GCC }} ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} - name: Make shell: bash From 86541aaf065326b68874a31b259d3e90316c5bbc Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 21 Jan 2023 12:05:52 -0300 Subject: [PATCH 02/11] Revert "Revert "Hopefully add Mac support"" This reverts commit 72a67a01ff1b56fe3a1016fdce4dabf532ad9992. --- config.sub | 2 +- libiberty/strerror.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config.sub b/config.sub index f0f2e99..72b4523 100755 --- a/config.sub +++ b/config.sub @@ -905,7 +905,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*) + | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*| -darwin*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ diff --git a/libiberty/strerror.c b/libiberty/strerror.c index 644cc75..f198222 100644 --- a/libiberty/strerror.c +++ b/libiberty/strerror.c @@ -460,12 +460,20 @@ static int num_error_names = 0; static int sys_nerr; static const char **sys_errlist; +#else +#ifdef DARWIN + +// macOS added 'const' to these declarations, and clang complains if they are otherwise +extern const int sys_nerr; +extern const char *sys_errlist[]; + #else extern int sys_nerr; extern char *sys_errlist[]; #endif +#endif /* From 0287f0cd4e55e67a403902ad45255d308ef78267 Mon Sep 17 00:00:00 2001 From: angie Date: Sat, 21 Jan 2023 12:25:50 -0300 Subject: [PATCH 03/11] matrix.TARGET.HOST_GCC --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f26006..4de43d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: - name: Configure for mips shell: bash run: | - CC=${{ matrix.HOST_GCC }} ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} + CC="${{ matrix.TARGET.HOST_GCC }}" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} - name: Make shell: bash From 2b208fe0bfdb1f7864c934b997b9a5037aa7ee6f Mon Sep 17 00:00:00 2001 From: AltoXorg <56553686+Alto1772@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:36:37 +0800 Subject: [PATCH 04/11] -Wno-implicit-int --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4de43d5..500d8b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: } - { OS: 'macos-12', - CFLAGS: '-DDARWIN -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', + CFLAGS: '-DDARWIN -Wno-implicit-int -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', HOST: 'i386-apple-darwin', ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz', HOST_GCC: 'gcc-11' @@ -37,17 +37,17 @@ jobs: - name: Configure for mips shell: bash run: | - CC="${{ matrix.TARGET.HOST_GCC }}" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} + CC="${{ matrix.TARGET.HOST_GCC }}" CFLAGS="${{ matrix.TARGET.CFLAGS }}" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} - name: Make shell: bash run: | - make -C bfd CFLAGS="${{ matrix.TARGET.CFLAGS }}" - make -C opcodes CFLAGS="${{ matrix.TARGET.CFLAGS }}" - make -C libiberty CFLAGS="${{ matrix.TARGET.CFLAGS }}" - make -C intl CFLAGS="${{ matrix.TARGET.CFLAGS }}" - make -C gas CFLAGS="${{ matrix.TARGET.CFLAGS }}" - make -C binutils CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C bfd + make -C opcodes + make -C libiberty + make -C intl + make -C gas + make -C binutils - name: Test for file shell: bash run: | From 4e5844e1f631dab6a6034e2e3324378037688aae Mon Sep 17 00:00:00 2001 From: AltoXorg <56553686+Alto1772@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:52:39 +0800 Subject: [PATCH 05/11] forgot the ld --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1964b47..4198bac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,6 +48,7 @@ jobs: make -C intl make -C gas make -C binutils + make -C ld - name: Test for file shell: bash run: | From 4de6e74e349216ca6c8d22ea137eb1aabbccb393 Mon Sep 17 00:00:00 2001 From: AltoXorg <56553686+Alto1772@users.noreply.github.com> Date: Mon, 4 Dec 2023 19:01:23 +0800 Subject: [PATCH 06/11] revert CFLAGS in ./configure --- .github/workflows/build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4198bac..b0b04b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,18 +37,18 @@ jobs: - name: Configure for mips shell: bash run: | - CC="${{ matrix.TARGET.HOST_GCC }}" CFLAGS="${{ matrix.TARGET.CFLAGS }}" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} + CC="${{ matrix.TARGET.HOST_GCC }}" CFLAGS="-Wno-implicit-int" ./configure --target=mips-linux --prefix=/opt/cross --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }} - name: Make shell: bash run: | - make -C bfd - make -C opcodes - make -C libiberty - make -C intl - make -C gas - make -C binutils - make -C ld + make -C bfd CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C opcodes CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C libiberty CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C intl CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C gas CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C binutils CFLAGS="${{ matrix.TARGET.CFLAGS }}" + make -C ld CFLAGS="${{ matrix.TARGET.CFLAGS }}" - name: Test for file shell: bash run: | From e48a365219316466ace5085aeb812a0227a50d30 Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 27 Dec 2024 16:42:31 -0300 Subject: [PATCH 07/11] review --- libiberty/strerror.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libiberty/strerror.c b/libiberty/strerror.c index f198222..bd0f892 100644 --- a/libiberty/strerror.c +++ b/libiberty/strerror.c @@ -460,8 +460,7 @@ static int num_error_names = 0; static int sys_nerr; static const char **sys_errlist; -#else -#ifdef DARWIN +#elif defined(DARWIN) // macOS added 'const' to these declarations, and clang complains if they are otherwise extern const int sys_nerr; @@ -473,7 +472,6 @@ extern int sys_nerr; extern char *sys_errlist[]; #endif -#endif /* From f9de16dfc28ce5ac6c55faedda85fa60834d401e Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 27 Dec 2024 16:46:54 -0300 Subject: [PATCH 08/11] patch Co-authored-by: cadmic --- ld/ldlex.l | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ld/ldlex.l b/ld/ldlex.l index 561b8af..173ba62 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -76,9 +76,15 @@ static unsigned int lineno_stack[MAX_INCLUDE_DEPTH]; static unsigned int include_stack_ptr = 0; static int vers_node_nesting = 0; +#ifdef DARWIN +#define YY_SIZE_T yy_size_t +#else +#define YY_SIZE_T int +#endif + static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string, size_t size)); -static void yy_input PARAMS ((char *, int *result, int max_size)); +static void yy_input PARAMS ((char *, YY_SIZE_T *result, int max_size)); static void comment PARAMS ((void)); static void lex_warn_invalid PARAMS ((char *where, char *what)); @@ -581,7 +587,7 @@ ldlex_popstate () static void yy_input (buf, result, max_size) char *buf; - int *result; + YY_SIZE_T *result; int max_size; { *result = 0; From b0cbb31bb782dc34f08312f5a6348aeca5d8c094 Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 27 Dec 2024 16:51:27 -0300 Subject: [PATCH 09/11] Use macos-14 to build due to the other one no longer being accepted by gha --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0b04b4..58937a0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build -on: [push] +on: [push, pull_request] jobs: build: @@ -17,7 +17,7 @@ jobs: HOST_GCC: 'gcc' } - { - OS: 'macos-12', + OS: 'macos-14', CFLAGS: '-DDARWIN -Wno-implicit-int -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', HOST: 'i386-apple-darwin', ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz', From dc898dac9749bcd1fa76bb132d41564b66bd135e Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 27 Dec 2024 16:55:28 -0300 Subject: [PATCH 10/11] gcc-13 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58937a0..9f006f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: CFLAGS: '-DDARWIN -Wno-implicit-int -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', HOST: 'i386-apple-darwin', ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz', - HOST_GCC: 'gcc-11' + HOST_GCC: 'gcc-13' } name: Building binutils for ${{ matrix.TARGET.OS }} From 314f398ae703661677aeedbfae425872aff27866 Mon Sep 17 00:00:00 2001 From: angie Date: Fri, 27 Dec 2024 17:18:47 -0300 Subject: [PATCH 11/11] macos-13 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f006f8..b400258 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: HOST_GCC: 'gcc' } - { - OS: 'macos-14', + OS: 'macos-13', CFLAGS: '-DDARWIN -Wno-implicit-int -Wno-return-type -Wno-error -Wno-implicit-function-declaration -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0', HOST: 'i386-apple-darwin', ARCHIVE_NAME: 'mips-binutils-egcs-2.9.5-mac.tar.gz', @@ -26,7 +26,7 @@ jobs: name: Building binutils for ${{ matrix.TARGET.OS }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies (Ubuntu) shell: bash