gcc: fix #12836: build on darwin

Patch is based on GCC Bug 66523:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66523

authored by Josef Knedl and committed by Vladimír Čunát 0fe58cad 31ab7d38

+32 -3
+4 -2
pkgs/development/compilers/gcc/4.9/default.nix
··· 71 71 # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its 72 72 # target libraries and tools. 73 73 ++ optional langAda ../gnat-cflags.patch 74 - ++ optional langFortran ../gfortran-driving.patch; 75 - 74 + ++ optional langFortran ../gfortran-driving.patch 75 + # The NXConstStr.patch can be removed at 4.9.4 76 + ++ optional stdenv.isDarwin ../gfortran-darwin-NXConstStr.patch; 77 + 76 78 javaEcj = fetchurl { 77 79 # The `$(top_srcdir)/ecj.jar' file is automatically picked up at 78 80 # `configure' time.
+1 -1
pkgs/development/compilers/gcc/builder.sh
··· 24 24 # Figure out what extra flags to pass to the gcc compilers 25 25 # being generated to make sure that they use our glibc. 26 26 extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)" 27 - extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)" 27 + extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before || true)" 28 28 29 29 # Use *real* header files, otherwise a limits.h is generated 30 30 # that does not include Glibc's limits.h (notably missing
+27
pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch
··· 1 + From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001 2 + From: Iain Sandoe <iain@codesourcery.com> 3 + Date: Sat, 21 Dec 2013 00:30:18 +0000 4 + Subject: [PATCH] don't try to mark local symbols as no-dead-strip 5 + 6 + --- 7 + gcc/config/darwin.c | 5 +++++ 8 + 1 file changed, 5 insertions(+) 9 + 10 + diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c 11 + index 40804b8..0080299 100644 12 + --- a/gcc/config/darwin.c 13 + +++ b/gcc/config/darwin.c 14 + @@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED) 15 + void 16 + darwin_mark_decl_preserved (const char *name) 17 + { 18 + + /* Actually we shouldn't mark any local symbol this way, but for now 19 + + this only happens with ObjC meta-data. */ 20 + + if (darwin_label_is_anonymous_local_objc_name (name)) 21 + + return; 22 + + 23 + fprintf (asm_out_file, "\t.no_dead_strip "); 24 + assemble_name (asm_out_file, name); 25 + fputc ('\n', asm_out_file); 26 + -- 27 + 2.2.1