Browse Source

or1k: use upstream binutils/gcc

Waldemar Brodkorb 4 years ago
parent
commit
d8dfcf0ed2

+ 0 - 6
target/config/Config.in.compiler

@@ -33,7 +33,6 @@ default ADK_TOOLCHAIN_GCC_ARC if ADK_TARGET_ARCH_ARC
 default ADK_TOOLCHAIN_GCC_AVR32 if ADK_TARGET_ARCH_AVR32
 default ADK_TOOLCHAIN_GCC_METAG if ADK_TARGET_ARCH_METAG
 default ADK_TOOLCHAIN_GCC_NDS32 if ADK_TARGET_ARCH_NDS32
-default ADK_TOOLCHAIN_GCC_OR1K if ADK_TARGET_ARCH_OR1K
 default ADK_TOOLCHAIN_GCC_8
 
 config ADK_TOOLCHAIN_GCC_GIT
@@ -41,7 +40,6 @@ config ADK_TOOLCHAIN_GCC_GIT
 	depends on !ADK_TARGET_ARCH_AVR32
 	depends on !ADK_TARGET_ARCH_METAG
 	depends on !ADK_TARGET_ARCH_NDS32
-	depends on !ADK_TARGET_ARCH_OR1K
 
 config ADK_TOOLCHAIN_GCC_9
 	bool "9.2.0"
@@ -84,8 +82,4 @@ config ADK_TOOLCHAIN_GCC_NDS32
 	bool "nds32-6.3.0-open"
 	depends on ADK_TARGET_ARCH_NDS32
 
-config ADK_TOOLCHAIN_GCC_OR1K
-	bool "5.4.0-or1k"
-	depends on ADK_TARGET_ARCH_OR1K
-
 endchoice

+ 17 - 0
toolchain/binutils/patches/2.32/or1k.patch

@@ -0,0 +1,17 @@
+diff -Nur binutils-2.32.orig/bfd/elf32-or1k.c binutils-2.32/bfd/elf32-or1k.c
+--- binutils-2.32.orig/bfd/elf32-or1k.c	2019-01-19 17:01:33.000000000 +0100
++++ binutils-2.32/bfd/elf32-or1k.c	2019-10-06 04:55:05.439891597 +0200
+@@ -2379,8 +2379,11 @@
+       or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
+ 			    plt0, plt1, plt2, OR1K_JR(12));
+ 
+-      /* Fill in the entry in the global offset table.  */
+-      bfd_put_32 (output_bfd, plt_addr, sgot->contents + got_offset);
++      /* Fill in the entry in the global offset table.  We initialize it to
++	point to the top of the plt.  This is done to lazy lookup the actual
++	symbol as the first plt entry will be setup by libc to call the
++	runtime dynamic linker.  */
++      bfd_put_32 (output_bfd, plt_base_addr, sgot->contents + got_offset);
+ 
+       /* Fill in the entry in the .rela.plt section.  */
+       rela.r_offset = got_addr;

+ 0 - 8
toolchain/gcc/Makefile.inc

@@ -56,14 +56,6 @@ PKG_SITES:=		https://github.com/andestech/gcc.git
 PKG_RELEASE:=		1
 DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
 endif
-ifeq ($(ADK_TOOLCHAIN_GCC_OR1K),y)
-PKG_VERSION:=		musl-5.4.0
-PKG_GIT:=		branch
-PKG_SITES:=		https://github.com/openrisc/or1k-gcc.git
-PKG_RELEASE:=		1
-DISTFILES:=		${PKG_NAME}-${PKG_VERSION}.tar.xz
-LIBSTDCXXVER:=		21
-endif
 ifeq ($(ADK_TOOLCHAIN_GCC_GIT),y)
 PKG_VERSION:=		git
 PKG_SITES:=		https://github.com/gcc-mirror/gcc.git

+ 61 - 0
toolchain/gcc/patches/9.2.0/or1k.patch

@@ -0,0 +1,61 @@
+diff -Nur gcc-9.2.0.orig/gcc/config/or1k/constraints.md gcc-9.2.0/gcc/config/or1k/constraints.md
+--- gcc-9.2.0.orig/gcc/config/or1k/constraints.md	2019-01-01 13:31:55.000000000 +0100
++++ gcc-9.2.0/gcc/config/or1k/constraints.md	2019-10-07 10:59:48.995389485 +0200
+@@ -32,6 +32,9 @@
+ (define_register_constraint "c" "SIBCALL_REGS"
+   "Registers which can hold a sibling call address")
+ 
++(define_register_constraint "t" "GOT_REGS"
++  "Registers which can be used to store the Global Offset Table (GOT) address.")
++
+ ;; Immediates
+ (define_constraint "I"
+   "A signed 16-bit immediate in the range -32768 to 32767."
+diff -Nur gcc-9.2.0.orig/gcc/config/or1k/or1k.h gcc-9.2.0/gcc/config/or1k/or1k.h
+--- gcc-9.2.0.orig/gcc/config/or1k/or1k.h	2019-01-01 13:31:55.000000000 +0100
++++ gcc-9.2.0/gcc/config/or1k/or1k.h	2019-10-07 12:14:41.334692831 +0200
+@@ -189,6 +189,7 @@
+ {
+   NO_REGS,
+   SIBCALL_REGS,
++  GOT_REGS,
+   GENERAL_REGS,
+   FLAG_REGS,
+   ALL_REGS,
+@@ -200,6 +201,7 @@
+ #define REG_CLASS_NAMES {	\
+   "NO_REGS", 			\
+   "SIBCALL_REGS",		\
++  "GOT_REGS",			\
+   "GENERAL_REGS",		\
+   "FLAG_REGS",			\
+   "ALL_REGS" }
+@@ -212,6 +214,7 @@
+ #define REG_CLASS_CONTENTS      \
+ { { 0x00000000, 0x00000000 },	\
+   { SIBCALL_REGS_MASK,   0 },	\
++  { 0xfffffdff, 0x00000000 },	\
+   { 0xffffffff, 0x00000003 },	\
+   { 0x00000000, 0x00000004 },	\
+   { 0xffffffff, 0x00000007 }	\
+diff -Nur gcc-9.2.0.orig/gcc/config/or1k/or1k.md gcc-9.2.0/gcc/config/or1k/or1k.md
+--- gcc-9.2.0.orig/gcc/config/or1k/or1k.md	2019-01-01 13:31:55.000000000 +0100
++++ gcc-9.2.0/gcc/config/or1k/or1k.md	2019-10-07 10:59:48.999389485 +0200
+@@ -595,7 +595,7 @@
+ ;; set_got pattern below.  This works because the set_got_tmp insn is the
+ ;; first insn in the stream and that it isn't moved during RA.
+ (define_insn "set_got_tmp"
+-  [(set (match_operand:SI 0 "register_operand" "=r")
++  [(set (match_operand:SI 0 "register_operand" "=t")
+ 	(unspec_volatile:SI [(const_int 0)] UNSPECV_SET_GOT))]
+   ""
+ {
+@@ -604,7 +604,7 @@
+ 
+ ;; The insn to initialize the GOT.
+ (define_insn "set_got"
+-  [(set (match_operand:SI 0 "register_operand" "=r")
++  [(set (match_operand:SI 0 "register_operand" "=t")
+ 	(unspec:SI [(const_int 0)] UNSPEC_SET_GOT))
+    (clobber (reg:SI LR_REGNUM))]
+   ""