All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
@ 2018-11-07 21:20 Max Filippov
  2018-11-08 10:35 ` Thomas Petazzoni
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Max Filippov @ 2018-11-07 21:20 UTC (permalink / raw)
  To: buildroot

xtensa-uclinux uses bFLT executable file format that cannot relocate
fields representing offsets from data to code. C++ objects built as PIC
use offsets to encode FDE structures. As a result C++ exception handling
doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
xtensa-uclinux.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 ...xtensa-don-t-force-PIC-for-uclinux-target.patch | 41 ++++++++++++++++++++++
 ...xtensa-don-t-force-PIC-for-uclinux-target.patch | 41 ++++++++++++++++++++++
 ...xtensa-don-t-force-PIC-for-uclinux-target.patch | 41 ++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 package/gcc/6.4.0/0004-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
 create mode 100644 package/gcc/7.3.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
 create mode 100644 package/gcc/8.2.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch

diff --git a/package/gcc/6.4.0/0004-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch b/package/gcc/6.4.0/0004-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
new file mode 100644
index 000000000000..360947cbb180
--- /dev/null
+++ b/package/gcc/6.4.0/0004-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
@@ -0,0 +1,41 @@
+From 960a2552f7b418134cdf7a31e96023a3811b98dd Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 4 Nov 2018 23:55:59 -0800
+Subject: [PATCH] gcc: xtensa: don't force PIC for uclinux target
+
+xtensa-uclinux uses bFLT executable file format that cannot relocate
+fields representing offsets from data to code. C++ objects built as PIC
+use offsets to encode FDE structures. As a result C++ exception handling
+doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
+xtensa-uclinux.
+
+gcc/
+2018-11-05  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+Backported from: r265823
+
+ gcc/config/xtensa/uclinux.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
+index ba26187c8f7a..c7743df9d97c 100644
+--- a/gcc/config/xtensa/uclinux.h
++++ b/gcc/config/xtensa/uclinux.h
+@@ -59,8 +59,8 @@ along with GCC; see the file COPYING3.  If not see
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX	"."
+ 
+-/* Always enable "-fpic" for Xtensa Linux.  */
+-#define XTENSA_ALWAYS_PIC 1
++/* Don't enable "-fpic" for Xtensa uclinux.  */
++#define XTENSA_ALWAYS_PIC 0
+ 
+ #undef TARGET_LIBC_HAS_FUNCTION
+ #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+-- 
+2.11.0
+
diff --git a/package/gcc/7.3.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch b/package/gcc/7.3.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
new file mode 100644
index 000000000000..360947cbb180
--- /dev/null
+++ b/package/gcc/7.3.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
@@ -0,0 +1,41 @@
+From 960a2552f7b418134cdf7a31e96023a3811b98dd Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 4 Nov 2018 23:55:59 -0800
+Subject: [PATCH] gcc: xtensa: don't force PIC for uclinux target
+
+xtensa-uclinux uses bFLT executable file format that cannot relocate
+fields representing offsets from data to code. C++ objects built as PIC
+use offsets to encode FDE structures. As a result C++ exception handling
+doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
+xtensa-uclinux.
+
+gcc/
+2018-11-05  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+Backported from: r265823
+
+ gcc/config/xtensa/uclinux.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
+index ba26187c8f7a..c7743df9d97c 100644
+--- a/gcc/config/xtensa/uclinux.h
++++ b/gcc/config/xtensa/uclinux.h
+@@ -59,8 +59,8 @@ along with GCC; see the file COPYING3.  If not see
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX	"."
+ 
+-/* Always enable "-fpic" for Xtensa Linux.  */
+-#define XTENSA_ALWAYS_PIC 1
++/* Don't enable "-fpic" for Xtensa uclinux.  */
++#define XTENSA_ALWAYS_PIC 0
+ 
+ #undef TARGET_LIBC_HAS_FUNCTION
+ #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+-- 
+2.11.0
+
diff --git a/package/gcc/8.2.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch b/package/gcc/8.2.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
new file mode 100644
index 000000000000..360947cbb180
--- /dev/null
+++ b/package/gcc/8.2.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch
@@ -0,0 +1,41 @@
+From 960a2552f7b418134cdf7a31e96023a3811b98dd Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Sun, 4 Nov 2018 23:55:59 -0800
+Subject: [PATCH] gcc: xtensa: don't force PIC for uclinux target
+
+xtensa-uclinux uses bFLT executable file format that cannot relocate
+fields representing offsets from data to code. C++ objects built as PIC
+use offsets to encode FDE structures. As a result C++ exception handling
+doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
+xtensa-uclinux.
+
+gcc/
+2018-11-05  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+---
+Backported from: r265823
+
+ gcc/config/xtensa/uclinux.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/xtensa/uclinux.h b/gcc/config/xtensa/uclinux.h
+index ba26187c8f7a..c7743df9d97c 100644
+--- a/gcc/config/xtensa/uclinux.h
++++ b/gcc/config/xtensa/uclinux.h
+@@ -59,8 +59,8 @@ along with GCC; see the file COPYING3.  If not see
+ #undef LOCAL_LABEL_PREFIX
+ #define LOCAL_LABEL_PREFIX	"."
+ 
+-/* Always enable "-fpic" for Xtensa Linux.  */
+-#define XTENSA_ALWAYS_PIC 1
++/* Don't enable "-fpic" for Xtensa uclinux.  */
++#define XTENSA_ALWAYS_PIC 0
+ 
+ #undef TARGET_LIBC_HAS_FUNCTION
+ #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
+-- 
+2.11.0
+
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-07 21:20 [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation Max Filippov
@ 2018-11-08 10:35 ` Thomas Petazzoni
  2018-11-08 18:28   ` Max Filippov
  2018-11-09 14:51 ` Peter Korsgaard
  2018-11-25 21:31 ` Peter Korsgaard
  2 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-08 10:35 UTC (permalink / raw)
  To: buildroot

Hello Max,

On Wed,  7 Nov 2018 13:20:50 -0800, Max Filippov wrote:
> xtensa-uclinux uses bFLT executable file format that cannot relocate
> fields representing offsets from data to code. C++ objects built as PIC
> use offsets to encode FDE structures. As a result C++ exception handling
> doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
> xtensa-uclinux.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Do we actually support xtensa-uclinux (i.e noMMU Xtensa with BFLT) in
the context of Buildroot ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-08 10:35 ` Thomas Petazzoni
@ 2018-11-08 18:28   ` Max Filippov
  2018-11-08 19:51     ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Max Filippov @ 2018-11-08 18:28 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On Thu, Nov 8, 2018 at 2:35 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> Do we actually support xtensa-uclinux (i.e noMMU Xtensa with BFLT) in
> the context of Buildroot ?

We do. There's even configs/qemu_xtensa_lx60_nommu_defconfig
with an example config that builds working image.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-08 18:28   ` Max Filippov
@ 2018-11-08 19:51     ` Thomas Petazzoni
  2018-11-08 20:17       ` Max Filippov
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2018-11-08 19:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 8 Nov 2018 10:28:01 -0800, Max Filippov wrote:

> On Thu, Nov 8, 2018 at 2:35 AM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> > Do we actually support xtensa-uclinux (i.e noMMU Xtensa with BFLT) in
> > the context of Buildroot ?  
> 
> We do. There's even configs/qemu_xtensa_lx60_nommu_defconfig
> with an example config that builds working image.

Ah, forgot about this! Nice. Perhaps we should be testing this in the
autobuilders ?

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-08 19:51     ` Thomas Petazzoni
@ 2018-11-08 20:17       ` Max Filippov
  0 siblings, 0 replies; 7+ messages in thread
From: Max Filippov @ 2018-11-08 20:17 UTC (permalink / raw)
  To: buildroot

On Thu, Nov 8, 2018 at 11:51 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> On Thu, 8 Nov 2018 10:28:01 -0800, Max Filippov wrote:
> > On Thu, Nov 8, 2018 at 2:35 AM Thomas Petazzoni
> > <thomas.petazzoni@bootlin.com> wrote:
> > > Do we actually support xtensa-uclinux (i.e noMMU Xtensa with BFLT) in
> > > the context of Buildroot ?
> >
> > We do. There's even configs/qemu_xtensa_lx60_nommu_defconfig
> > with an example config that builds working image.
>
> Ah, forgot about this! Nice. Perhaps we should be testing this in the
> autobuilders ?

I will definitely support that (:

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-07 21:20 [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation Max Filippov
  2018-11-08 10:35 ` Thomas Petazzoni
@ 2018-11-09 14:51 ` Peter Korsgaard
  2018-11-25 21:31 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-11-09 14:51 UTC (permalink / raw)
  To: buildroot

>>>>> "Max" == Max Filippov <jcmvbkbc@gmail.com> writes:

 > xtensa-uclinux uses bFLT executable file format that cannot relocate
 > fields representing offsets from data to code. C++ objects built as PIC
 > use offsets to encode FDE structures. As a result C++ exception handling
 > doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
 > xtensa-uclinux.

 > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation
  2018-11-07 21:20 [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation Max Filippov
  2018-11-08 10:35 ` Thomas Petazzoni
  2018-11-09 14:51 ` Peter Korsgaard
@ 2018-11-25 21:31 ` Peter Korsgaard
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2018-11-25 21:31 UTC (permalink / raw)
  To: buildroot

>>>>> "Max" == Max Filippov <jcmvbkbc@gmail.com> writes:

 > xtensa-uclinux uses bFLT executable file format that cannot relocate
 > fields representing offsets from data to code. C++ objects built as PIC
 > use offsets to encode FDE structures. As a result C++ exception handling
 > doesn't work correctly on xtensa-uclinux. Don't use PIC by default on
 > xtensa-uclinux.

 > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

Committed to 2018.02.x (minus the 8.2.0 patch) and 2018.08.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-25 21:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 21:20 [Buildroot] [PATCH] package/gcc: fix xtensa uclinux code generation Max Filippov
2018-11-08 10:35 ` Thomas Petazzoni
2018-11-08 18:28   ` Max Filippov
2018-11-08 19:51     ` Thomas Petazzoni
2018-11-08 20:17       ` Max Filippov
2018-11-09 14:51 ` Peter Korsgaard
2018-11-25 21:31 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.