From d8dfcf0ed203881ba6835f8c593b301d01b34637 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Mon, 7 Oct 2019 18:10:04 +0200 Subject: or1k: use upstream binutils/gcc --- toolchain/binutils/patches/2.32/or1k.patch | 17 +++++++++ toolchain/gcc/Makefile.inc | 8 ---- toolchain/gcc/patches/9.2.0/or1k.patch | 61 ++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 toolchain/binutils/patches/2.32/or1k.patch create mode 100644 toolchain/gcc/patches/9.2.0/or1k.patch (limited to 'toolchain') diff --git a/toolchain/binutils/patches/2.32/or1k.patch b/toolchain/binutils/patches/2.32/or1k.patch new file mode 100644 index 000000000..dcb5f467b --- /dev/null +++ b/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; diff --git a/toolchain/gcc/Makefile.inc b/toolchain/gcc/Makefile.inc index cf5546831..409fd2daa 100644 --- a/toolchain/gcc/Makefile.inc +++ b/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 diff --git a/toolchain/gcc/patches/9.2.0/or1k.patch b/toolchain/gcc/patches/9.2.0/or1k.patch new file mode 100644 index 000000000..8ec5ec956 --- /dev/null +++ b/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))] + "" -- cgit v1.2.3