Skip to contentSkip to conversation

gcc: preserve CXXFLAGS_FOR_TARGET

PATCH Superseded Max Filippov 3 participants 9 messages Mar 11, 2016 – Mar 13, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover gcc: preserve CXXFLAGS_FOR_TARGET

Hello,

this series backports gcc fix that preserves CXXFLAGS_FOR_TARGET and reverts related xtensa-specific workaround. See discussion at
https://patchwork.ozlabs.org/patch/479074/

Max Filippov (2):
gcc: preserve CXXFLAGS_FOR_TARGET
Revert "gcc/gcc-final: pass TARGET_ABI flags to configure with

    --enable-cxx-flags"
 package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
 package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++
 package/gcc/gcc-final/gcc-final.mk  |  4 ----
 3 files changed, 50 insertions(+), 4 deletions(-)
 create mode 100644 package/gcc/4.8.5/130-pr43538.patch
 create mode 100644 package/gcc/4.9.3/130-pr43538.patch
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 gcc: preserve CXXFLAGS_FOR_TARGET

gcc-4.8.x and gcc-4.9.x don't propagate CXXFLAGS_FOR_TARGET to CXXFLAGS for libstdc++ build. As a result libstdc++ is built without TARGET_CFLAGS and may fail to link with applications using it, see e.g.

http://autobuild.buildroot.net/results/81a3bca5cbcf789c7ce1aa221a6a4154dd7c3917/

Instead of passing TARGET_ABI or TARGET_CFLAGS for libstdc++ in --enable-cxx-flags parameter backport the patch that fixes propagation of CXXFLAGS_FOR_TARGET to CXXFLAGS.

---
 package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
 package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 package/gcc/4.8.5/130-pr43538.patch
 create mode 100644 package/gcc/4.9.3/130-pr43538.patch
package/gcc/4.8.5/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+-- 
+2.1.4
+
package/gcc/4.9.3/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+-- 
+2.1.4
+
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/2 gcc: preserve CXXFLAGS_FOR_TARGET

Quoted 1 line · Max Filippov

gcc-4.8.x and gcc-4.9.x don't propagate CXXFLAGS_FOR_TARGET to CXXFLAGS

It would have been good to mention explicitly that it's not done for
deprecated gcc-4.7.x and that it's already fixed in gcc-5.x.

Quoted 10 lines

for libstdc++ build. As a result libstdc++ is built without TARGET_CFLAGS and may fail to link with applications using it, see e.g.

   http://autobuild.buildroot.net/results/81a3bca5cbcf789c7ce1aa221a6a4154dd7c3917/

Instead of passing TARGET_ABI or TARGET_CFLAGS for libstdc++ in --enable-cxx-flags parameter backport the patch that fixes propagation of CXXFLAGS_FOR_TARGET to CXXFLAGS.

Quoted 70 lines
---
  package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
  package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++
  2 files changed, 50 insertions(+)

create mode 100644 package/gcc/4.8.5/130-pr43538.patch create mode 100644 package/gcc/4.9.3/130-pr43538.patch

package/gcc/4.8.5/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+--
+2.1.4
+
package/gcc/4.9.3/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+--
+2.1.4
+
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/2 gcc: preserve CXXFLAGS_FOR_TARGET

In reply to Max Filippov

Max, All,

On 2016-03-11 03:45 +0300, Max Filippov spake thusly:

Quoted 6 lines

gcc-4.8.x and gcc-4.9.x don't propagate CXXFLAGS_FOR_TARGET to CXXFLAGS for libstdc++ build. As a result libstdc++ is built without TARGET_CFLAGS and may fail to link with applications using it, see e.g.

http://autobuild.buildroot.net/results/81a3bca5cbcf789c7ce1aa221a6a4154dd7c3917/

Quoted 8 lines

Instead of passing TARGET_ABI or TARGET_CFLAGS for libstdc++ in --enable-cxx-flags parameter backport the patch that fixes propagation of CXXFLAGS_FOR_TARGET to CXXFLAGS.

---
 package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
 package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++

As already noticed by Arnout, this is not done for gcc-4.7. Is it because it is not affected by the issue, or because upstream has not fixed it?

Is the latter case, we'd still have the issue for gcc-4.7, no? Or do we not care about it any more (I don't, TBH...)?

Regards,
Yann E. MORIN.

Quoted 69 lines
 2 files changed, 50 insertions(+)
 create mode 100644 package/gcc/4.8.5/130-pr43538.patch
 create mode 100644 package/gcc/4.9.3/130-pr43538.patch
package/gcc/4.8.5/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+-- 
+2.1.4
+
package/gcc/4.9.3/130-pr43538.patch new file +25 -0
new file mode 100644
index 0000000..19e57bb
@@ -0,0 +1,25 @@
+From c037df1be41f8daf4d581d7ffa4ec8cfa640bccf Mon Sep 17 00:00:00 2001
+From: glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 25 Apr 2014 08:03:08 +0000
+Subject: [PATCH] 2014-04-25  Marc Glisse  <[email protected]>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk at 209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <[email protected]>
+---
+ config/mt-gnu    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/config/mt-gnu b/config/mt-gnu
+index 15bf417..5c696f5 100644
+--- a/config/mt-gnu
++++ b/config/mt-gnu
+@@ -1 +1 @@
+-CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE
++CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE
+-- 
+2.1.4
+
Signature · 1 line
2.1.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/2 gcc: preserve CXXFLAGS_FOR_TARGET

Hi Yann,

Quoted 11 lines · Yann E. MORIN

On 2016-03-11 03:45 +0300, Max Filippov spake thusly:

Quoted 10 lines

gcc-4.8.x and gcc-4.9.x don't propagate CXXFLAGS_FOR_TARGET to CXXFLAGS for libstdc++ build. As a result libstdc++ is built without TARGET_CFLAGS and may fail to link with applications using it, see e.g.

http://autobuild.buildroot.net/results/81a3bca5cbcf789c7ce1aa221a6a4154dd7c3917/

Instead of passing TARGET_ABI or TARGET_CFLAGS for libstdc++ in --enable-cxx-flags parameter backport the patch that fixes propagation of CXXFLAGS_FOR_TARGET to CXXFLAGS.

Quoted 8 lines
Quoted 4 lines
---
 package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
 package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++

As already noticed by Arnout, this is not done for gcc-4.7. Is it because it is not affected by the issue, or because upstream has not fixed it?

It's me not seeing 4.7.x in the menuconfig list. Yes, 4.7.x is affected too. I'll send a new version with backport to 4.7.x.

Quoted 4 lines

Is the latter case, we'd still have the issue for gcc-4.7, no? Or do we not care about it any more (I don't, TBH...)?

Signature · 2 lines
Thanks.
-- Max
#5 lore raw

PATCH 1/2 gcc: preserve CXXFLAGS_FOR_TARGET

Quoted 19 lines · Max Filippov

Hi Yann,

Quoted 16 lines · Yann E. MORIN

On 2016-03-11 03:45 +0300, Max Filippov spake thusly:

Quoted 14 lines

gcc-4.8.x and gcc-4.9.x don't propagate CXXFLAGS_FOR_TARGET to CXXFLAGS for libstdc++ build. As a result libstdc++ is built without TARGET_CFLAGS and may fail to link with applications using it, see e.g.

   http://autobuild.buildroot.net/results/81a3bca5cbcf789c7ce1aa221a6a4154dd7c3917/

Instead of passing TARGET_ABI or TARGET_CFLAGS for libstdc++ in --enable-cxx-flags parameter backport the patch that fixes propagation of CXXFLAGS_FOR_TARGET to CXXFLAGS.

---
  package/gcc/4.8.5/130-pr43538.patch | 25 +++++++++++++++++++++++++
  package/gcc/4.9.3/130-pr43538.patch | 25 +++++++++++++++++++++++++
Quoted 6 lines
Quoted 3 lines

As already noticed by Arnout, this is not done for gcc-4.7. Is it because it is not affected by the issue, or because upstream has not fixed it?

It's me not seeing 4.7.x in the menuconfig list. Yes, 4.7.x is affected too. I'll send a new version with backport to 4.7.x.

Since 4.7 is deprecated, I don't think there is a need to add a patch for it.
So my Reviewed-by stands.

Regards,
Arnout

Quoted 6 lines
Quoted 5 lines

Is the latter case, we'd still have the issue for gcc-4.7, no? Or do we not care about it any more (I don't, TBH...)?

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#6 lore raw

PATCH 2/2 Revert "gcc/gcc-final: pass TARGET_ABI flags to configure with --enable-cxx-flags"

In reply to Max Filippov

This reverts commit 2dcab526a97d1dbcb73c3cd578e5bf2853853a10.

Now that gcc correctly propagates CXXFLAGS_FOR_TARGET for libstdc++ build this is no longer needed.

---
 package/gcc/gcc-final/gcc-final.mk | 4 ----
 1 file changed, 4 deletions(-)
package/gcc/gcc-final/gcc-final.mk +0 -4
index dbdb615..69fdc0c 100644
@@ -195,8 +195,4 @@ endef
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_USR_LIBS
 endif
 
-ifeq ($(BR2_xtensa),y)
-HOST_GCC_FINAL_CONF_OPTS += --enable-cxx-flags="$(TARGET_ABI)"
-endif
-
 $(eval $(host-autotools-package))
Signature · 1 line
2.1.4
#7 lore raw

PATCH 2/2 Revert "gcc/gcc-final: pass TARGET_ABI flags to configure with --enable-cxx-flags"

Quoted 6 lines · Max Filippov

This reverts commit 2dcab526a97d1dbcb73c3cd578e5bf2853853a10.

Now that gcc correctly propagates CXXFLAGS_FOR_TARGET for libstdc++ build this is no longer needed.

Regards,
Arnout

Quoted 18 lines
---
  package/gcc/gcc-final/gcc-final.mk | 4 ----
  1 file changed, 4 deletions(-)
package/gcc/gcc-final/gcc-final.mk +0 -4
index dbdb615..69fdc0c 100644
@@ -195,8 +195,4 @@ endef
  HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_USR_LIBS
  endif
 
-ifeq ($(BR2_xtensa),y)
-HOST_GCC_FINAL_CONF_OPTS += --enable-cxx-flags="$(TARGET_ABI)"
-endif
-
  $(eval $(host-autotools-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#8 lore raw

PATCH 2/2 Revert "gcc/gcc-final: pass TARGET_ABI flags to configure with --enable-cxx-flags"

In reply to Max Filippov

Max, All,

On 2016-03-11 03:45 +0300, Max Filippov spake thusly:

Quoted 6 lines

This reverts commit 2dcab526a97d1dbcb73c3cd578e5bf2853853a10.

Now that gcc correctly propagates CXXFLAGS_FOR_TARGET for libstdc++ build this is no longer needed.

Regards,
Yann E. MORIN.

Quoted 20 lines
---
 package/gcc/gcc-final/gcc-final.mk | 4 ----
 1 file changed, 4 deletions(-)
package/gcc/gcc-final/gcc-final.mk +0 -4
index dbdb615..69fdc0c 100644
@@ -195,8 +195,4 @@ endef
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_FINAL_INSTALL_USR_LIBS
 endif
 
-ifeq ($(BR2_xtensa),y)
-HOST_GCC_FINAL_CONF_OPTS += --enable-cxx-flags="$(TARGET_ABI)"
-endif
-
 $(eval $(host-autotools-package))
Signature · 1 line
2.1.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'