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 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 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 -std=gnu89 -m32',
HOST: 'i386-pc-linux',
ARCHIVE_NAME: 'mips-gcc-egcs-2.91.66-linux.tar.gz'
ARCHIVE_NAME: 'mips-gcc-egcs-2.91.66-linux.tar.gz',
HOST_GCC: 'gcc'
}
- {
OS: 'macos-latest',
CFLAGS: '-DDARWIN -std=gnu89 -Wno-return-type -Wno-error -Wno-implicit-function-declaration',
HOST: 'i386-apple-darwin',
ARCHIVE_NAME: 'mips-gcc-egcs-2.91.66-mac.tar.gz',
HOST_GCC: 'gcc-11'
}
# - {
# OS: 'macos-latest',
# CFLAGS: '-DDARWIN -std=gnu89 -Wno-return-type -Wno-error -Wno-implicit-function-declaration',
# HOST: 'i386-apple-darwin',
# ARCHIVE_NAME: 'mips-gcc-egcs-2.91.66-mac.tar.gz'
# }

name: Building gcc for ${{ matrix.TARGET.OS }}
steps:
Expand All @@ -35,11 +37,12 @@ jobs:
- name: Configure for mips
shell: bash
run: |
./configure --target=mips-linux --prefix=/opt/cross --with-gnu-as --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 --with-gnu-as --disable-gprof --disable-gdb --disable-werror --host=${{ matrix.TARGET.HOST }} --build=${{ matrix.TARGET.HOST }}

- name: Make
shell: bash
run: |
touch gcc/c-parse.c gcc/cexp.c gcc/cp/parse.c # makes `make` ignore regeneration of the .y files
make -C gcc CFLAGS="${{ matrix.TARGET.CFLAGS }}" xgcc cc1 cc1plus cpp cccp g++
- name: Test for file
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ case $os in
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv*)
| -mingw32* | -linux-gnu* | -uxpv* | -darwin* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
# CYGNUS LOCAL
Expand Down
2 changes: 1 addition & 1 deletion gcc/config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ case $os in
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* )
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -darwin* )
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
Expand Down
4 changes: 4 additions & 0 deletions gcc/config/i386/xm-darwin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Configuration for GCC for Intel i386 or later running macOS as host. */

#include <alloca.h>
#include "i386/xm-i386.h"
3 changes: 3 additions & 0 deletions gcc/configure
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,9 @@ for machine in $build $host $target; do
# Next line turned off because both 386BSD and BSD/386 use GNU ld.
# use_collect2=yes
;;
i[34567]86-apple-darwin) #macOS
xm_file=i386/xm-darwin.h
;;
i[34567]86-*-freebsdelf*)
tm_file="i386/i386.h i386/att.h linux.h i386/freebsd-elf.h i386/perform.h"
# On FreeBSD, the headers are already ok, except for math.h.
Expand Down
10 changes: 10 additions & 0 deletions libiberty/strerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,22 @@ 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



/*
Expand Down