Skip to content

Commit

Permalink
Merge pull request #271919 from emilytrau/avr-gcc8-aarch64-darwin
Browse files Browse the repository at this point in the history
gcc8: support avr cross compilation on aarch64-darwin, qmk aarch64-darwin support pt. 1
  • Loading branch information
Mindavi authored Dec 8, 2023
2 parents f2aef2c + f6e48ac commit 87e5690
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkgs/development/compilers/gcc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
, buildPackages
, pkgsBuildTarget
, libxcrypt
, disableGdbPlugin ? !enablePlugin
, disableGdbPlugin ? !enablePlugin || (stdenv.targetPlatform.isAvr && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
, nukeReferences
, callPackage
, majorMinorVersion
Expand Down Expand Up @@ -423,7 +423,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
maintainers
;
} // lib.optionalAttrs (!atLeast11) {
badPlatforms = if !(is48 || is49) then [ "aarch64-darwin" ] else lib.platforms.darwin;
badPlatforms =
# avr-gcc8 is maintained for the `qmk` package
if (is8 && targetPlatform.isAvr) then []
else if !(is48 || is49) then [ "aarch64-darwin" ]
else lib.platforms.darwin;
} // lib.optionalAttrs is11 {
badPlatforms = if targetPlatform != hostPlatform then [ "aarch64-darwin" ] else [ ];
};
Expand Down
16 changes: 16 additions & 0 deletions pkgs/development/compilers/gcc/patches/8/avr-gcc-8-darwin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
From https://gist.githubusercontent.com/DavidEGrayson/88bceb3f4e62f45725ecbb9248366300/raw/c1f515475aff1e1e3985569d9b715edb0f317648/gcc-11-arm-darwin.patch

diff -ur a/gcc/config/host-darwin.c b/gcc/config/host-darwin.c
--- a/gcc/config/host-darwin.c 2021-04-27 03:00:13.000000000 -0700
+++ b/gcc/config/host-darwin.c 2021-06-11 14:49:13.754000000 -0700
@@ -22,6 +22,10 @@
#include "coretypes.h"
#include "diagnostic-core.h"
#include "config/host-darwin.h"
+#include "hosthooks.h"
+#include "hosthooks-def.h"
+
+const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;

/* Yes, this is really supposed to work. */
/* This allows for a pagesize of 16384, which we have on Darwin20, but should
5 changes: 5 additions & 0 deletions pkgs/development/compilers/gcc/patches/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ in
# which is not supported by the clang integrated assembler used by default on Darwin.
++ optional (is8 && hostPlatform.isDarwin) ./8/gcc8-darwin-as-gstabs.patch

# Make avr-gcc8 build on aarch64-darwin
# avr-gcc8 is maintained for the `qmk` package
# https://github.com/osx-cross/homebrew-avr/blob/main/Formula/avr-gcc%408.rb#L69
++ optional (is8 && targetPlatform.isAvr && hostPlatform.isDarwin && hostPlatform.isAarch64) ./8/avr-gcc-8-darwin.patch


## gcc 7.0 and older ##############################################################################

Expand Down

0 comments on commit 87e5690

Please sign in to comment.