Merge pull request #271919 from emilytrau/avr-gcc8-aarch64-darwin

gcc8: support avr cross compilation on aarch64-darwin, qmk aarch64-darwin support pt. 1
This commit is contained in:
Rick van Schijndel 2023-12-08 07:26:37 +01:00 committed by GitHub
commit 87e5690bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -29,7 +29,7 @@
, buildPackages
, pkgsBuildTarget
, libxcrypt
, disableGdbPlugin ? !enablePlugin
, disableGdbPlugin ? !enablePlugin || (stdenv.targetPlatform.isAvr && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
, nukeReferences
, callPackage
, majorMinorVersion
@ -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 [ ];
};

View File

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

View File

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