Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Mac support #5

Merged
merged 13 commits into from
Dec 27, 2024
18 changes: 10 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-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'
}
# - {
# 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:
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
8 changes: 8 additions & 0 deletions libiberty/strerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,20 @@ static int num_error_names = 0;
static int sys_nerr;
static const char **sys_errlist;

#else
#ifdef DARWIN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#else
#ifdef DARWIN
#elif defined(DARWIN)

Would remove the need for an extra trailing #endif


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


/*
Expand Down