diff mbox

[1/2] gcc: preserve CXXFLAGS_FOR_TARGET

Message ID 1457657122-7283-2-git-send-email-jcmvbkbc@gmail.com
State Superseded
Headers show

Commit Message

Max Filippov March 11, 2016, 12:45 a.m. UTC
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.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 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

Comments

Arnout Vandecappelle March 12, 2016, 9:27 a.m. UTC | #1
On 03/11/16 01:45, Max Filippov wrote:
> 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.

> 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.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> ---
>   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
>
> diff --git a/package/gcc/4.8.5/130-pr43538.patch b/package/gcc/4.8.5/130-pr43538.patch
> new file mode 100644
> index 0000000..19e57bb
> --- /dev/null
> +++ b/package/gcc/4.8.5/130-pr43538.patch
> @@ -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  <marc.glisse@inria.fr>
> +
> +	PR target/43538
> +	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
> +
> +
> +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
> +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> +---
> + 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
> +
> diff --git a/package/gcc/4.9.3/130-pr43538.patch b/package/gcc/4.9.3/130-pr43538.patch
> new file mode 100644
> index 0000000..19e57bb
> --- /dev/null
> +++ b/package/gcc/4.9.3/130-pr43538.patch
> @@ -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  <marc.glisse@inria.fr>
> +
> +	PR target/43538
> +	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
> +
> +
> +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
> +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> +---
> + 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
> +
>
Yann E. MORIN March 12, 2016, 10:56 p.m. UTC | #2
Max, All,

On 2016-03-11 03:45 +0300, Max Filippov spake thusly:
> 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.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  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...)?

Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

>  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
> 
> diff --git a/package/gcc/4.8.5/130-pr43538.patch b/package/gcc/4.8.5/130-pr43538.patch
> new file mode 100644
> index 0000000..19e57bb
> --- /dev/null
> +++ b/package/gcc/4.8.5/130-pr43538.patch
> @@ -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  <marc.glisse@inria.fr>
> +
> +	PR target/43538
> +	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
> +
> +
> +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
> +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> +---
> + 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
> +
> diff --git a/package/gcc/4.9.3/130-pr43538.patch b/package/gcc/4.9.3/130-pr43538.patch
> new file mode 100644
> index 0000000..19e57bb
> --- /dev/null
> +++ b/package/gcc/4.9.3/130-pr43538.patch
> @@ -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  <marc.glisse@inria.fr>
> +
> +	PR target/43538
> +	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
> +
> +
> +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
> +Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> +---
> + 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
> +
> -- 
> 2.1.4
>
Max Filippov March 13, 2016, 3:18 a.m. UTC | #3
Hi Yann,

On Sun, Mar 13, 2016 at 1:56 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> On 2016-03-11 03:45 +0300, Max Filippov spake thusly:
>> 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.
>>
>> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>> ---
>>  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.

> 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...)?
>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Arnout Vandecappelle March 13, 2016, 10:23 p.m. UTC | #4
On 03/13/16 04:18, Max Filippov wrote:
> Hi Yann,
>
> On Sun, Mar 13, 2016 at 1:56 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
>> On 2016-03-11 03:45 +0300, Max Filippov spake thusly:
>>> 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.
>>>
>>> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
>>> ---
>>>   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.

  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

>
>> 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...)?
>>
>> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
diff mbox

Patch

diff --git a/package/gcc/4.8.5/130-pr43538.patch b/package/gcc/4.8.5/130-pr43538.patch
new file mode 100644
index 0000000..19e57bb
--- /dev/null
+++ b/package/gcc/4.8.5/130-pr43538.patch
@@ -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  <marc.glisse@inria.fr>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ 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
+
diff --git a/package/gcc/4.9.3/130-pr43538.patch b/package/gcc/4.9.3/130-pr43538.patch
new file mode 100644
index 0000000..19e57bb
--- /dev/null
+++ b/package/gcc/4.9.3/130-pr43538.patch
@@ -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  <marc.glisse@inria.fr>
+
+	PR target/43538
+	* mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209784 138bc75d-0d04-0410-961f-82ee72b054a4
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+ 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
+