summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordoko <doko@6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>2015-09-15 10:48:41 +0000
committerdoko <doko@6ca36cf4-e1d1-0310-8c6f-e303bb2178ca>2015-09-15 10:48:41 +0000
commitef040917e7da4ed3fe2c2662bb412ff7a676709b (patch)
treed6b9881ce9bf5bfba1d1ac99a0ffaec9ee34d176
parent7401c42d46e88f0d52da3e3aa8ccac56af89c2a4 (diff)
downloadgcc-5-ef040917e7da4ed3fe2c2662bb412ff7a676709b.tar.gz
* Work around PR c++/65913, link with -latomic when linking with -stdc++.
Closes: #797577. git-svn-id: svn://anonscm.debian.org/gcccvs/branches/sid/gcc-5@8227 6ca36cf4-e1d1-0310-8c6f-e303bb2178ca
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/pr65913-workaround-old.diff31
-rw-r--r--debian/patches/pr65913-workaround.diff34
-rw-r--r--debian/rules.patch6
4 files changed, 73 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 38466d5..579d6f2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
gcc-5 (5.2.1-18) UNRELEASED; urgency=medium
* gcc-5-plugin-dev: Depend on libmpc-dev. Closes: #798997.
+ * Work around PR c++/65913, link with -latomic when linking with -stdc++.
+ Closes: #797577.
-- Matthias Klose <doko@debian.org> Tue, 15 Sep 2015 08:38:50 +0200
diff --git a/debian/patches/pr65913-workaround-old.diff b/debian/patches/pr65913-workaround-old.diff
new file mode 100644
index 0000000..fca82ff
--- /dev/null
+++ b/debian/patches/pr65913-workaround-old.diff
@@ -0,0 +1,31 @@
+# DP: Work around PR c++/65913, link with -latomic (older than binutils 2.25)
+
+--- a/src/gcc/cp/g++spec.c
++++ b/src/gcc/cp/g++spec.c
+@@ -264,6 +264,8 @@
+
+ /* Add one for shared_libgcc or extra static library. */
+ num_args = argc + added + need_math + (library > 0) * 4 + 1;
++ /* Link libatomic. */
++ num_args += 2;
+ new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
+
+ i = 0;
+@@ -389,6 +391,17 @@
+ if (shared_libgcc && !static_link)
+ generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER,
+ &new_decoded_options[j++]);
++ if (library > 0)
++ {
++ /* Work around http://gcc.gnu.org/PR65913. */
++ generate_option (OPT_Wl_, "--as-needed", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ j++;
++ generate_option (OPT_l, "atomic", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ added_libraries++;
++ j++;
++ }
+
+ *in_decoded_options_count = j;
+ *in_decoded_options = new_decoded_options;
diff --git a/debian/patches/pr65913-workaround.diff b/debian/patches/pr65913-workaround.diff
new file mode 100644
index 0000000..dfa8efc
--- /dev/null
+++ b/debian/patches/pr65913-workaround.diff
@@ -0,0 +1,34 @@
+# DP: Work around PR c++/65913, link with -latomic
+
+--- a/src/gcc/cp/g++spec.c
++++ b/src/gcc/cp/g++spec.c
+@@ -264,6 +264,8 @@
+
+ /* Add one for shared_libgcc or extra static library. */
+ num_args = argc + added + need_math + (library > 0) * 4 + 1;
++ /* Link libatomic. */
++ num_args += 4;
+ new_decoded_options = XNEWVEC (struct cl_decoded_option, num_args);
+
+ i = 0;
+@@ -364,6 +366,20 @@
+ j++;
+ }
+ #endif
++ /* Work around http://gcc.gnu.org/PR65913. */
++ generate_option (OPT_Wl_, "--push-state", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ j++;
++ generate_option (OPT_Wl_, "--as-needed", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ j++;
++ generate_option (OPT_l, "atomic", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ added_libraries++;
++ j++;
++ generate_option (OPT_Wl_, "--pop-state", 1, CL_DRIVER,
++ &new_decoded_options[j]);
++ j++;
+ }
+ if (saw_math)
+ new_decoded_options[j++] = *saw_math;
diff --git a/debian/rules.patch b/debian/rules.patch
index d147709..03294a2 100644
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -91,6 +91,12 @@ debian_patches += \
pr67508 \
pr67143 \
+ifneq (,$(filter $(distrelease),squeeze wheezy dapper lucid precise quantal raring saucy trusty))
+ debian_patches += pr65913-workaround-old
+else
+ debian_patches += pr65913-workaround
+endif
+
ifeq ($(libstdcxx_abi),new)
debian_patches += libstdc++-functexcept
endif