summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Knedl <josef.kemetmueller@aon.at>2016-02-13 18:39:49 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-02-17 09:42:10 +0100
commit0fe58cade5e90896dfafc49bd0c8cf89c5160fd3 (patch)
tree18483b074022c884ce915b215aaf9e49fbfc1f93
parent31ab7d38f23e556fd4e25508bed02455474b6c97 (diff)
gcc: fix #12836: build on darwin
Patch is based on GCC Bug 66523: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66523
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix6
-rw-r--r--pkgs/development/compilers/gcc/builder.sh2
-rw-r--r--pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch27
3 files changed, 32 insertions, 3 deletions
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index add9b30fb629..9e4823966cf3 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -71,8 +71,10 @@ let version = "4.9.3";
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ../gnat-cflags.patch
- ++ optional langFortran ../gfortran-driving.patch;
-
+ ++ optional langFortran ../gfortran-driving.patch
+ # The NXConstStr.patch can be removed at 4.9.4
+ ++ optional stdenv.isDarwin ../gfortran-darwin-NXConstStr.patch;
+
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
# `configure' time.
diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index dd77c67a023e..6d9e93138737 100644
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -24,7 +24,7 @@ if test "$noSysDirs" = "1"; then
# Figure out what extra flags to pass to the gcc compilers
# being generated to make sure that they use our glibc.
extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)"
- extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before)"
+ extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before || true)"
# Use *real* header files, otherwise a limits.h is generated
# that does not include Glibc's limits.h (notably missing
diff --git a/pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch b/pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch
new file mode 100644
index 000000000000..a7e158ca364b
--- /dev/null
+++ b/pkgs/development/compilers/gcc/gfortran-darwin-NXConstStr.patch
@@ -0,0 +1,27 @@
+From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@codesourcery.com>
+Date: Sat, 21 Dec 2013 00:30:18 +0000
+Subject: [PATCH] don't try to mark local symbols as no-dead-strip
+
+---
+ gcc/config/darwin.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
+index 40804b8..0080299 100644
+--- a/gcc/config/darwin.c
++++ b/gcc/config/darwin.c
+@@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
+ void
+ darwin_mark_decl_preserved (const char *name)
+ {
++ /* Actually we shouldn't mark any local symbol this way, but for now
++ this only happens with ObjC meta-data. */
++ if (darwin_label_is_anonymous_local_objc_name (name))
++ return;
++
+ fprintf (asm_out_file, "\t.no_dead_strip ");
+ assemble_name (asm_out_file, name);
+ fputc ('\n', asm_out_file);
+--
+2.2.1