Skip to contentSkip to conversation

package/gcc: fix xtensa uclinux code generation

PATCH New Max Filippov 3 participants 7 messages Nov 7, 2018 – Nov 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

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.

---
 ...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
package/gcc/6.4.0/0004-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch new file +41 -0
new file mode 100644
index 000000000000..360947cbb180
@@ -0,0 +1,41 @@
+From 960a2552f7b418134cdf7a31e96023a3811b98dd Mon Sep 17 00:00:00 2001
+From: Max Filippov <[email protected]>
+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  <[email protected]>
+
+	* config/xtensa/uclinux.h (XTENSA_ALWAYS_PIC): Change to 0.
+
+Signed-off-by: Max Filippov <[email protected]>
+---
+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
+
package/gcc/7.3.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch new file +41 -0

41 lines not on this page · raw message

package/gcc/8.2.0/0005-gcc-xtensa-don-t-force-PIC-for-uclinux-target.patch new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

Hello Max,

Quoted 7 lines · Max Filippov

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.

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

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

Hi Thomas,

Quoted 2 lines · Thomas Petazzoni

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.

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

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

Hello,

Quoted 7 lines · Max Filippov
Quoted 2 lines · Thomas Petazzoni

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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

Quoted 11 lines · Thomas Petazzoni
Quoted 7 lines · Max Filippov
Quoted 2 lines · Thomas Petazzoni

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 (:

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

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

In reply to Max Filippov
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Max" == Max Filippov <[email protected]> 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.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/1 package/gcc: fix xtensa uclinux code generation

In reply to Max Filippov
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Max" == Max Filippov <[email protected]> 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.

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

Signature · 1 line
Bye, Peter Korsgaard