Merge pull request #271787 from reckenrode/gcc-cross-fix

gcc: Darwin cross-compiler build fixes
This commit is contained in:
Emily Trau 2023-12-03 19:53:55 +11:00 committed by GitHub
commit 3ff9ed03fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 25 deletions

View File

@ -392,7 +392,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
EXTRA_LDFLAGS_FOR_TARGET
;
} // optionalAttrs is7 {
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"
# Downgrade register storage class specifier errors to warnings when building a cross compiler from a clang stdenv.
+ lib.optionalString (stdenv.cc.isClang && targetPlatform != hostPlatform) " -Wno-register";
} // optionalAttrs (!is7 && !atLeast12 && stdenv.cc.isClang && targetPlatform != hostPlatform) {
NIX_CFLAGS_COMPILE = "-Wno-register";
} // optionalAttrs (!atLeast7) {
inherit langJava;
} // optionalAttrs atLeast6 {
@ -420,8 +424,10 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
;
} // lib.optionalAttrs (!atLeast11) {
badPlatforms = if !(is48 || is49) then [ "aarch64-darwin" ] else lib.platforms.darwin;
} // lib.optionalAttrs is11 {
badPlatforms = if targetPlatform != hostPlatform then [ "aarch64-darwin" ] else [ ];
};
} // lib.optionalAttrs (!atLeast10 && stdenv.hostPlatform.isDarwin) {
} // lib.optionalAttrs (!atLeast10 && stdenv.targetPlatform.isDarwin) {
# GCC <10 requires default cctools `strip` instead of `llvm-strip` used by Darwin bintools.
preBuild = ''
makeFlagsArray+=('STRIP=${lib.getBin darwin.cctools-port}/bin/${stdenv.cc.targetPrefix}strip')

View File

@ -1,20 +0,0 @@
--- a/gcc/config/avr/avr.c 2022-10-08 19:18:33.000000000 +0200
+++ b/gcc/config/avr/avr.patched.c 2022-10-08 19:19:34.000000000 +0200
@@ -10196,7 +10196,7 @@
to track need of __do_copy_data. */
static void
-avr_output_data_section_asm_op (const void *data)
+avr_output_data_section_asm_op (const char *data)
{
avr_need_copy_data_p = true;
@@ -10209,7 +10209,7 @@
to track need of __do_clear_bss. */
static void
-avr_output_bss_section_asm_op (const void *data)
+avr_output_bss_section_asm_op (const char *data)
{
avr_need_clear_bss_p = true;

View File

@ -175,9 +175,6 @@ in
## gcc 11.0 and older ##############################################################################
# https://github.com/osx-cross/homebrew-avr/issues/280#issuecomment-1272381808
++ optional (is11 && stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch
# libgccs `configure` script misdetects aarch64-darwin, resulting in an invalid deployment target.
++ optional (is11 && stdenv.isDarwin && stdenv.isAarch64) ./11/libgcc-aarch64-darwin-detection.patch