Skip to content

Commit

Permalink
Mac support (#5)
Browse files Browse the repository at this point in the history
* Set gcc-11 in mac builds

* Revert "Revert "Hopefully add Mac support""

This reverts commit 72a67a0.

* matrix.TARGET.HOST_GCC

* -Wno-implicit-int

* forgot the ld

* revert CFLAGS in ./configure

* review

* patch

Co-authored-by: cadmic <cadmic24@gmail.com>

* Use macos-14 to build due to the other one no longer being accepted by gha

* gcc-13

* macos-13

---------

Co-authored-by: angie <angheloalf95@gmail.com>
Co-authored-by: cadmic <cadmic24@gmail.com>
  • Loading branch information
3 people authored Dec 27, 2024
1 parent c3b1b63 commit eef86b0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -13,18 +13,20 @@ 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-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',
HOST_GCC: 'gcc-13'
}
# - {
# 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:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install dependencies (Ubuntu)
shell: bash
Expand All @@ -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.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
Expand Down
2 changes: 1 addition & 1 deletion config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -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* \
Expand Down
10 changes: 8 additions & 2 deletions ld/ldlex.l
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions libiberty/strerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@ static int num_error_names = 0;
static int sys_nerr;
static const char **sys_errlist;

#elif defined(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;
Expand Down

0 comments on commit eef86b0

Please sign in to comment.