aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2016-09-27 21:56:32 +1000
committerNathan Rossi <nathan@nathanrossi.com>2016-10-11 21:10:52 +1000
commitd904dafd51dd0f1ec2264b8dbcb7b637b4c5b11a (patch)
tree04de69bd64899287548b3eac66f8aa9a8b4f1fb6
parent59e716bc054d2ca2f3ad138f6fa9043e985e6f3c (diff)
downloadmeta-xilinx-d904dafd51dd0f1ec2264b8dbcb7b637b4c5b11a.tar.gz
meta-xilinx-d904dafd51dd0f1ec2264b8dbcb7b637b4c5b11a.tar.bz2
meta-xilinx-d904dafd51dd0f1ec2264b8dbcb7b637b4c5b11a.zip
gcc-source: Add patch to fix MicroBlaze ABI bug
Add a patch which fixes a bug in GCC regarding the usage of the r20 and r21 registers specifically for the use in Linux. Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
-rw-r--r--recipes-microblaze/gcc/files/gcc-config-microblaze-Make-r21-fixed-due-to-Linux-AB.patch48
-rw-r--r--recipes-microblaze/gcc/gcc-source_6.%.bbappend1
2 files changed, 49 insertions, 0 deletions
diff --git a/recipes-microblaze/gcc/files/gcc-config-microblaze-Make-r21-fixed-due-to-Linux-AB.patch b/recipes-microblaze/gcc/files/gcc-config-microblaze-Make-r21-fixed-due-to-Linux-AB.patch
new file mode 100644
index 00000000..373b158a
--- /dev/null
+++ b/recipes-microblaze/gcc/files/gcc-config-microblaze-Make-r21-fixed-due-to-Linux-AB.patch
@@ -0,0 +1,48 @@
+From 3a73b9abccefa81cdee4cdf28f8b3b8fb0ed6c6e Mon Sep 17 00:00:00 2001
+From: Nathan Rossi <nathan@nathanrossi.com>
+Date: Tue, 27 Sep 2016 04:14:50 +1000
+Subject: [PATCH] gcc/config/microblaze: Make r21 fixed due to Linux ABI
+
+Commit 6dcad60c0ef48af584395a40feeb256fb82986a8 introduced a change to
+how the r20 and r21 registers are handled for MicroBlaze. Specifically
+removing the fixed nature of the r21 register.
+
+In the Linux ABI the r21 register is reserved as a fixed register for
+the purposes of storing a pointer to the thread related object. This is
+of particular importance for libc (glibc and musl) which use this
+register and expect it to be fixed for this purpose.
+
+GCC uses the r20 register for GOT pointing. This commit mentioned above
+confusingly states it preserved the fixed nature but in fact changes r20
+to be non-fixed. This patch fixes that up.
+
+Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
+Upstream-Status: Pending
+---
+ gcc/config/microblaze/microblaze.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
+index dbfb6522c7..e115c42839 100644
+--- a/gcc/config/microblaze/microblaze.h
++++ b/gcc/config/microblaze/microblaze.h
+@@ -253,14 +253,14 @@ extern enum pipeline_type microblaze_pipe;
+ #define FIXED_REGISTERS \
+ { \
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, \
+- 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
++ 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ 1, 1, 1, 1 \
+ }
+
+ #define CALL_USED_REGISTERS \
+ { \
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
+- 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
++ 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+ 1, 1, 1, 1 \
+ }
+ #define GP_REG_FIRST 0
+--
+2.9.3
+
diff --git a/recipes-microblaze/gcc/gcc-source_6.%.bbappend b/recipes-microblaze/gcc/gcc-source_6.%.bbappend
index 50075f0d..76b4f60c 100644
--- a/recipes-microblaze/gcc/gcc-source_6.%.bbappend
+++ b/recipes-microblaze/gcc/gcc-source_6.%.bbappend
@@ -3,5 +3,6 @@
FILESEXTRAPATHS_append := "${THISDIR}/files:"
SRC_URI_append = " \
file://microblaze.md-Improve-adddi3-and-subdi3-insn-definit.patch \
+ file://gcc-config-microblaze-Make-r21-fixed-due-to-Linux-AB.patch \
"