Skip to contentSkip to conversation

Introduce ARC port of OpenEmbedded

PATCH Superseded Alexey Brodkin 2 participants 19 messages Sep 20, 2018 – Sep 21, 2018 Synopsys ARC architecture

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Introduce ARC port of OpenEmbedded

DesignWare ARC Processors are a family of 32-bit CPUs from Synopsys. This series introduces basic support for ARC architecture in OpenEmbedded.

As of today latest upstream GCC and Binutils are perfectly usable for building packages for ARC so we just need a couple of fixes.

Glibc for ARC is under review and we're working hard to get it accepted in the next upstream release. For now we'll use latest code-base back-ported on top of 2.28 release via meta-synopsys.

More platform and architecture specific bits could be found in meta-synopsys layer here (please refer to the "master" branch):
https://github.com/foss-for-synopsys-dwc-arc-processors/meta-synopsys

Changes v1 -> v2:
* Added upstream status for all patches
* Rebased on today's master

Alexey Brodkin (8):
siteinfo: Define data for ARC
kernel-arch.bbclass: Add ARC to kernel arch map
openssl: Add support for ARC
libgpg-error: Add ARC support
icu: Add ARC support
gcc: Disable libitm for ARC
binutils: Fix Glibc building for ARC
gcc: Fix specs generation for ARC

Antoine Tenart (1):
nspr: Add ARC support

 meta/classes/kernel-arch.bbclass                   |   1 +
 meta/classes/siteinfo.bbclass                      |   2 +
 .../openssl/openssl10_1.0.2p.bb                    |   2 +-
 meta/recipes-connectivity/openssl/openssl_1.1.1.bb |   2 +-
 meta/recipes-devtools/binutils/binutils-2.31.inc   |   4 +
 ...location-where-GOT-information-is-collect.patch | 201 ++++++++++++++
 ...bustness.-Return-FALSE-in-case-of-NULL-po.patch |  38 +++
 ...lobal-symbol-is-not-an-indirect-or-warnin.patch |  46 ++++
 ...tion-was-still-being-generated-when-symbo.patch |  40 +++
 meta/recipes-devtools/gcc/gcc-8.2.inc              |   1 +
 .../gcc/gcc-8.2/0041-ARC-fix-spec-gen.patch        |  44 +++
 meta/recipes-devtools/gcc/gcc-runtime.inc          |   1 +
 .../icu/icu/0002-Add-ARC-support.patch             |  27 ++
 meta/recipes-support/icu/icu_62.1.bb               |   1 +
 ...port-ARC-CPUs-and-simplify-aliasing-table.patch | 298 +++++++++++++++++++++
 .../libgpg-error/libgpg-error_1.32.bb              |   2 +
 .../nspr/nspr/0004-Add-ARC-support.patch           |  88 ++++++
 meta/recipes-support/nspr/nspr_4.19.bb             |   1 +
 meta/site/arc-common                               |  11 +
 19 files changed, 808 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
 create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0041-ARC-fix-spec-gen.patch
 create mode 100644 meta/recipes-support/icu/icu/0002-Add-ARC-support.patch
 create mode 100644 meta/recipes-support/libgpg-error/libgpg-error/0001-syscfg-Support-ARC-CPUs-and-simplify-aliasing-table.patch
 create mode 100644 meta/recipes-support/nspr/nspr/0004-Add-ARC-support.patch
 create mode 100644 meta/site/arc-common
Signature · 1 line
2.16.2
#1 lore raw

PATCH v2 1/9 siteinfo: Define data for ARC

Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:
* Merged changes in meta/classes/siteinfo.bbclass & meta/site/arc-common

 meta/classes/siteinfo.bbclass |  2 ++
 meta/site/arc-common          | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 meta/site/arc-common
meta/classes/siteinfo.bbclass +2 -0
index 86bb853be2..dccf122b12 100644
@@ -20,6 +20,8 @@ def siteinfo_data(d):
         "allarch": "endian-little bit-32", # bogus, but better than special-casing the checks below for allarch
         "aarch64": "endian-little bit-64 arm-common arm-64",
         "aarch64_be": "endian-big bit-64 arm-common arm-64",
+        "arc": "endian-little bit-32 arc-common",
+        "arceb": "endian-big bit-32 arc-common",
         "arm": "endian-little bit-32 arm-common arm-32",
         "armeb": "endian-big bit-32 arm-common arm-32",
         "avr32": "endian-big bit-32 avr32-common",
meta/site/arc-common new file +11 -0
new file mode 100644
index 0000000000..d3c721a8bb
@@ -0,0 +1,11 @@
+# general
+ac_cv_alignof_guint32=4
+ac_cv_alignof_guint64=4
+ac_cv_alignof_unsigned_long=4
+
+# glib-2.0
+glib_cv_stack_grows=${glib_cv_stack_grows=no}
+glib_cv_uscore=${glib_cv_uscore=no}
+
+# startup-notification
+lf_cv_sane_realloc=${lf_cv_sane_realloc=yes}
Signature · 1 line
2.16.2
#2 lore raw

PATCH v2 2/9 kernel-arch.bbclass: Add ARC to kernel arch map

In reply to Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

No changes in v2

 meta/classes/kernel-arch.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/kernel-arch.bbclass +1 -0
index 09793fc9c2..2b52a63c64 100644
@@ -22,6 +22,7 @@ def map_kernel_arch(a, d):
     valid_archs = d.getVar('valid_archs').split()
 
     if   re.match('(i.86|athlon|x86.64)$', a):  return 'x86'
+    elif re.match('arceb$', a):                 return 'arc'
     elif re.match('armeb$', a):                 return 'arm'
     elif re.match('aarch64$', a):               return 'arm64'
     elif re.match('aarch64_be$', a):            return 'arm64'
Signature · 1 line
2.16.2
#3 lore raw

PATCH v2 3/9 openssl: Add support for ARC

In reply to Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

No changes in v2

 meta/recipes-connectivity/openssl/openssl10_1.0.2p.bb | 2 +-
 meta/recipes-connectivity/openssl/openssl_1.1.1.bb    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-connectivity/openssl/openssl10_1.0.2p.bb +1 -1
index b7297fce02..84e086c2f6 100644
@@ -164,7 +164,7 @@ do_configure () {
 	linux-mips*)
 		target=debian-mips
 		;;
-	linux-microblaze* | linux-nios2* | linux-gnu*ilp32**)
+	linux-microblaze* | linux-nios2* | linux-gnu*ilp32** | linux-arc*)
 		target=linux-generic32
 		;;
 	linux-powerpc)
meta/recipes-connectivity/openssl/openssl_1.1.1.bb +1 -1
index 09b2c01024..73bcb27160 100644
@@ -78,7 +78,7 @@ do_configure () {
 	linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
 		target=linux64-mips64
 		;;
-	linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4)
+	linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
 		target=linux-generic32
 		;;
 	linux-powerpc)
Signature · 1 line
2.16.2
#4 lore raw

PATCH v2 4/9 nspr: Add ARC support

In reply to Alexey Brodkin

From: Antoine Tenart <[email protected]>

[Alexey: Rebased on top of other patches like RiscV, NIOS2 etc]

Signed-off-by Antoine Tenart <antoine.tenart at bootlin.com>
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 .../nspr/nspr/0004-Add-ARC-support.patch           | 88 ++++++++++++++++++++++
 meta/recipes-support/nspr/nspr_4.19.bb             |  1 +
 2 files changed, 89 insertions(+)
 create mode 100644 meta/recipes-support/nspr/nspr/0004-Add-ARC-support.patch
meta/recipes-support/nspr/nspr/0004-Add-ARC-support.patch new file +88 -0
new file mode 100644
index 0000000000..9d686017df
@@ -0,0 +1,88 @@
+From 6cb5b0be8837222a1e01745f2cf57cd0e593186d Mon Sep 17 00:00:00 2001
+From: Antoine Tenart <antoine.tenart at free-electrons.com>
+Date: Mon, 23 Oct 2017 10:28:20 +0200
+Subject: [PATCH] Add ARC support
+
+[Alexey: Rebased on top of other patches like RiscV, NIOS2 etc].
+
+Signed-off-by: Antoine Tenart <antoine.tenart at bootlin.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+
+Upstream-Status: Submitted [ https://bugzilla.mozilla.org/show_bug.cgi?id=1492378 ]
+---
+ pr/include/md/_linux.cfg | 45 ++++++++++++++++++++++++++++++++++++++++
+ pr/include/md/_linux.h   |  2 ++
+ 2 files changed, 47 insertions(+)
+
+diff --git a/pr/include/md/_linux.cfg b/pr/include/md/_linux.cfg
+index fec8525378dc..5f4fa0eac783 100644
+--- a/pr/include/md/_linux.cfg
++++ b/pr/include/md/_linux.cfg
+@@ -1157,6 +1157,51 @@
+ #define PR_BYTES_PER_WORD_LOG2  3
+ #define PR_BYTES_PER_DWORD_LOG2 3
+ 
++#elif defined(__arc__)
++
++#define IS_LITTLE_ENDIAN 1
++#undef  IS_BIG_ENDIAN
++
++#define PR_BYTES_PER_BYTE   1
++#define PR_BYTES_PER_SHORT  2
++#define PR_BYTES_PER_INT    4
++#define PR_BYTES_PER_INT64  8
++#define PR_BYTES_PER_LONG   4
++#define PR_BYTES_PER_FLOAT  4
++#define PR_BYTES_PER_DOUBLE 8
++#define PR_BYTES_PER_WORD   4
++#define PR_BYTES_PER_DWORD  8
++
++#define PR_BITS_PER_BYTE    8
++#define PR_BITS_PER_SHORT   16
++#define PR_BITS_PER_INT     32
++#define PR_BITS_PER_INT64   64
++#define PR_BITS_PER_LONG    32
++#define PR_BITS_PER_FLOAT   32
++#define PR_BITS_PER_DOUBLE  64
++#define PR_BITS_PER_WORD    32
++
++#define PR_BITS_PER_BYTE_LOG2   3
++#define PR_BITS_PER_SHORT_LOG2  4
++#define PR_BITS_PER_INT_LOG2    5
++#define PR_BITS_PER_INT64_LOG2  6
++#define PR_BITS_PER_LONG_LOG2   5
++#define PR_BITS_PER_FLOAT_LOG2  5
++#define PR_BITS_PER_DOUBLE_LOG2 6
++#define PR_BITS_PER_WORD_LOG2   5
++
++#define PR_ALIGN_OF_SHORT   2
++#define PR_ALIGN_OF_INT     4
++#define PR_ALIGN_OF_LONG    4
++#define PR_ALIGN_OF_INT64   4
++#define PR_ALIGN_OF_FLOAT   4
++#define PR_ALIGN_OF_DOUBLE  4
++#define PR_ALIGN_OF_POINTER 4
++#define PR_ALIGN_OF_WORD    4
++
++#define PR_BYTES_PER_WORD_LOG2   2
++#define PR_BYTES_PER_DWORD_LOG2  3
++
+ #else
+ 
+ #error "Unknown CPU architecture"
+diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
+index 8e04fad479a1..628b1217e9c8 100644
+--- a/pr/include/md/_linux.h
++++ b/pr/include/md/_linux.h
+@@ -63,6 +63,8 @@
+ #define _PR_SI_ARCHITECTURE "riscv32"
+ #elif defined(__riscv) && (__riscv_xlen == 64)
+ #define _PR_SI_ARCHITECTURE "riscv64"
++#elif defined(__arc__)
++#define _PR_SI_ARCHITECTURE "arc"
+ #else
+ #error "Unknown CPU architecture"
+ #endif
+-- 
+2.17.1
+
meta/recipes-support/nspr/nspr_4.19.bb +1 -0
index b5264be2a0..0212be7f40 100644
@@ -12,6 +12,7 @@ SRC_URI = "http://ftp.mozilla.org/pub/nspr/releases/v${PV}/src/nspr-${PV}.tar.gz
            file://0002-Add-nios2-support.patch \
            file://0001-md-Fix-build-with-musl.patch \
            file://0003-Add-type-definitions-for-the-RISC-V-architecture.patch \
+           file://0004-Add-ARC-support.patch \
            file://nspr.pc.in \
 "
 
Signature · 1 line
2.16.2
#5 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

In reply to Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 ...port-ARC-CPUs-and-simplify-aliasing-table.patch | 298 +++++++++++++++++++++
 .../libgpg-error/libgpg-error_1.32.bb              |   2 +
 2 files changed, 300 insertions(+)
 create mode 100644 meta/recipes-support/libgpg-error/libgpg-error/0001-syscfg-Support-ARC-CPUs-and-simplify-aliasing-table.patch
meta/recipes-support/libgpg-error/libgpg-error/0001-syscfg-Support-ARC-CPUs-and-simplify-aliasing-table.patch new file +298 -0
new file mode 100644
index 0000000000..03b0ce77ed
@@ -0,0 +1,298 @@
+From d4fd6975671477721936060771aa4d7d07fb0910 Mon Sep 17 00:00:00 2001
+From: Werner Koch <wk at gnupg.org>
+Date: Tue, 18 Sep 2018 14:54:08 +0200
+Subject: [PATCH libgpg-error] syscfg: Support ARC CPUs and simplify aliasing
+ table.
+
+* src/mkheader.c (xmalloc): New.
+(xstrdup): Implement using xmalloc.
+(canon_host_triplet): Add supporr for arc CPU.  Adjust alias table to
+also alias *-pc-*.  Rename ibm to unknown. Add internal arg.  Add
+unknown vendor hack.
+(main): New mode to just print the canonicalized form.
+* src/Makefile.am (lock_obj_pub): s/-(pc|ibm)-/-unknown/.  Also rename
+files accordingly.
+--
+
+config.sub does no real aliasing and thus we would need to add several
+vendors to the alising tables despite that this has no technical
+meanding.  Instead we now replace the vendor with "unknown" for the
+4-part-"triplets".  This change will make maintenace easier.
+
+Signed-off-by: Werner Koch <wk at gnupg.org>
+
+Upstream-Status: Backport [ http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=48c8f8ddfc80 ]
+---
+ src/Makefile.am                               | 16 ++--
+ src/mkheader.c                                | 92 ++++++++++++++++---
+ ...-gnu.h => lock-obj-pub.i686-unknown-gnu.h} |  0
+ ... lock-obj-pub.i686-unknown-kfreebsd-gnu.h} |  0
+ ... => lock-obj-pub.i686-unknown-linux-gnu.h} |  0
+ ...=> lock-obj-pub.s390x-unknown-linux-gnu.h} |  0
+ ...ock-obj-pub.x86_64-unknown-kfreebsd-gnu.h} |  0
+ ...> lock-obj-pub.x86_64-unknown-linux-gnu.h} |  0
+ ...ock-obj-pub.x86_64-unknown-linux-gnux32.h} |  0
+ ... lock-obj-pub.x86_64-unknown-linux-musl.h} |  0
+ 10 files changed, 85 insertions(+), 23 deletions(-)
+ rename src/syscfg/{lock-obj-pub.i686-pc-gnu.h => lock-obj-pub.i686-unknown-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.i686-pc-kfreebsd-gnu.h => lock-obj-pub.i686-unknown-kfreebsd-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.i686-pc-linux-gnu.h => lock-obj-pub.i686-unknown-linux-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.s390x-ibm-linux-gnu.h => lock-obj-pub.s390x-unknown-linux-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.x86_64-pc-kfreebsd-gnu.h => lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.x86_64-pc-linux-gnu.h => lock-obj-pub.x86_64-unknown-linux-gnu.h} (100%)
+ rename src/syscfg/{lock-obj-pub.x86_64-pc-linux-gnux32.h => lock-obj-pub.x86_64-unknown-linux-gnux32.h} (100%)
+ rename src/syscfg/{lock-obj-pub.x86_64-pc-linux-musl.h => lock-obj-pub.x86_64-unknown-linux-musl.h} (100%)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 42998e46a3bc..8ec582ef99fb 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -52,9 +52,9 @@ lock_obj_pub = \
+ 	syscfg/lock-obj-pub.arm-apple-darwin.h              \
+         syscfg/lock-obj-pub.hppa-unknown-linux-gnu.h        \
+ 	syscfg/lock-obj-pub.i386-apple-darwin.h             \
+-        syscfg/lock-obj-pub.i686-pc-gnu.h                   \
+-        syscfg/lock-obj-pub.i686-pc-kfreebsd-gnu.h          \
+-        syscfg/lock-obj-pub.i686-pc-linux-gnu.h             \
++        syscfg/lock-obj-pub.i686-unknown-gnu.h              \
++        syscfg/lock-obj-pub.i686-unknown-kfreebsd-gnu.h     \
++        syscfg/lock-obj-pub.i686-unknown-linux-gnu.h        \
+         syscfg/lock-obj-pub.m68k-unknown-linux-gnu.h        \
+         syscfg/lock-obj-pub.mips-unknown-linux-gnu.h        \
+         syscfg/lock-obj-pub.mips64el-unknown-linux-gnuabi64.h \
+@@ -66,16 +66,16 @@ lock_obj_pub = \
+ 	syscfg/lock-obj-pub.powerpc64le-unknown-linux-gnu.h \
+ 	syscfg/lock-obj-pub.powerpc-unknown-linux-gnuspe.h  \
+ 	syscfg/lock-obj-pub.riscv64-unknown-linux-gnu.h     \
+-        syscfg/lock-obj-pub.s390x-ibm-linux-gnu.h           \
++        syscfg/lock-obj-pub.s390x-unknown-linux-gnu.h       \
+         syscfg/lock-obj-pub.sh3-unknown-linux-gnu.h         \
+         syscfg/lock-obj-pub.sh4-unknown-linux-gnu.h         \
+         syscfg/lock-obj-pub.sparc-unknown-linux-gnu.h       \
+         syscfg/lock-obj-pub.sparc64-unknown-linux-gnu.h     \
+ 	syscfg/lock-obj-pub.x86_64-apple-darwin.h           \
+-        syscfg/lock-obj-pub.x86_64-pc-kfreebsd-gnu.h        \
+-        syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h           \
+-        syscfg/lock-obj-pub.x86_64-pc-linux-gnux32.h        \
+-        syscfg/lock-obj-pub.x86_64-pc-linux-musl.h          \
++        syscfg/lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h   \
++        syscfg/lock-obj-pub.x86_64-unknown-linux-gnu.h      \
++        syscfg/lock-obj-pub.x86_64-unknown-linux-gnux32.h   \
++        syscfg/lock-obj-pub.x86_64-unknown-linux-musl.h     \
+ 	syscfg/lock-obj-pub.tilegx-unknown-linux-gnu.h      \
+ 	syscfg/lock-obj-pub.ia64-unknown-linux-gnu.h        \
+ 	syscfg/lock-obj-pub.mingw32.h
+diff --git a/src/mkheader.c b/src/mkheader.c
+index 2fc5fada66a4..7a38a1bec1a4 100644
+--- a/src/mkheader.c
++++ b/src/mkheader.c
+@@ -51,17 +51,27 @@ xfree (void *a)
+ 
+ 
+ static char *
+-xstrdup (const char *string)
++xmalloc (size_t n)
+ {
+   char *p;
+-  size_t len = strlen (string) + 1;
+ 
+-  p = malloc (len);
++  p = malloc (n);
+   if (!p)
+     {
+       fputs (PGM ": out of core\n", stderr);
+       exit (1);
+     }
++  return p;
++}
++
++
++static char *
++xstrdup (const char *string)
++{
++  char *p;
++  size_t len = strlen (string) + 1;
++
++  p = xmalloc (len);
+   memcpy (p, string, len);
+   return p;
+ }
+@@ -69,23 +79,31 @@ xstrdup (const char *string)
+ 
+ /* Return a malloced string with TRIPLET.  If TRIPLET has an alias
+    return that instead.  In general build-aux/config.sub should do the
+-   aliasing but some returned triplets are anyway identical and thus we
+-   use this function to map it to the canonical form.  */
++   aliasing but some returned triplets are anyway identical and thus
++   we use this function to map it to the canonical form.
++   NO_VENDOR_HACK is for internal use; caller must call with 0. */
+ static char *
+-canon_host_triplet (const char *triplet)
++canon_host_triplet (const char *triplet, int no_vendor_hack)
+ {
+   struct {
+     const char *name;
+     const char *alias;
+   } tbl[] = {
+-    {"i486-pc-linux-gnu", "i686-pc-linux-gnu" },
++    {"i486-pc-linux-gnu", "i686-unknown-linux-gnu" },
+     {"i586-pc-linux-gnu" },
+-    {"i486-pc-gnu", "i686-pc-gnu"},
++    {"i686-pc-linux-gnu" },
++    {"arc-oe-linux-uclibc" }, /* Other CPU but same struct.  */
++
++    {"i486-pc-gnu", "i686-unknown-gnu"},
+     {"i586-pc-gnu"},
+-    {"i486-pc-kfreebsd-gnu", "i686-pc-kfreebsd-gnu"},
++    {"i686-pc-gnu"},
++
++    {"i486-pc-kfreebsd-gnu", "i686-unknown-kfreebsd-gnu"},
+     {"i586-pc-kfreebsd-gnu"},
++    {"i686-pc-kfreebsd-gnu"},
+ 
+-    {"x86_64-pc-linux-gnuhardened1", "x86_64-pc-linux-gnu" },
++    {"x86_64-pc-linux-gnuhardened1", "x86_64-unknown-linux-gnu" },
++    {"x86_64-pc-linux-gnu" },
+ 
+     {"powerpc-unknown-linux-gnuspe", "powerpc-unknown-linux-gnu" },
+ 
+@@ -98,6 +116,7 @@ canon_host_triplet (const char *triplet)
+   };
+   int i;
+   const char *lastalias = NULL;
++  const char *s;
+ 
+   for (i=0; tbl[i].name; i++)
+     {
+@@ -110,6 +129,36 @@ canon_host_triplet (const char *triplet)
+           return xstrdup (lastalias);
+         }
+     }
++  for (i=0, s=triplet; *s; s++)
++    if (*s == '-')
++      i++;
++  if (i > 2 && !no_vendor_hack)
++    {
++      /* We have a 4 part "triplet": CPU-VENDOR-KERNEL-SYSTEM where
++       * the last two parts replace the OS part of a real triplet.
++       * The VENDOR part is then in general useless because
++       * KERNEL-SYSTEM is specific enough.  We now do a second pass by
++       * replacing VENDOR with "unknown".  */
++      char *p;
++      char *buf = xmalloc (strlen (triplet) + 7 + 1);
++
++      for (p=buf,s=triplet,i=0; *s; s++)
++        {
++          *p++ = *s;
++          if (*s == '-' && ++i == 1)
++            {
++              memcpy (p, "unknown-",8);
++              p += 8;
++              for (s++; *s != '-'; s++)
++                ;
++            }
++        }
++      *p = 0;
++      p = canon_host_triplet (buf, 1);
++      xfree (buf);
++      return p;
++    }
++
+   return xstrdup (triplet);
+ }
+ 
+@@ -558,7 +607,7 @@ write_special (const char *fname, int lnr, const char *tag)
+ int
+ main (int argc, char **argv)
+ {
+-  FILE *fp;
++  FILE *fp = NULL;
+   char line[LINESIZE];
+   int lnr = 0;
+   const char *fname, *s;
+@@ -571,11 +620,22 @@ main (int argc, char **argv)
+       argc--; argv++;
+     }
+ 
+-  if (argc != 6)
++  if (argc == 1)
++    {
++      /* Print just the canonicalized host triplet.  */
++      host_triplet = canon_host_triplet (argv[0], 0);
++      printf ("%s\n", host_triplet);
++      goto leave;
++    }
++  else if (argc == 6)
++    ; /* Standard operation.  */
++  else
+     {
+       fputs ("usage: " PGM
+              " host_os host_triplet template.h config.h"
+-             " version version_number\n",
++             " version version_number\n"
++             "       " PGM
++             " host_triplet\n",
+              stderr);
+       return 1;
+     }
+@@ -586,7 +646,7 @@ main (int argc, char **argv)
+   hdr_version = argv[4];
+   hdr_version_number = argv[5];
+ 
+-  host_triplet = canon_host_triplet (host_triplet_raw);
++  host_triplet = canon_host_triplet (host_triplet_raw, 0);
+ 
+   srcdir = malloc (strlen (fname) + 2 + 1);
+   if (!srcdir)
+@@ -677,13 +737,15 @@ main (int argc, char **argv)
+          "End:\n"
+          "*/\n", stdout);
+ 
++ leave:
+   if (ferror (stdout))
+     {
+       fprintf (stderr, PGM ": error writing to stdout: %s\n", strerror (errno));
+       return 1;
+     }
+ 
+-  fclose (fp);
++  if (fp)
++    fclose (fp);
+ 
+   xfree (host_triplet);
+   return 0;
+diff --git a/src/syscfg/lock-obj-pub.i686-pc-gnu.h b/src/syscfg/lock-obj-pub.i686-unknown-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.i686-pc-gnu.h
+rename to src/syscfg/lock-obj-pub.i686-unknown-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.i686-pc-kfreebsd-gnu.h b/src/syscfg/lock-obj-pub.i686-unknown-kfreebsd-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.i686-pc-kfreebsd-gnu.h
+rename to src/syscfg/lock-obj-pub.i686-unknown-kfreebsd-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.i686-pc-linux-gnu.h b/src/syscfg/lock-obj-pub.i686-unknown-linux-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.i686-pc-linux-gnu.h
+rename to src/syscfg/lock-obj-pub.i686-unknown-linux-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.s390x-ibm-linux-gnu.h b/src/syscfg/lock-obj-pub.s390x-unknown-linux-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.s390x-ibm-linux-gnu.h
+rename to src/syscfg/lock-obj-pub.s390x-unknown-linux-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.x86_64-pc-kfreebsd-gnu.h b/src/syscfg/lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.x86_64-pc-kfreebsd-gnu.h
+rename to src/syscfg/lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h b/src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnu.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h
+rename to src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnu.h
+diff --git a/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnux32.h b/src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnux32.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.x86_64-pc-linux-gnux32.h
+rename to src/syscfg/lock-obj-pub.x86_64-unknown-linux-gnux32.h
+diff --git a/src/syscfg/lock-obj-pub.x86_64-pc-linux-musl.h b/src/syscfg/lock-obj-pub.x86_64-unknown-linux-musl.h
+similarity index 100%
+rename from src/syscfg/lock-obj-pub.x86_64-pc-linux-musl.h
+rename to src/syscfg/lock-obj-pub.x86_64-unknown-linux-musl.h
+-- 
+2.17.1
+
meta/recipes-support/libgpg-error/libgpg-error_1.32.bb +2 -0
index a4c720be9d..e771630258 100644
@@ -14,6 +14,7 @@ SECTION = "libs"
 UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
 SRC_URI = "${GNUPG_MIRROR}/libgpg-error/libgpg-error-${PV}.tar.bz2 \
            file://pkgconfig.patch \
+           file://0001-syscfg-Support-ARC-CPUs-and-simplify-aliasing-table.patch \
 	  "
 SRC_URI[md5sum] = "ef3d928a5a453fa701ecc3bb22be1c64"
 SRC_URI[sha256sum] = "c345c5e73cc2332f8d50db84a2280abfb1d8f6d4f1858b9daa30404db44540ca"
@@ -36,6 +37,7 @@ do_compile_prepend() {
 
 	case ${TARGET_ARCH} in
 	  aarch64_be) TUPLE=aarch64-unknown-linux-gnu ;;
+	  arc)	      TUPLE=i686-unknown-linux-gnu ;;
 	  arm)	      TUPLE=arm-unknown-linux-gnueabi ;;
 	  armeb)      TUPLE=arm-unknown-linux-gnueabi ;;
 	  i586|i686)  TUPLE=i686-pc-linux-gnu ;;
Signature · 1 line
2.16.2
#6 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Quoted 6 lines · Alexey Brodkin
        case ${TARGET_ARCH} in
          aarch64_be) TUPLE=aarch64-unknown-linux-gnu ;;
+         arc)        TUPLE=i686-unknown-linux-gnu ;;
          arm)        TUPLE=arm-unknown-linux-gnueabi ;;
          armeb)      TUPLE=arm-unknown-linux-gnueabi ;;
          i586|i686)  TUPLE=i686-pc-linux-gnu ;;

Is that right? Just saying, it looks wrong...

Ross

#7 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Hi Ross,

Quoted 11 lines · Ross
Quoted 6 lines · Alexey Brodkin
        case ${TARGET_ARCH} in
          aarch64_be) TUPLE=aarch64-unknown-linux-gnu ;;
+         arc)        TUPLE=i686-unknown-linux-gnu ;;
          arm)        TUPLE=arm-unknown-linux-gnueabi ;;
          armeb)      TUPLE=arm-unknown-linux-gnueabi ;;
          i586|i686)  TUPLE=i686-pc-linux-gnu ;;

Is that right? Just saying, it looks wrong...

That's indeed a hack :)

libgpg-error [upstream] patch mentioned in this commit
adds support of ARC architecture as an alias to "i686-unknown-linux-gnu" (that's because headers are the same).

But since I provided generate headers only for arc-xxx-linux-uclibc (and there's no guarantee glibc header matches uclibc) Werner only added support for uClibc.

That said if we were building uClibc toolchain in OE then no mapping would be required at all but for Glibc toolchain we still need to use explicit header for ARC and the one that matches our needs is essentially "ock-obj-pub.i686-unknown-linux-gnu.h", see
https://lists.gt.net/gnupg/devel/84636#84636

-Alexey

#8 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Hi Ross,

Quoted 25 lines · Alexey Brodkin

Hi Ross,

Quoted 11 lines · Ross
Quoted 6 lines · Alexey Brodkin
        case ${TARGET_ARCH} in
          aarch64_be) TUPLE=aarch64-unknown-linux-gnu ;;
+         arc)        TUPLE=i686-unknown-linux-gnu ;;
          arm)        TUPLE=arm-unknown-linux-gnueabi ;;
          armeb)      TUPLE=arm-unknown-linux-gnueabi ;;
          i586|i686)  TUPLE=i686-pc-linux-gnu ;;

Is that right? Just saying, it looks wrong...

That's indeed a hack :)

libgpg-error [upstream] patch mentioned in this commit
adds support of ARC architecture as an alias to "i686-unknown-linux-gnu" (that's because headers are the same).

But since I provided generate headers only for arc-xxx-linux-uclibc (and there's no guarantee glibc header matches uclibc) Werner only added support for uClibc.

Quoted 5 lines

That said if we were building uClibc toolchain in OE then no mapping would be required at all but for Glibc toolchain we still need to use explicit header for ARC and the one that matches our needs is essentially "ock-obj-pub.i686-unknown-linux-gnu.h", see
https://lists.gt.net/gnupg/devel/84636#84636

So this is fixed now in libgpg-error upstrema, see
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=f4f0da74f526d7e35cedbc2e93454df6440dbfa5

I'll send v3 soonish with that patch back-ported.

-Alexey

#9 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Can you check that v3 works with x86-64 targets?

ERROR: libgpg-error-1.32-r0 do_compile: Function failed: do_compile
(log file is located at /data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345
Log data follows:
| DEBUG: SITE files ['endian-little', 'common-linux', 'common-glibc',
'bit-64', 'x86_64-linux', 'common']
| DEBUG: Executing shell function do_compile
| cp: cannot stat '/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/libgpg-error-1.32/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h':
No such file or directory
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)

Ross

Quoted 41 lines · Alexey Brodkin

Hi Ross,

Quoted 25 lines · Alexey Brodkin

Hi Ross,

Quoted 11 lines · Ross
Quoted 6 lines · Alexey Brodkin
        case ${TARGET_ARCH} in
          aarch64_be) TUPLE=aarch64-unknown-linux-gnu ;;
+         arc)        TUPLE=i686-unknown-linux-gnu ;;
          arm)        TUPLE=arm-unknown-linux-gnueabi ;;
          armeb)      TUPLE=arm-unknown-linux-gnueabi ;;
          i586|i686)  TUPLE=i686-pc-linux-gnu ;;

Is that right? Just saying, it looks wrong...

That's indeed a hack :)

libgpg-error [upstream] patch mentioned in this commit
adds support of ARC architecture as an alias to "i686-unknown-linux-gnu" (that's because headers are the same).

But since I provided generate headers only for arc-xxx-linux-uclibc (and there's no guarantee glibc header matches uclibc) Werner only added support for uClibc.

Quoted 5 lines

That said if we were building uClibc toolchain in OE then no mapping would be required at all but for Glibc toolchain we still need to use explicit header for ARC and the one that matches our needs is essentially "ock-obj-pub.i686-unknown-linux-gnu.h", see
https://lists.gt.net/gnupg/devel/84636#84636

So this is fixed now in libgpg-error upstrema, see
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=f4f0da74f526d7e35cedbc2e93454df6440dbfa5

I'll send v3 soonish with that patch back-ported.

-Alexey

#10 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Hi Ross,

Quoted 14 lines · Ross

Can you check that v3 works with x86-64 targets?

ERROR: libgpg-error-1.32-r0 do_compile: Function failed: do_compile
(log file is located at /data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345 Log data follows:

Quoted 1 line

DEBUG: SITE files ['endian-little', 'common-linux', 'common-glibc',

'bit-64', 'x86_64-linux', 'common']

Quoted 2 lines

DEBUG: Executing shell function do_compile
cp: cannot stat

Quoted 6 lines

'/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/libgpg-error-1.32/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h':
No such file or directory

Quoted 2 lines

WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at

/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)

Yeah that's pretty unfortunate that "simple addition of ARC" broke anther arch :(

What happened is in the same one commit that adds ARC quite a few headers for other arches get renamed, see:
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=48c8f8ddfc80551db7615e1eb3555c1dc3f6a657

And "lock-obj-pub.x86_64-pc-linux-gnu.h" is one of them. So I'll update libgpg-error_1.32.bb with:
-------------------------->8-----------------------

meta/recipes-support/libgpg-error/libgpg-error_1.32.bb +1 -2
@@ -44,7 +44,7 @@ do_compile_prepend() {
          mips64*)    TUPLE=mips64el-unknown-linux-gnuabi64 ;;
          mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
          mips*)      TUPLE=mips-unknown-linux-gnu ;;
-         x86_64)     TUPLE=x86_64-pc-linux-gnu ;;
+         x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
          *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;
        esac
-------------------------->8-----------------------

Care to try that change in your setup once you have eveything else built for x86_64?

-Alexey

#11 lore raw

PATCH v2 5/9 libgpg-error: Add ARC support

Yes, that fixes it.

Ross

Quoted 50 lines · Alexey Brodkin

Hi Ross,

Quoted 14 lines · Ross

Can you check that v3 works with x86-64 targets?

ERROR: libgpg-error-1.32-r0 do_compile: Function failed: do_compile
(log file is located at /data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345 Log data follows:

Quoted 1 line

DEBUG: SITE files ['endian-little', 'common-linux', 'common-glibc',

'bit-64', 'x86_64-linux', 'common']

Quoted 2 lines

DEBUG: Executing shell function do_compile
cp: cannot stat

Quoted 6 lines

'/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/libgpg-error-1.32/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h':
No such file or directory

Quoted 2 lines

WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at

/data/poky-tmp/master/work/corei7-64-poky-linux/libgpg-error/1.32-r0/temp/log.do_compile.13345)

Yeah that's pretty unfortunate that "simple addition of ARC" broke anther arch :(

What happened is in the same one commit that adds ARC quite a few headers for other arches get renamed, see:
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgpg-error.git;a=commit;h=48c8f8ddfc80551db7615e1eb3555c1dc3f6a657

And "lock-obj-pub.x86_64-pc-linux-gnu.h" is one of them. So I'll update libgpg-error_1.32.bb with:
-------------------------->8-----------------------

meta/recipes-support/libgpg-error/libgpg-error_1.32.bb +1 -2
@@ -44,7 +44,7 @@ do_compile_prepend() {
          mips64*)    TUPLE=mips64el-unknown-linux-gnuabi64 ;;
          mips*el)    TUPLE=mipsel-unknown-linux-gnu ;;
          mips*)      TUPLE=mips-unknown-linux-gnu ;;
-         x86_64)     TUPLE=x86_64-pc-linux-gnu ;;
+         x86_64)     TUPLE=x86_64-unknown-linux-gnu ;;
          *)          TUPLE=${TARGET_ARCH}-unknown-linux-gnu ;;
        esac
-------------------------->8-----------------------

Care to try that change in your setup once you have eveything else built for x86_64?

-Alexey

#12 lore raw

PATCH v2 6/9 icu: Add ARC support

In reply to Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 .../icu/icu/0002-Add-ARC-support.patch             | 27 ++++++++++++++++++++++
 meta/recipes-support/icu/icu_62.1.bb               |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 meta/recipes-support/icu/icu/0002-Add-ARC-support.patch
meta/recipes-support/icu/icu/0002-Add-ARC-support.patch new file +27 -0
new file mode 100644
index 0000000000..20e3d8356c
@@ -0,0 +1,27 @@
+From fcfd57105b4bdb30d906df152ef01748fa95daff Mon Sep 17 00:00:00 2001
+From: Alexey Brodkin <abrodkin at synopsys.com>
+Date: Thu, 13 Sep 2018 17:13:20 +0300
+Subject: [PATCH] icu: Add ARC support
+
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+
+Upstream-Status: Submitted [ https://github.com/unicode-org/icu/pull/149 ]
+---
+ i18n/double-conversion-utils.h                 | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/i18n/double-conversion-utils.h b/i18n/double-conversion-utils.h
+index 57fc49b231a3..0bd3e8340673 100644
+--- a/i18n/double-conversion-utils.h
++++ b/i18n/double-conversion-utils.h
+@@ -86,7 +86,7 @@ inline void abort_noreturn() { abort(); }
+     defined(__SH4__) || defined(__alpha__) || \
+     defined(_MIPS_ARCH_MIPS32R2) || \
+     defined(__AARCH64EL__) || defined(__aarch64__) || \
+-    defined(__riscv)
++    defined(__riscv) || defined(__arc__)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #elif defined(__mc68000__)
+ #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
+2.17.1
+
meta/recipes-support/icu/icu_62.1.bb +1 -0
index ec9db7de84..4e3750b997 100644
@@ -16,6 +16,7 @@ BASE_SRC_URI = "http://download.icu-project.org/files/icu4c/${PV}/icu4c-${ICU_PV
 SRC_URI = "${BASE_SRC_URI} \
            file://icu-pkgdata-large-cmd.patch \
            file://fix-install-manx.patch \
+           file://0002-Add-ARC-support.patch \
            "
 
 SRC_URI_append_class-target = "\
Signature · 1 line
2.16.2
#13 lore raw

PATCH v2 7/9 gcc: Disable libitm for ARC

In reply to Alexey Brodkin

The libitm is not supported on ARC, so disable it

Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

No changes in v2

 meta/recipes-devtools/gcc/gcc-runtime.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/gcc/gcc-runtime.inc +1 -0
index 72b8081cd3..9e7e7c5b3d 100644
@@ -17,6 +17,7 @@ EXTRA_OECONF_PATHS = "\
 EXTRA_OECONF_append_linuxstdbase = " --enable-clocale=gnu"
 
 RUNTIMELIBITM = "libitm"
+RUNTIMELIBITM_arc = ""
 RUNTIMELIBITM_mipsarch = ""
 RUNTIMELIBITM_nios2 = ""
 RUNTIMELIBITM_microblaze = ""
Signature · 1 line
2.16.2
#14 lore raw

PATCH v2 8/9 binutils: Fix Glibc building for ARC

In reply to Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 meta/recipes-devtools/binutils/binutils-2.31.inc   |   4 +
 ...location-where-GOT-information-is-collect.patch | 201 +++++++++++++++++++++
 ...bustness.-Return-FALSE-in-case-of-NULL-po.patch |  38 ++++
 ...lobal-symbol-is-not-an-indirect-or-warnin.patch |  46 +++++
 ...tion-was-still-being-generated-when-symbo.patch |  40 ++++
 5 files changed, 329 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
meta/recipes-devtools/binutils/binutils-2.31.inc +4 -0
index bc951d73e4..76add0fe4b 100644
@@ -37,6 +37,10 @@ SRC_URI = "\
      file://0015-sync-with-OE-libtool-changes.patch \
      file://0016-add-i386pep-emulation-for-x86_64.patch \
      file://0017-improve-check-for-input-file-matching-output-file.patch \
+     file://0018-Refactored-location-where-GOT-information-is-collect.patch \
+     file://0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch \
+     file://0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch \
+     file://0021-PLT-information-was-still-being-generated-when-symbo.patch \
 "
 S  = "${WORKDIR}/git"
 
meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch new file +201 -0

201 lines not on this page · raw message

meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch new file +38 -0
new file mode 100644
index 0000000000..6a58ee06ac
@@ -0,0 +1,38 @@
+From 955176bd999fe80c5b937ab8786665079e35c387 Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:33:48 +0100
+Subject: [PATCH] Improved robustness. Return FALSE in case of NULL pointer.
+
+bfd/
+2018-03-01  Cupertino Miranda <cmiranda at synopsys.com>
+
+	* elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
+	arc_htab is NULL.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/elf32-arc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index ab84de43815..33fc72cff6e 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -2420,6 +2420,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
+     {
+       struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
+ 
++      if(arc_htab == NULL)
++	return FALSE;
++
+       if (h->dynindx == -1
+ 	  || (h->root.type != bfd_link_hash_defined
+ 	      && h->root.type != bfd_link_hash_defweak)
+-- 
+2.14.4
+
meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch new file +46 -0

46 lines not on this page · raw message

meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch new file +40 -0
new file mode 100644
index 0000000000..9e942399c0
@@ -0,0 +1,40 @@
+From e4861c68067cb2166b4c2bb9c052abeb6ad9aaa1 Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:44:29 +0100
+Subject: [PATCH] PLT information was still being generated when symbol was
+ forced_local.
+
+A change upstream reveiled this issue, triggering an assert when linking glibc.
+
+bfd/
+2018-03-01  Cupertino Miranda <cmiranda at synopsys.com>
+
+	* elf32-arc.c (elf_arc_check_relocs): Changed.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/elf32-arc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index 9b72c5b4f4f..b40b463d34d 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -2041,7 +2041,8 @@ elf_arc_check_relocs (bfd *			 abfd,
+ 	  if (h == NULL)
+ 	    continue;
+ 	  else
+-	    h->needs_plt = 1;
++	    if(h->forced_local == 0)
++	      h->needs_plt = 1;
+ 	}
+ 
+       /* Add info to the symbol got_entry_list.  */
+-- 
+2.14.4
+
Signature · 1 line
2.16.2
#15 lore raw

PATCH v2 8/9 binutils: Fix Glibc building for ARC

I don't like accumulating pending patches for something as key as binutils, are these actually working their way upstream now?

Ross

Quoted 391 lines · Alexey Brodkin
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 meta/recipes-devtools/binutils/binutils-2.31.inc   |   4 +
 ...location-where-GOT-information-is-collect.patch | 201 +++++++++++++++++++++
 ...bustness.-Return-FALSE-in-case-of-NULL-po.patch |  38 ++++
 ...lobal-symbol-is-not-an-indirect-or-warnin.patch |  46 +++++
 ...tion-was-still-being-generated-when-symbo.patch |  40 ++++
 5 files changed, 329 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
 create mode 100644 meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
meta/recipes-devtools/binutils/binutils-2.31.inc +4 -0
index bc951d73e4..76add0fe4b 100644
@@ -37,6 +37,10 @@ SRC_URI = "\
      file://0015-sync-with-OE-libtool-changes.patch \
      file://0016-add-i386pep-emulation-for-x86_64.patch \
      file://0017-improve-check-for-input-file-matching-output-file.patch \
+     file://0018-Refactored-location-where-GOT-information-is-collect.patch \
+     file://0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch \
+     file://0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch \
+     file://0021-PLT-information-was-still-being-generated-when-symbo.patch \
 "
 S  = "${WORKDIR}/git"
 
meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch new file +201 -0
new file mode 100644
index 0000000000..d41339a9a6
@@ -0,0 +1,201 @@
+From d930affa2d475d1cc6792f1e6d56bef3d6c617db Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:16:21 +0100
+Subject: [PATCH] Refactored location where GOT information is collected.
+
+Change location where GOT information is collected for ARC target, avoiding
+posible use conflicts of the previous .got field in the symbols hash_entry.
+
+bfd/
+2018-03-01  Cupertino Miranda  <cmiranda at synopsys.com>
+
+       * arc-got.h (get_got_entry_list_for_symbol): Changed.
+       * ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
+       (elf_arc_link_hash_newfunc): Changed.
+       (arc_elf_link_hash_table_create): Removed old initializations.
+       (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/arc-got.h   |  6 +++--
+ bfd/elf32-arc.c | 77 +++++++++++++++++++++++++++++++--------------------------
+ 2 files changed, 46 insertions(+), 37 deletions(-)
+
+diff --git a/bfd/arc-got.h b/bfd/arc-got.h
+index a86061bcb38..81ce88fe21a 100644
+--- a/bfd/arc-got.h
++++ b/bfd/arc-got.h
+@@ -156,9 +156,11 @@ get_got_entry_list_for_symbol (bfd *abfd,
+                              unsigned long r_symndx,
+                              struct elf_link_hash_entry *h)
+ {
+-  if (h != NULL)
++  struct elf_arc_link_hash_entry *h1 =
++    ((struct elf_arc_link_hash_entry *) h);
++  if (h1 != NULL)
+     {
+-      return &h->got.glist;
++      return &h1->got_ents;
+     }
+   else
+     {
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index a48ef0ca15f..ab84de43815 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -160,6 +160,18 @@ struct arc_relocation_data
+   const char *    symbol_name;
+ };
+
++/* ARC ELF linker hash entry.  */
++struct elf_arc_link_hash_entry
++{
++  struct elf_link_hash_entry root;
++
++  /* Track dynamic relocs copied for this symbol.  */
++  struct elf_dyn_relocs *dyn_relocs;
++
++  struct got_entry *got_ents;
++};
++
++
+ /* Should be included at this location due to static declarations
+    defined before this point.  */
+ #include "arc-got.h"
+@@ -281,15 +293,6 @@ struct arc_reloc_map
+   unsigned char                   elf_reloc_val;
+ };
+
+-/* ARC ELF linker hash entry.  */
+-struct elf_arc_link_hash_entry
+-{
+-  struct elf_link_hash_entry root;
+-
+-  /* Track dynamic relocs copied for this symbol.  */
+-  struct elf_dyn_relocs *dyn_relocs;
+-};
+-
+ /* ARC ELF linker hash table.  */
+ struct elf_arc_link_hash_table
+ {
+@@ -301,28 +304,28 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry,
+                          struct bfd_hash_table *table,
+                          const char *string)
+ {
++  struct elf_arc_link_hash_entry * ret =
++    (struct elf_arc_link_hash_entry *) entry;
++
+   /* Allocate the structure if it has not already been allocated by a
+      subclass.  */
+-  if (entry == NULL)
+-    {
+-      entry = (struct bfd_hash_entry *)
+-        bfd_hash_allocate (table,
+-                           sizeof (struct elf_arc_link_hash_entry));
+-      if (entry == NULL)
+-      return entry;
+-    }
++  if (ret == NULL)
++    ret = (struct elf_arc_link_hash_entry *)
++      bfd_hash_allocate (table, sizeof (struct elf_arc_link_hash_entry));
++  if (ret == NULL)
++    return (struct bfd_hash_entry *) ret;
+
+   /* Call the allocation method of the superclass.  */
+-  entry = _bfd_elf_link_hash_newfunc (entry, table, string);
+-  if (entry != NULL)
++  ret = ((struct elf_arc_link_hash_entry *)
++       _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
++                                   table, string));
++  if (ret != NULL)
+     {
+-      struct elf_arc_link_hash_entry *eh;
+-
+-      eh = (struct elf_arc_link_hash_entry *) entry;
+-      eh->dyn_relocs = NULL;
++      ret->dyn_relocs = NULL;
++      ret->got_ents = NULL;
+     }
+
+-  return entry;
++  return (struct bfd_hash_entry *) ret;
+ }
+
+ /* Destroy an ARC ELF linker hash table.  */
+@@ -352,11 +355,6 @@ arc_elf_link_hash_table_create (bfd *abfd)
+       return NULL;
+     }
+
+-  ret->elf.init_got_refcount.refcount = 0;
+-  ret->elf.init_got_refcount.glist = NULL;
+-  ret->elf.init_got_offset.offset = 0;
+-  ret->elf.init_got_offset.glist = NULL;
+-
+   ret->elf.root.hash_table_free = elf_arc_link_hash_table_free;
+
+   return &ret->elf.root;
+@@ -1615,10 +1613,14 @@ elf_arc_relocate_section (bfd *                          output_bfd,
+         while (h->root.type == bfd_link_hash_indirect
+                || h->root.type == bfd_link_hash_warning)
+         {
+-          struct elf_link_hash_entry *h_old = h;
++          struct elf_arc_link_hash_entry *ah_old =
++            (struct elf_arc_link_hash_entry *) h;
+           h = (struct elf_link_hash_entry *) h->root.u.i.link;
+-          if (h->got.glist == 0 && h_old->got.glist != h->got.glist)
+-            h->got.glist = h_old->got.glist;
++          struct elf_arc_link_hash_entry *ah =
++            (struct elf_arc_link_hash_entry *) h;
++
++          if (ah->got_ents == 0 && ah_old->got_ents != ah->got_ents)
++            ah->got_ents = ah_old->got_ents;
+         }
+
+         /* TODO: Need to validate what was the intention.  */
+@@ -1636,6 +1638,8 @@ elf_arc_relocate_section (bfd *                    output_bfd,
+
+             if (is_reloc_for_GOT (howto) && !bfd_link_pic (info))
+               {
++                struct elf_arc_link_hash_entry *ah =
++                  (struct elf_arc_link_hash_entry *) h;
+                 /* TODO: Change it to use arc_do_relocation with
+                   ARC_32 reloc.  Try to use ADD_RELA macro.  */
+                 bfd_vma relocation =
+@@ -1645,8 +1649,8 @@ elf_arc_relocate_section (bfd *                    output_bfd,
+                        + reloc_data.sym_section->output_section->vma)
+                     : 0);
+
+-                BFD_ASSERT (h->got.glist);
+-                bfd_vma got_offset = h->got.glist->offset;
++                BFD_ASSERT (ah->got_ents);
++                bfd_vma got_offset = ah->got_ents->offset;
+                 bfd_put_32 (output_bfd, relocation,
+                             htab->sgot->contents + got_offset);
+               }
+@@ -1958,6 +1962,7 @@ elf_arc_check_relocs (bfd *                       abfd,
+       else /* Global one.  */
+       h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+
++
+       switch (r_type)
+       {
+         case R_ARC_32:
+@@ -2404,7 +2409,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
+      create respective dynamic relocs.  */
+   /* TODO: Make function to get list and not access the list directly.  */
+   /* TODO: Move function to relocate_section create this relocs eagerly.  */
+-  create_got_dynrelocs_for_got_info (&h->got.glist,
++  struct elf_arc_link_hash_entry *ah =
++    (struct elf_arc_link_hash_entry *) h;
++  create_got_dynrelocs_for_got_info (&ah->got_ents,
+                                    output_bfd,
+                                    info,
+                                    h);
+--
+2.14.4
+
meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch new file +38 -0
new file mode 100644
index 0000000000..6a58ee06ac
@@ -0,0 +1,38 @@
+From 955176bd999fe80c5b937ab8786665079e35c387 Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:33:48 +0100
+Subject: [PATCH] Improved robustness. Return FALSE in case of NULL pointer.
+
+bfd/
+2018-03-01  Cupertino Miranda <cmiranda at synopsys.com>
+
+       * elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
+       arc_htab is NULL.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/elf32-arc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index ab84de43815..33fc72cff6e 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -2420,6 +2420,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
+     {
+       struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
+
++      if(arc_htab == NULL)
++      return FALSE;
++
+       if (h->dynindx == -1
+         || (h->root.type != bfd_link_hash_defined
+             && h->root.type != bfd_link_hash_defweak)
+--
+2.14.4
+
meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch new file +46 -0
new file mode 100644
index 0000000000..01e42c03bb
@@ -0,0 +1,46 @@
+From 9d09ce14b4eef2b56f24660fd69a44acd45128b2 Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:38:14 +0100
+Subject: [PATCH] Make sure global symbol is not an indirect or warning.
+
+Problem identified in the context of glibc with latest upstream binutils.
+Dynamic symbol space was being reserved but, no actual information for the
+symbol was being set. Data for the symbol was kept initialized with -1.
+No easy test case was possible to be created.
+
+bfd/
+2018-03-01  Cupertino Miranda <cmiranda at synopsys.com>
+
+       * elf32-arc.c (elf_arc_check_relocs): Changed.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/elf32-arc.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index 33fc72cff6e..9b72c5b4f4f 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -1960,7 +1960,12 @@ elf_arc_check_relocs (bfd *                      abfd,
+       if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol.  */
+       h = NULL;
+       else /* Global one.  */
+-      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
++      {
++        h = sym_hashes[r_symndx - symtab_hdr->sh_info];
++        while (h->root.type == bfd_link_hash_indirect
++               || h->root.type == bfd_link_hash_warning)
++          h = (struct elf_link_hash_entry *) h->root.u.i.link;
++      }
+
+
+       switch (r_type)
+--
+2.14.4
+
meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch new file +40 -1
new file mode 100644
index 0000000000..9e942399c0
@@ -0,0 +1,40 @@
+From e4861c68067cb2166b4c2bb9c052abeb6ad9aaa1 Mon Sep 17 00:00:00 2001
+From: Cupertino Miranda <cmiranda at synopsys.com>
+Date: Fri, 2 Mar 2018 17:44:29 +0100
+Subject: [PATCH] PLT information was still being generated when symbol was
+ forced_local.
+
+A change upstream reveiled this issue, triggering an assert when linking glibc.
+
+bfd/
+2018-03-01  Cupertino Miranda <cmiranda at synopsys.com>
+
+       * elf32-arc.c (elf_arc_check_relocs): Changed.
+
+Signed-off-by: Cupertino Miranda <cmiranda at synopsys.com>
+Signed-off-by: Alexey Brodkin <abrodkin at synopsys.com>
+[Romain: rebase on top of 2.31]
+Signed-off-by: Romain Naour <romain.naour at gmail.com>
+
+Upstream-Status: Pending
+---
+ bfd/elf32-arc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
+index 9b72c5b4f4f..b40b463d34d 100644
+--- a/bfd/elf32-arc.c
++++ b/bfd/elf32-arc.c
+@@ -2041,7 +2041,8 @@ elf_arc_check_relocs (bfd *                       abfd,
+         if (h == NULL)
+           continue;
+         else
+-          h->needs_plt = 1;
++          if(h->forced_local == 0)
++            h->needs_plt = 1;
+       }
+
+       /* Add info to the symbol got_entry_list.  */
+--
+2.14.4
+
--

2.16.2

--
_______________________________________________
Openembedded-core mailing list
Openembedded-core at lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#16 lore raw

PATCH v2 8/9 binutils: Fix Glibc building for ARC

Hi Ross,

Quoted 2 lines · Ross

I don't like accumulating pending patches for something as key as binutils, are these actually working their way upstream now?

Sure they are!

Our team development is very upstream targeted, i.e. we try to submit all our changes upstream. But with Binutils we're lagging behind upstream a bit because recently we made some significant reworks and now catching up with upstream.

What's more my colleague Claudiu Zissulescu recently became official Binutils maintainer for ARC, see
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=02d7a79e1b93240729a52246432d9a84583bcf82
so I expect less and less patches for ARC will be "pending".

Not sure though if that makes much sense.

-Alexey

#17 lore raw

PATCH v2 8/9 binutils: Fix Glibc building for ARC

That's good to know, thanks.

Ross

Quoted 22 lines · Alexey Brodkin

Hi Ross,

Quoted 2 lines · Ross

I don't like accumulating pending patches for something as key as binutils, are these actually working their way upstream now?

Sure they are!

Our team development is very upstream targeted, i.e. we try to submit all our changes upstream. But with Binutils we're lagging behind upstream a bit because recently we made some significant reworks and now catching up with upstream.

What's more my colleague Claudiu Zissulescu recently became official Binutils maintainer for ARC, see
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=02d7a79e1b93240729a52246432d9a84583bcf82
so I expect less and less patches for ARC will be "pending".

Not sure though if that makes much sense.

-Alexey

#18 lore raw

PATCH v2 9/9 gcc: Fix specs generation for ARC

In reply to Alexey Brodkin

GCC's built-in spec for LD is missing a space after "--eh-frame-hdr" thus with the next option merged together they are not understood by LD and so LD fails.

Back-port from upstream GCC, see:
https://github.com/gcc-mirror/gcc/commit/892142379c6b99fe8c3ebdfe0b79e2a435228c1d

Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>

---

Changes v1 -> v2:

* Added upstream status

 meta/recipes-devtools/gcc/gcc-8.2.inc              |  1 +
 .../gcc/gcc-8.2/0041-ARC-fix-spec-gen.patch        | 44 ++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-8.2/0041-ARC-fix-spec-gen.patch
meta/recipes-devtools/gcc/gcc-8.2.inc +1 -0
index 889187e9c4..866a77558b 100644
@@ -69,6 +69,7 @@ SRC_URI = "\
            file://0038-fix-segmentation-fault-in-precompiled-header-generat.patch \
            file://0039-Fix-for-testsuite-failure.patch \
            file://0040-Re-introduce-spe-commandline-options.patch \
+           file://0041-ARC-fix-spec-gen.patch \
            ${BACKPORTS} \
 "
 BACKPORTS = "\
meta/recipes-devtools/gcc/gcc-8.2/0041-ARC-fix-spec-gen.patch new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.16.2