Skip to contentSkip to conversation

Fix binutils bug 21464 and remove it

PATCH New Giulio Benetti 5 participants 22 messages May 3, 2021 – Jul 18, 2021

lore
Share & tools
lore
#0 lore raw

cover Fix binutils bug 21464 and remove it

This patchset fixes binutils bug 21464 and fixes libgeos build failure by introducing the gcc option flag -mcmodel. This is done by adding upstreamed binutils and gcc patches. Note tha this way buildroot toolchains can be considered bug binutils 21464 free and the only other OpenRisc toolchain supported is the external Bootlin one. So this patchset has to be considered valid once Bootlin updates its OpenRisc by adding binutils and gcc patches that are added with patches in this patchset.

Giulio Benetti (9):
package/binutils: update or1k patches for plt link version with
upstream
package/binutils: add upstream backported patches to support
-mcmodel=large gcc option
package/gcc: add upstream patches that introduce -mcmodel=large option
for or1k
package/libgeos: fix build failure due to missing -mcmodel=large package/protobuf: fix build failure due to missing -mcmodel=large
toolchain: remove binutils bug 21464
package/libgeos: remove binutils bug 21464 dependency package/postgis: remove libgeos binutils bug 21464 inheritance package/protobuf: remove binutils bug 21464 dependency

 .../0010-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...-mcmodel-option-to-handle-large-GOTs.patch | 200 +++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 +++
 ...-mcmodel-option-to-handle-large-GOTs.patch | 201 +++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 +++
 package/libgeos/Config.in                     |   4 +-
 package/libgeos/libgeos.mk                    |   4 +
 package/postgis/Config.in                     |   4 +-
 package/protobuf/Config.in                    |   1 -
 package/protobuf/protobuf.mk                  |   4 +
 toolchain/Config.in                           |   6 -
 30 files changed, 4035 insertions(+), 153 deletions(-)
 delete mode 100644 package/binutils/2.32/0010-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.32/0010-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.34/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.34/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.35.2/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.35.2/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.36.1/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.36.1/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/gcc/10.3.0/0002-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/10.3.0/0003-or1k-Use-cmodel-large-when-building-crtstuff.patch
 create mode 100644 package/gcc/9.3.0/0006-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/9.3.0/0007-or1k-Use-cmodel-large-when-building-crtstuff.patch
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/9 package/binutils: update or1k patches for plt link version with upstream

Actual patches are stubs suggested but now they are available as upstream. So let's substitute them since they make part of a or1k patchset and next patch will add the others.

---
 .../0010-bfd-elf32-or1k-fix-ld-assert.patch   | 35 -----------
 ...ith-plt-link-failure-for-local-calls.patch | 59 +++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   | 35 -----------
 ...ith-plt-link-failure-for-local-calls.patch | 59 +++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   | 35 -----------
 ...ith-plt-link-failure-for-local-calls.patch | 59 +++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   | 35 -----------
 ...ith-plt-link-failure-for-local-calls.patch | 59 +++++++++++++++++++
 8 files changed, 236 insertions(+), 140 deletions(-)
 delete mode 100644 package/binutils/2.32/0010-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.32/0010-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 delete mode 100644 package/binutils/2.34/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.34/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 delete mode 100644 package/binutils/2.35.2/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.35.2/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 delete mode 100644 package/binutils/2.36.1/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.36.1/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
package/binutils/2.32/0010-bfd-elf32-or1k-fix-ld-assert.patch deleted +0 -35
deleted file mode 100644
index 824c9ce3e5..0000000000
@@ -1,35 +0,0 @@
-From 93cf62b662499e560812145dd989056fcf14f00e Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <[email protected]>
-Date: Mon, 22 Mar 2021 13:30:07 +0100
-Subject: [PATCH] bfd/elf32-or1k: fix ld assert
-
-Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
-
-Signed-off-by: Giulio Benetti <[email protected]>
----
- bfd/elf32-or1k.c | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
-index 2f200b197b..ae508540f5 100644
---- a/bfd/elf32-or1k.c
-+++ b/bfd/elf32-or1k.c
-@@ -2535,11 +2535,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
-   if (h->type == STT_FUNC
-       || h->needs_plt)
-     {
--      if (! bfd_link_pic (info)
--	  && !h->def_dynamic
--	  && !h->ref_dynamic
--	  && h->root.type != bfd_link_hash_undefweak
--	  && h->root.type != bfd_link_hash_undefined)
-+      if (h->plt.refcount <= 0
-+         || (SYMBOL_CALLS_LOCAL (info, h)
-+         || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-+             && h->root.type == bfd_link_hash_undefweak)))
- 	{
- 	  /* This case can occur if we saw a PLT reloc in an input
- 	     file, but the symbol was never referred to by a dynamic
--- 
-2.25.1
-
package/binutils/2.32/0010-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch new file +59 -0

59 lines not on this page · raw message

package/binutils/2.34/0003-bfd-elf32-or1k-fix-ld-assert.patch deleted +0 -35
deleted file mode 100644
index 756493667f..0000000000
@@ -1,35 +0,0 @@
-From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <[email protected]>
-Date: Mon, 22 Mar 2021 13:30:07 +0100
-Subject: [PATCH] bfd/elf32-or1k: fix ld assert
-
-Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
-
-Signed-off-by: Giulio Benetti <[email protected]>
----
- bfd/elf32-or1k.c | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
-index 65938e5137..41908f8938 100644
---- a/bfd/elf32-or1k.c
-+++ b/bfd/elf32-or1k.c
-@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
-   if (h->type == STT_FUNC
-       || h->needs_plt)
-     {
--      if (! bfd_link_pic (info)
--	  && !h->def_dynamic
--	  && !h->ref_dynamic
--	  && h->root.type != bfd_link_hash_undefweak
--	  && h->root.type != bfd_link_hash_undefined)
-+      if (h->plt.refcount <= 0
-+         || (SYMBOL_CALLS_LOCAL (info, h)
-+         || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-+             && h->root.type == bfd_link_hash_undefweak)))
- 	{
- 	  /* This case can occur if we saw a PLT reloc in an input
- 	     file, but the symbol was never referred to by a dynamic
--- 
-2.25.1
-
package/binutils/2.34/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch new file +59 -0

59 lines not on this page · raw message

package/binutils/2.35.2/0003-bfd-elf32-or1k-fix-ld-assert.patch deleted +0 -35
deleted file mode 100644
index 756493667f..0000000000
@@ -1,35 +0,0 @@
-From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <[email protected]>
-Date: Mon, 22 Mar 2021 13:30:07 +0100
-Subject: [PATCH] bfd/elf32-or1k: fix ld assert
-
-Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
-
-Signed-off-by: Giulio Benetti <[email protected]>
----
- bfd/elf32-or1k.c | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
-index 65938e5137..41908f8938 100644
---- a/bfd/elf32-or1k.c
-+++ b/bfd/elf32-or1k.c
-@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
-   if (h->type == STT_FUNC
-       || h->needs_plt)
-     {
--      if (! bfd_link_pic (info)
--	  && !h->def_dynamic
--	  && !h->ref_dynamic
--	  && h->root.type != bfd_link_hash_undefweak
--	  && h->root.type != bfd_link_hash_undefined)
-+      if (h->plt.refcount <= 0
-+         || (SYMBOL_CALLS_LOCAL (info, h)
-+         || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-+             && h->root.type == bfd_link_hash_undefweak)))
- 	{
- 	  /* This case can occur if we saw a PLT reloc in an input
- 	     file, but the symbol was never referred to by a dynamic
--- 
-2.25.1
-
package/binutils/2.35.2/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch new file +59 -0

59 lines not on this page · raw message

package/binutils/2.36.1/0003-bfd-elf32-or1k-fix-ld-assert.patch deleted +0 -35
deleted file mode 100644
index 756493667f..0000000000
@@ -1,35 +0,0 @@
-From 1659226a96b1daecfd08c057d0d5c39309d207ee Mon Sep 17 00:00:00 2001
-From: Giulio Benetti <[email protected]>
-Date: Mon, 22 Mar 2021 13:30:07 +0100
-Subject: [PATCH] bfd/elf32-or1k: fix ld assert
-
-Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=27624
-
-Signed-off-by: Giulio Benetti <[email protected]>
----
- bfd/elf32-or1k.c | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
-diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
-index 65938e5137..41908f8938 100644
---- a/bfd/elf32-or1k.c
-+++ b/bfd/elf32-or1k.c
-@@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
-   if (h->type == STT_FUNC
-       || h->needs_plt)
-     {
--      if (! bfd_link_pic (info)
--	  && !h->def_dynamic
--	  && !h->ref_dynamic
--	  && h->root.type != bfd_link_hash_undefweak
--	  && h->root.type != bfd_link_hash_undefined)
-+      if (h->plt.refcount <= 0
-+         || (SYMBOL_CALLS_LOCAL (info, h)
-+         || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
-+             && h->root.type == bfd_link_hash_undefweak)))
- 	{
- 	  /* This case can occur if we saw a PLT reloc in an input
- 	     file, but the symbol was never referred to by a dynamic
--- 
-2.25.1
-
package/binutils/2.36.1/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

In reply to Giulio Benetti

Add upstream backported patches that allows using -mcmodel=large gcc option that in order allows fixing build failure due to binutils bug 21464:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 12 files changed, 3268 insertions(+)
 create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch new file +256 -0
new file mode 100644
index 0000000000..2ea3c3e7ac
@@ -0,0 +1,256 @@
+From b10e6230dea0015bf3b7748580b82c551f9a3a4a Mon Sep 17 00:00:00 2001
+From: Stafford Horne <[email protected]>
+Date: Sun, 2 May 2021 06:02:15 +0900
+Subject: [PATCH 11/13] or1k: Implement relocation R_OR1K_GOT_AHI16 for gotha()
+
+The gotha() relocation mnemonic will be outputted by OpenRISC GCC when
+using the -mcmodel=large option.  This relocation is used along with
+got() to generate 32-bit GOT offsets.  This increases the previous GOT
+offset limit from the previous 16-bit (64K) limit.
+
+This is needed on large binaries where the GOT grows larger than 64k.
+
+bfd/ChangeLog:
+
+	PR 21464
+	* bfd-in2.h: Add BFD_RELOC_OR1K_GOT_AHI16 relocation.
+	* elf32-or1k.c (or1k_elf_howto_table, or1k_reloc_map): Likewise.
+	(or1k_final_link_relocate, or1k_elf_relocate_section,
+	or1k_elf_check_relocs): Likewise.
+	* libbfd.h (bfd_reloc_code_real_names): Likewise.
+	* reloc.c: Likewise.
+
+cpu/ChangeLog:
+
+	PR 21464
+	* or1k.opc (or1k_imm16_relocs, parse_reloc): Define parse logic
+	for gotha() relocation.
+
+include/ChangeLog:
+
+	PR 21464
+	* elf/or1k.h (elf_or1k_reloc_type): Define R_OR1K_GOT_AHI16 number.
+
+opcodes/ChangeLog:
+
+	PR 21464
+	* or1k-asm.c: Regenerate.
+
+gas/ChangeLog:
+
+	PR 21464
+	* testsuite/gas/or1k/reloc-1.s: Add test for new relocation.
+	* testsuite/gas/or1k/reloc-1.d: Add test result for new
+	relocation.
+
+Cc: Giulio Benetti <[email protected]>
+
+fixup reloc, add tests
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/bfd-in2.h                    |  1 +
+ bfd/elf32-or1k.c                 | 21 ++++++++++++++++++++-
+ bfd/libbfd.h                     |  1 +
+ bfd/reloc.c                      |  2 ++
+ cpu/or1k.opc                     |  7 ++++++-
+ gas/testsuite/gas/or1k/reloc-1.d |  4 +++-
+ gas/testsuite/gas/or1k/reloc-1.s |  4 ++++
+ include/elf/or1k.h               |  1 +
+ opcodes/or1k-asm.c               |  7 ++++++-
+ 9 files changed, 44 insertions(+), 4 deletions(-)
+
+diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
+index e25da50aafb..530a41fca43 100644
+--- a/bfd/bfd-in2.h
++++ b/bfd/bfd-in2.h
+@@ -5517,6 +5517,7 @@ then it may be truncated to 8 bits.  */
+   BFD_RELOC_OR1K_TLS_TPOFF,
+   BFD_RELOC_OR1K_TLS_DTPOFF,
+   BFD_RELOC_OR1K_TLS_DTPMOD,
++  BFD_RELOC_OR1K_GOT_AHI16,
+ 
+ /* H8 elf Relocations.  */
+   BFD_RELOC_H8_DIR16A8,
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 1f2c88b0b3a..a4a64f73b7c 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -808,6 +808,20 @@ static reloc_howto_type or1k_elf_howto_table[] =
+ 	 0,			/* Source Mask.  */
+ 	 0x03ffffff,		/* Dest Mask.  */
+ 	 TRUE),			/* PC relative offset?  */
++
++  HOWTO (R_OR1K_GOT_AHI16,     /* type */
++	16,                    /* rightshift */
++	2,                     /* size (0 = byte, 1 = short, 2 = long) */
++	16,                    /* bitsize */
++	FALSE,                 /* pc_relative */
++	0,                     /* bitpos */
++	complain_overflow_signed, /* complain_on_overflow */
++	bfd_elf_generic_reloc, /* special_function */
++	"R_OR1K_GOT_AHI16",    /* name */
++	FALSE,                 /* partial_inplace */
++	0,                     /* src_mask */
++	0xffff,                /* dst_mask */
++	FALSE),                /* pcrel_offset */
+ };
+ 
+ /* Map BFD reloc types to Or1k ELF reloc types.  */
+@@ -871,6 +885,7 @@ static const struct or1k_reloc_map or1k_reloc_map[] =
+   { BFD_RELOC_OR1K_TLS_IE_LO13,	R_OR1K_TLS_IE_LO13 },
+   { BFD_RELOC_OR1K_SLO13,	R_OR1K_SLO13 },
+   { BFD_RELOC_OR1K_PLTA26,	R_OR1K_PLTA26 },
++  { BFD_RELOC_OR1K_GOT_AHI16,	R_OR1K_GOT_AHI16 },
+ };
+ 
+ #define TLS_UNKNOWN    0
+@@ -1080,6 +1095,7 @@ or1k_final_link_relocate (reloc_howto_type *howto, bfd *input_bfd,
+   switch (howto->type)
+     {
+     case R_OR1K_AHI16:
++    case R_OR1K_GOT_AHI16:
+     case R_OR1K_GOTOFF_AHI16:
+     case R_OR1K_TLS_IE_AHI16:
+     case R_OR1K_TLS_LE_AHI16:
+@@ -1344,6 +1360,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
+ 	    }
+ 	  break;
+ 
++	case R_OR1K_GOT_AHI16:
+ 	case R_OR1K_GOT16:
+ 	case R_OR1K_GOT_PG21:
+ 	case R_OR1K_GOT_LO13:
+@@ -1435,7 +1452,8 @@ or1k_elf_relocate_section (bfd *output_bfd,
+ 	    /* The GOT_PG21 and GOT_LO13 relocs are pc-relative,
+ 	       while the GOT16 reloc is GOT relative.  */
+ 	    relocation = got_base + off;
+-	    if (r_type == R_OR1K_GOT16)
++	    if (r_type == R_OR1K_GOT16
++		|| r_type == R_OR1K_GOT_AHI16)
+ 	      relocation -= got_sym_value;
+ 
+ 	  /* Addend should be zero.  */
+@@ -1945,6 +1963,7 @@ or1k_elf_check_relocs (bfd *abfd,
+ 	    }
+ 	  break;
+ 
++	case R_OR1K_GOT_AHI16:
+ 	case R_OR1K_GOT16:
+ 	case R_OR1K_GOT_PG21:
+ 	case R_OR1K_GOT_LO13:
+diff --git a/bfd/libbfd.h b/bfd/libbfd.h
+index 36284d71a9b..6e9e3190bb8 100644
+--- a/bfd/libbfd.h
++++ b/bfd/libbfd.h
+@@ -2702,6 +2702,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
+   "BFD_RELOC_OR1K_TLS_TPOFF",
+   "BFD_RELOC_OR1K_TLS_DTPOFF",
+   "BFD_RELOC_OR1K_TLS_DTPMOD",
++  "BFD_RELOC_OR1K_GOT_AHI16",
+   "BFD_RELOC_H8_DIR16A8",
+   "BFD_RELOC_H8_DIR16R8",
+   "BFD_RELOC_H8_DIR24A8",
+diff --git a/bfd/reloc.c b/bfd/reloc.c
+index e6446a78098..b0003ab1175 100644
+--- a/bfd/reloc.c
++++ b/bfd/reloc.c
+@@ -6164,6 +6164,8 @@ ENUMX
+   BFD_RELOC_OR1K_GOTPC_HI16
+ ENUMX
+   BFD_RELOC_OR1K_GOTPC_LO16
++ENUMX
++  BFD_RELOC_OR1K_GOT_AHI16
+ ENUMX
+   BFD_RELOC_OR1K_GOT16
+ ENUMX
+diff --git a/cpu/or1k.opc b/cpu/or1k.opc
+index 5082a30cee1..85163fc96c9 100644
+--- a/cpu/or1k.opc
++++ b/cpu/or1k.opc
+@@ -173,7 +173,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
+     BFD_RELOC_OR1K_GOT_LO13,
+     BFD_RELOC_UNUSED,
+     BFD_RELOC_UNUSED,
+-    BFD_RELOC_UNUSED },
++    BFD_RELOC_OR1K_GOT_AHI16 },
+   { BFD_RELOC_OR1K_GOTPC_LO16,
+     BFD_RELOC_UNUSED,
+     BFD_RELOC_UNUSED,
+@@ -276,6 +276,11 @@ parse_reloc (const char **strp)
+ 	str += 5;
+ 	cls = RCLASS_TPOFF;
+       }
++    else if (strncasecmp (str, "got", 3) == 0)
++      {
++	str += 3;
++	cls = RCLASS_GOT;
++      }
+ 
+     if (strncasecmp (str, "hi(", 3) == 0)
+       {
+diff --git a/gas/testsuite/gas/or1k/reloc-1.d b/gas/testsuite/gas/or1k/reloc-1.d
+index d1bcf5608bb..3a001c4ed99 100644
+--- a/gas/testsuite/gas/or1k/reloc-1.d
++++ b/gas/testsuite/gas/or1k/reloc-1.d
+@@ -68,5 +68,7 @@ OFFSET   TYPE              VALUE
+ 000000ec R_OR1K_LO13       x
+ 000000f0 R_OR1K_GOT_LO13   x
+ 000000f4 R_OR1K_SLO13      x
+-
++000000f8 R_OR1K_GOT_AHI16  x
++000000fc R_OR1K_GOT_AHI16  x
++00000100 R_OR1K_GOT_AHI16  x
+ 
+diff --git a/gas/testsuite/gas/or1k/reloc-1.s b/gas/testsuite/gas/or1k/reloc-1.s
+index e76abef6532..562609aa869 100644
+--- a/gas/testsuite/gas/or1k/reloc-1.s
++++ b/gas/testsuite/gas/or1k/reloc-1.s
+@@ -74,3 +74,7 @@
+ 	l.lbz	r5,po(x)(r3)
+ 	l.lbz	r5,gotpo(x)(r3)
+ 	l.sb	po(x)(r3),r6
++
++	l.movhi	r4,gotha(x)
++	l.ori	r3,r4,gotha(x)
++	l.addi	r3,r4,gotha(x)
+diff --git a/include/elf/or1k.h b/include/elf/or1k.h
+index 0abef046202..7db3cad18eb 100644
+--- a/include/elf/or1k.h
++++ b/include/elf/or1k.h
+@@ -77,6 +77,7 @@ START_RELOC_NUMBERS (elf_or1k_reloc_type)
+   RELOC_NUMBER (R_OR1K_TLS_IE_LO13,   51)
+   RELOC_NUMBER (R_OR1K_SLO13,         52)
+   RELOC_NUMBER (R_OR1K_PLTA26,        53)
++  RELOC_NUMBER (R_OR1K_GOT_AHI16,     54)
+ END_RELOC_NUMBERS (R_OR1K_max)
+ 
+ #define EF_OR1K_NODELAY (1UL << 0)
+diff --git a/opcodes/or1k-asm.c b/opcodes/or1k-asm.c
+index 7d058d03f5f..332f4b7a9b5 100644
+--- a/opcodes/or1k-asm.c
++++ b/opcodes/or1k-asm.c
+@@ -177,7 +177,7 @@ static const bfd_reloc_code_real_type or1k_imm16_relocs[][6] = {
+     BFD_RELOC_OR1K_GOT_LO13,
+     BFD_RELOC_UNUSED,
+     BFD_RELOC_UNUSED,
+-    BFD_RELOC_UNUSED },
++    BFD_RELOC_OR1K_GOT_AHI16 },
+   { BFD_RELOC_OR1K_GOTPC_LO16,
+     BFD_RELOC_UNUSED,
+     BFD_RELOC_UNUSED,
+@@ -280,6 +280,11 @@ parse_reloc (const char **strp)
+ 	str += 5;
+ 	cls = RCLASS_TPOFF;
+       }
++    else if (strncasecmp (str, "got", 3) == 0)
++      {
++	str += 3;
++	cls = RCLASS_GOT;
++      }
+ 
+     if (strncasecmp (str, "hi(", 3) == 0)
+       {
+-- 
+2.25.1
+
package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch new file +61 -0

61 lines not on this page · raw message

package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch new file +500 -0

500 lines not on this page · raw message

package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch new file +256 -0

256 lines not on this page · raw message

package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch new file +61 -0

61 lines not on this page · raw message

package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch new file +500 -0

500 lines not on this page · raw message

package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch new file +256 -0

256 lines not on this page · raw message

package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch new file +61 -0

61 lines not on this page · raw message

package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch new file +500 -0

500 lines not on this page · raw message

package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch new file +256 -0

256 lines not on this page · raw message

package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch new file +61 -0

61 lines not on this page · raw message

package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch new file +500 -0

232 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.25.1

Part of the diff is not shown here. View the raw message.

#3 lore raw

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

Hi Giulio, All,

Le 03/05/2021 ? 13:13, Giulio Benetti a ?crit?:

Quoted 33 lines

Add upstream backported patches that allows using -mcmodel=large gcc option that in order allows fixing build failure due to binutils bug 21464:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 12 files changed, 3268 insertions(+)
 create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
Quoted 8 lines
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+-  unsigned insn4;
++  unsigned output_insns[PLT_MAX_INSN_COUNT];

++
++ /* Copy instructions into the output buffer. */ ++ for (size_t i = 0; i < insn_count; i++)
++ output_insns[i] = insns[i];
+

This syntax break with good old compilers :)

elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for (size_t i = 0; i < insn_count; i++)
^

See:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

Best regards,
Romain

#4 lore raw

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

Hi Romain,

Quoted 47 lines · Romain Naour

Hi Giulio, All,

Le 03/05/2021 ? 13:13, Giulio Benetti a ?crit?:

Quoted 33 lines

Add upstream backported patches that allows using -mcmodel=large gcc option that in order allows fixing build failure due to binutils bug 21464:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
  ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
  ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
  ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
  ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
  ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
  ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
  ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
  ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
  ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
  ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
  ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
  ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
  12 files changed, 3268 insertions(+)

create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch line 122

Quoted 8 lines
package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch new file +8 -0
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+-  unsigned insn4;
++  unsigned output_insns[PLT_MAX_INSN_COUNT];
++
++  /* Copy instructions into the output buffer.  */
++  for (size_t i = 0; i < insn_count; i++)
++    output_insns[i] = insns[i];
+

This syntax break with good old compilers :)

Quoted 7 lines

elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode

    for (size_t i = 0; i < insn_count; i++)
    ^

See:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

Thanks for pointing, I didn't think about old host compiler. I'm going to fix it soon by patching actual patches initializing variable at the begin of functions.

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 7 lines

Best regards,
Romain
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

Hi Giulio,

Le 09/06/2021 ? 00:16, Giulio Benetti a ?crit?:

Quoted 79 lines

Hi Romain,

Quoted 76 lines · Romain Naour

Hi Giulio, All,

Le 03/05/2021 ? 13:13, Giulio Benetti a ?crit?:

Quoted 57 lines

Add upstream backported patches that allows using -mcmodel=large gcc option that in order allows fixing build failure due to binutils bug 21464:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---

? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++

? 12 files changed, 3268 insertions(+)
? create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

Quoted 8 lines

+?? unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY; +-? unsigned insn4;
++? unsigned output_insns[PLT_MAX_INSN_COUNT];
++
++? /* Copy instructions into the output buffer.? */
++? for (size_t i = 0; i < insn_count; i++)
++??? output_insns[i] = insns[i];
+

This syntax break with good old compilers :)

elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
??? for (size_t i = 0; i < insn_count; i++)
??? ^

Quoted 6 lines
Quoted 2 lines

See:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

Thanks for pointing, I didn't think about old host compiler. I'm going to fix it soon by patching actual patches initializing variable at the
begin of functions.

Toolchain-builder use Debian 8 jessie to build the toolchain while Debian 9 stretch is used to run the Buildroot testsuite.

See, there is no problem to build the qemu_or1k_defconfig in gitlab using stretch:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1307293494

The host gcc used by stretch is gcc 6 while it's gcc 4.9 for jessie, the default mode for C is -std=gnu11 since gcc 5:
https://gcc.gnu.org/gcc-5/changes.html

Thanks!

Best regards,
Romain

Quoted 2 lines

Best regards

#6 lore raw

PATCH 1/1 package/binutils: fix building or1k with host gcc version < 5

Add patches to fix building on hosts that provide gcc version < 5 (i.e. 4.9), otherwise they fail due to missing default '-std=gnu11' option on variable declaration inside for loops.

The patch is pending upstream:
https://sourceware.org/pipermail/binutils/2021-June/116884.html

---
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0
new file mode 100644
index 0000000000..c3978e22fa
@@ -0,0 +1,50 @@
+From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 9 Jun 2021 17:28:27 +0200
+Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
+
+Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
+an old compiler(i.e. gcc 4.9) build fails on:
+```
+elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
+C99 or C11 mode
+    for (size_t i = 0; i < insn_count; i++)
+    ^
+```
+
+So let's declare `size_t i` at the top of the function instead of inside
+for loop.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-or1k.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 4ae7f324d33..32063ab0289 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+ {
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+   unsigned output_insns[PLT_MAX_INSN_COUNT];
++  size_t i;
+ 
+   /* Copy instructions into the output buffer.  */
+-  for (size_t i = 0; i < insn_count; i++)
++  for (i = 0; i < insn_count; i++)
+     output_insns[i] = insns[i];
+ 
+   /* Honor the no-delay-slot setting.  */
+@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+     }
+ 
+   /* Write out the output buffer.  */
+-  for (size_t i = 0; i < (insn_count+1); i++)
++  for (i = 0; i < (insn_count+1); i++)
+     bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
+ }
+ 
+-- 
+2.25.1
+
package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0

50 lines not on this page · raw message

package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0

50 lines not on this page · raw message

package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0

50 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

PATCH 1/1 package/binutils: fix building or1k with host gcc version < 5

Hi Giulio,

Le 09/06/2021 ? 18:27, Giulio Benetti a ?crit?:

Quoted 8 lines

Add patches to fix building on hosts that provide gcc version < 5 (i.e. 4.9), otherwise they fail due to missing default '-std=gnu11' option on variable declaration inside for loops.

The patch is pending upstream:
https://sourceware.org/pipermail/binutils/2021-June/116884.html

Best regards,
Romain

Quoted 236 lines
---
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0
new file mode 100644
index 0000000000..c3978e22fa
@@ -0,0 +1,50 @@
+From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 9 Jun 2021 17:28:27 +0200
+Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
+
+Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
+an old compiler(i.e. gcc 4.9) build fails on:
+```
+elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
+C99 or C11 mode
+    for (size_t i = 0; i < insn_count; i++)
+    ^
+```
+
+So let's declare `size_t i` at the top of the function instead of inside
+for loop.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-or1k.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 4ae7f324d33..32063ab0289 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+ {
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+   unsigned output_insns[PLT_MAX_INSN_COUNT];
++  size_t i;
+ 
+   /* Copy instructions into the output buffer.  */
+-  for (size_t i = 0; i < insn_count; i++)
++  for (i = 0; i < insn_count; i++)
+     output_insns[i] = insns[i];
+ 
+   /* Honor the no-delay-slot setting.  */
+@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+     }
+ 
+   /* Write out the output buffer.  */
+-  for (size_t i = 0; i < (insn_count+1); i++)
++  for (i = 0; i < (insn_count+1); i++)
+     bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
+ }
+ 
+-- 
+2.25.1
+
package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0
new file mode 100644
index 0000000000..c3978e22fa
@@ -0,0 +1,50 @@
+From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 9 Jun 2021 17:28:27 +0200
+Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
+
+Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
+an old compiler(i.e. gcc 4.9) build fails on:
+```
+elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
+C99 or C11 mode
+    for (size_t i = 0; i < insn_count; i++)
+    ^
+```
+
+So let's declare `size_t i` at the top of the function instead of inside
+for loop.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-or1k.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 4ae7f324d33..32063ab0289 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+ {
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+   unsigned output_insns[PLT_MAX_INSN_COUNT];
++  size_t i;
+ 
+   /* Copy instructions into the output buffer.  */
+-  for (size_t i = 0; i < insn_count; i++)
++  for (i = 0; i < insn_count; i++)
+     output_insns[i] = insns[i];
+ 
+   /* Honor the no-delay-slot setting.  */
+@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+     }
+ 
+   /* Write out the output buffer.  */
+-  for (size_t i = 0; i < (insn_count+1); i++)
++  for (i = 0; i < (insn_count+1); i++)
+     bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
+ }
+ 
+-- 
+2.25.1
+
package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0
new file mode 100644
index 0000000000..c3978e22fa
@@ -0,0 +1,50 @@
+From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 9 Jun 2021 17:28:27 +0200
+Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
+
+Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
+an old compiler(i.e. gcc 4.9) build fails on:
+```
+elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
+C99 or C11 mode
+    for (size_t i = 0; i < insn_count; i++)
+    ^
+```
+
+So let's declare `size_t i` at the top of the function instead of inside
+for loop.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-or1k.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 4ae7f324d33..32063ab0289 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+ {
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+   unsigned output_insns[PLT_MAX_INSN_COUNT];
++  size_t i;
+ 
+   /* Copy instructions into the output buffer.  */
+-  for (size_t i = 0; i < insn_count; i++)
++  for (i = 0; i < insn_count; i++)
+     output_insns[i] = insns[i];
+ 
+   /* Honor the no-delay-slot setting.  */
+@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+     }
+ 
+   /* Write out the output buffer.  */
+-  for (size_t i = 0; i < (insn_count+1); i++)
++  for (i = 0; i < (insn_count+1); i++)
+     bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
+ }
+ 
+-- 
+2.25.1
+
package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch new file +50 -0
new file mode 100644
index 0000000000..c3978e22fa
@@ -0,0 +1,50 @@
+From c3003947e4bad18faea4337fd2073feeb30ee078 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 9 Jun 2021 17:28:27 +0200
+Subject: [PATCH] bfd/elf32-or1k: fix building with gcc version < 5
+
+Gcc version >= 5 has standard C mode not set to -std=gnu11, so if we use
+an old compiler(i.e. gcc 4.9) build fails on:
+```
+elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
+C99 or C11 mode
+    for (size_t i = 0; i < insn_count; i++)
+    ^
+```
+
+So let's declare `size_t i` at the top of the function instead of inside
+for loop.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bfd/elf32-or1k.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
+index 4ae7f324d33..32063ab0289 100644
+--- a/bfd/elf32-or1k.c
++++ b/bfd/elf32-or1k.c
+@@ -2244,9 +2244,10 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+ {
+   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
+   unsigned output_insns[PLT_MAX_INSN_COUNT];
++  size_t i;
+ 
+   /* Copy instructions into the output buffer.  */
+-  for (size_t i = 0; i < insn_count; i++)
++  for (i = 0; i < insn_count; i++)
+     output_insns[i] = insns[i];
+ 
+   /* Honor the no-delay-slot setting.  */
+@@ -2277,7 +2278,7 @@ or1k_write_plt_entry (bfd *output_bfd, bfd_byte *contents, unsigned insnj,
+     }
+ 
+   /* Write out the output buffer.  */
+-  for (size_t i = 0; i < (insn_count+1); i++)
++  for (i = 0; i < (insn_count+1); i++)
+     bfd_put_32 (output_bfd, output_insns[i], contents + (i*4));
+ }
+ 
+-- 
+2.25.1
+
#8 lore raw

PATCH 1/1 package/binutils: fix building or1k with host gcc version < 5

In reply to Giulio Benetti
Quoted 8 lines · On Wed, 9 Jun 2021 18:27:53 +0200 Giulio Benetti…

Add patches to fix building on hosts that provide gcc version < 5 (i.e. 4.9), otherwise they fail due to missing default '-std=gnu11' option on variable declaration inside for loops.

The patch is pending upstream:
https://sourceware.org/pipermail/binutils/2021-June/116884.html

Quoted 10 lines
---
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 ...or1k-fix-building-with-gcc-version-5.patch | 50 +++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 package/binutils/2.32/0014-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.34/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.35.2/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch
 create mode 100644 package/binutils/2.36.1/0007-bfd-elf32-or1k-fix-building-with-gcc-version-5.patch

Applied to master, thanks.

Thomas

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

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

In reply to Romain Naour

Hi Romain, All,

Quoted 92 lines · Romain Naour

Hi Giulio,

Le 09/06/2021 ? 00:16, Giulio Benetti a ?crit?:

Quoted 79 lines

Hi Romain,

Quoted 76 lines · Romain Naour

Hi Giulio, All,

Le 03/05/2021 ? 13:13, Giulio Benetti a ?crit?:

Quoted 57 lines

Add upstream backported patches that allows using -mcmodel=large gcc option that in order allows fixing build failure due to binutils bug 21464:
https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 ? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
 ? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
 ? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
 ? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ? ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ? ...K_GOT16-overflow-failures-in-presenc.patch |? 61 +++
 ? ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++

? 12 files changed, 3268 insertions(+)
? create mode 100644
package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644
package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644
package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644
package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644
package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644
package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644
package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644
package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644
package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

? create mode 100644
package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch

? create mode 100644
package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch

? create mode 100644
package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch

Quoted 8 lines

+?? unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY; +-? unsigned insn4;
++? unsigned output_insns[PLT_MAX_INSN_COUNT];
++
++? /* Copy instructions into the output buffer.? */
++? for (size_t i = 0; i < insn_count; i++)
++??? output_insns[i] = insns[i];
+

This syntax break with good old compilers :)

elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
??? for (size_t i = 0; i < insn_count; i++)
??? ^

Quoted 6 lines
Quoted 2 lines

See:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

Thanks for pointing, I didn't think about old host compiler. I'm going to fix it soon by patching actual patches initializing variable at the
begin of functions.

Toolchain-builder use Debian 8 jessie to build the toolchain while Debian 9 stretch is used to run the Buildroot testsuite.

Quoted 6 lines

See, there is no problem to build the qemu_or1k_defconfig in gitlab using stretch:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1307293494

The host gcc used by stretch is gcc 6 while it's gcc 4.9 for jessie, the default mode for C is -std=gnu11 since gcc 5:
https://gcc.gnu.org/gcc-5/changes.html

Here is the patch that fixes that issue [1]

I've tested it on Debian Jessie and it works fine(while before I've encountered your same problem).

It's pending upstream[2], this is why I've decided to add a new patch instead of modifying the current one.

Does it sound good for you?

[1]:
https://patchwork.ozlabs.org/project/buildroot/patch/20210609162753.1138390-1-giulio.benetti at benettiengineering.com/

[2]: https://sourceware.org/pipermail/binutils/2021-June/116884.html

Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
#10 lore raw

PATCH 2/9 package/binutils: add upstream backported patches to support -mcmodel=large gcc option

Hello Giulio,

Le 09/06/2021 ? 18:50, Giulio Benetti a ?crit?:

Quoted 11 lines

Hi Romain, All,

Quoted 8 lines · Romain Naour

Hi Giulio,

Le 09/06/2021 ? 00:16, Giulio Benetti a ?crit?:

Quoted 5 lines

Hi Romain,

Quoted 2 lines · Romain Naour

Hi Giulio, All,

[...]

Quoted 36 lines
Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines

+?? unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY; +-? unsigned insn4;
++? unsigned output_insns[PLT_MAX_INSN_COUNT];
++
++? /* Copy instructions into the output buffer.? */
++? for (size_t i = 0; i < insn_count; i++)
++??? output_insns[i] = insns[i];
+

This syntax break with good old compilers :)

elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
???? for (size_t i = 0; i < insn_count; i++)
???? ^

Quoted 6 lines
Quoted 2 lines

See:
https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298

Thanks for pointing, I didn't think about old host compiler. I'm going to fix it soon by patching actual patches initializing variable at the
begin of functions.

Toolchain-builder use Debian 8 jessie to build the toolchain while Debian 9 stretch is used to run the Buildroot testsuite.

Quoted 7 lines

See, there is no problem to build the qemu_or1k_defconfig in gitlab using stretch:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1307293494

The host gcc used by stretch is gcc 6 while it's gcc 4.9 for jessie, the default mode for C is -std=gnu11 since gcc 5:
https://gcc.gnu.org/gcc-5/changes.html

Here is the patch that fixes that issue [1]

Quoted 7 lines

I've tested it on Debian Jessie and it works fine(while before I've encountered your same problem).

It's pending upstream[2], this is why I've decided to add a new patch instead of modifying the current one.

Does it sound good for you?

It's fine for me, the current patch come from upstream so we should avoid adding changes.

Thanks!

Best regards,
Romain

Quoted 8 lines

[1]:
https://patchwork.ozlabs.org/project/buildroot/patch/20210609162753.1138390-1-giulio.benetti at benettiengineering.com/

[2]: https://sourceware.org/pipermail/binutils/2021-June/116884.html

Best regards

#11 lore raw

PATCH 3/9 package/gcc: add upstream patches that introduce -mcmodel=large option for or1k

In reply to Giulio Benetti

Let's add upstream patches introducing -mcmodel=large or1k gcc option that works in conjunction with previous binutils patch. That option fix binutils bug 21464[1] allowing to build libgeos with no problem. This way we can consider buildroot toolchain binutils bug 21464 free.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=21464

---
 ...-mcmodel-option-to-handle-large-GOTs.patch | 200 +++++++++++++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 ++++++
 ...-mcmodel-option-to-handle-large-GOTs.patch | 201 ++++++++++++++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 ++++++
 4 files changed, 521 insertions(+)
 create mode 100644 package/gcc/10.3.0/0002-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/10.3.0/0003-or1k-Use-cmodel-large-when-building-crtstuff.patch
 create mode 100644 package/gcc/9.3.0/0006-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/9.3.0/0007-or1k-Use-cmodel-large-when-building-crtstuff.patch
package/gcc/10.3.0/0002-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch new file +200 -0
new file mode 100644
index 0000000000..c5cd3349cd
@@ -0,0 +1,200 @@
+From 1dad3f95ffcd1871ca670a13a06fbedb1c3ce509 Mon Sep 17 00:00:00 2001
+From: Stafford Horne <[email protected]>
+Date: Sun, 2 May 2021 06:11:44 +0900
+Subject: [PATCH 2/3] or1k: Add mcmodel option to handle large GOTs
+
+When building libgeos we get an error with:
+
+    linux-uclibc/9.3.0/crtbeginS.o: in function `__do_global_dtors_aux':
+    crtstuff.c:(.text+0x118): relocation truncated to fit: R_OR1K_GOT16 against symbol `__cxa_finalize' defined in .text section in
+    /home/shorne/work/openrisc/3eb9f9d0f6d8274b2d19753c006bd83f7d536e3c/output/host/or1k-buildroot-linux-uclibc/sysroot/lib/libc.so.
+
+This is caused by GOT code having a limit of 64k.  In OpenRISC this
+looks to be the only relocation code pattern to be limited to 64k.
+
+This patch allows specifying a new option -mcmodel=large which can be
+used to generate 2 more instructions to construct 32-bit addresses for
+up to 4G GOTs.
+
+gcc/ChangeLog:
+
+	PR 99783
+	* config/or1k/or1k-opts.h: New file.
+	* config/or1k/or1k.c (or1k_legitimize_address_1, print_reloc):
+	Support generating gotha relocations if -mcmodel=large is
+	specified.
+	* config/or1k/or1k.h (TARGET_CMODEL_SMALL, TARGET_CMODEL_LARGE):
+	New macros.
+	* config/or1k/or1k.opt (mcmodel=): New option.
+	* doc/invoke.text (OpenRISC Options): Document mcmodel.
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ gcc/config/or1k/or1k-opts.h | 30 ++++++++++++++++++++++++++++++
+ gcc/config/or1k/or1k.c      | 11 +++++++++--
+ gcc/config/or1k/or1k.h      |  7 +++++++
+ gcc/config/or1k/or1k.opt    | 19 +++++++++++++++++++
+ gcc/doc/invoke.texi         | 12 +++++++++++-
+ 5 files changed, 76 insertions(+), 3 deletions(-)
+ create mode 100644 gcc/config/or1k/or1k-opts.h
+
+diff --git a/gcc/config/or1k/or1k-opts.h b/gcc/config/or1k/or1k-opts.h
+new file mode 100644
+index 00000000000..f791b894fdd
+--- /dev/null
++++ b/gcc/config/or1k/or1k-opts.h
+@@ -0,0 +1,30 @@
++/* Definitions for option handling for OpenRISC.
++   Copyright (C) 2021 Free Software Foundation, Inc.
++   Contributed by Stafford Horne.
++
++   This file is part of GCC.
++
++   GCC is free software; you can redistribute it and/or modify it
++   under the terms of the GNU General Public License as published
++   by the Free Software Foundation; either version 3, or (at your
++   option) any later version.
++
++   GCC is distributed in the hope that it will be useful, but WITHOUT
++   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
++   License for more details.
++
++   You should have received a copy of the GNU General Public License
++   along with GCC; see the file COPYING3.  If not see
++   <http://www.gnu.org/licenses/>.  */
++
++#ifndef GCC_OR1K_OPTS_H
++#define GCC_OR1K_OPTS_H
++
++/* The OpenRISC code generation models available.  */
++enum or1k_cmodel_type {
++  CMODEL_SMALL,
++  CMODEL_LARGE
++};
++
++#endif /* GCC_OR1K_OPTS_H */
+diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
+index 5fa5425aa2b..88613f9596b 100644
+--- a/gcc/config/or1k/or1k.c
++++ b/gcc/config/or1k/or1k.c
+@@ -750,7 +750,14 @@ or1k_legitimize_address_1 (rtx x, rtx scratch)
+ 	    {
+ 	      base = gen_sym_unspec (base, UNSPEC_GOT);
+ 	      crtl->uses_pic_offset_table = 1;
+-	      t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
++	      if (TARGET_CMODEL_LARGE)
++		{
++	          emit_insn (gen_rtx_SET (t1, gen_rtx_HIGH (Pmode, base)));
++	          emit_insn (gen_add3_insn (t1, t1, pic_offset_table_rtx));
++	          t2 = gen_rtx_LO_SUM (Pmode, t1, base);
++		}
++	      else
++	        t2 = gen_rtx_LO_SUM (Pmode, pic_offset_table_rtx, base);
+ 	      t2 = gen_const_mem (Pmode, t2);
+ 	      emit_insn (gen_rtx_SET (t1, t2));
+ 	      base = t1;
+@@ -1089,7 +1096,7 @@ print_reloc (FILE *stream, rtx x, HOST_WIDE_INT add, reloc_kind kind)
+      no special markup.  */
+   static const char * const relocs[RKIND_MAX][RTYPE_MAX] = {
+     { "lo", "got", "gotofflo", "tpofflo", "gottpofflo", "tlsgdlo" },
+-    { "ha", NULL,  "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
++    { "ha", "gotha", "gotoffha", "tpoffha", "gottpoffha", "tlsgdhi" },
+   };
+   reloc_type type = RTYPE_DIRECT;
+ 
+diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
+index 23db771d8fb..f1646d16dfd 100644
+--- a/gcc/config/or1k/or1k.h
++++ b/gcc/config/or1k/or1k.h
+@@ -21,6 +21,8 @@
+ #ifndef GCC_OR1K_H
+ #define GCC_OR1K_H
+ 
++#include "config/or1k/or1k-opts.h"
++
+ /* Names to predefine in the preprocessor for this target machine.  */
+ #define TARGET_CPU_CPP_BUILTINS()		\
+   do						\
+@@ -35,6 +37,11 @@
+     }						\
+   while (0)
+ 
++#define TARGET_CMODEL_SMALL \
++  (or1k_code_model == CMODEL_SMALL)
++#define TARGET_CMODEL_LARGE \
++  (or1k_code_model == CMODEL_LARGE)
++
+ /* Storage layout.  */
+ 
+ #define DEFAULT_SIGNED_CHAR 1
+diff --git a/gcc/config/or1k/or1k.opt b/gcc/config/or1k/or1k.opt
+index 03c9b8d0bba..8e035075f8a 100644
+--- a/gcc/config/or1k/or1k.opt
++++ b/gcc/config/or1k/or1k.opt
+@@ -21,6 +21,9 @@
+ ; See the GCC internals manual (options.texi) for a description of
+ ; this file's format.
+ 
++HeaderInclude
++config/or1k/or1k-opts.h
++
+ mhard-div
+ Target RejectNegative InverseMask(SOFT_DIV)
+ Enable generation of hardware divide (l.div, l.divu) instructions.  This is the
+@@ -63,6 +66,22 @@ When -mhard-float is selected, enables generation of unordered floating point
+ compare and set flag (lf.sfun*) instructions.  By default functions from libgcc
+ are used to perform unordered floating point compare and set flag operations.
+ 
++mcmodel=
++Target RejectNegative Joined Enum(or1k_cmodel_type) Var(or1k_code_model) Init(CMODEL_SMALL)
++Specify the code model used for accessing memory addresses.  Specifying large
++enables generating binaries with large global offset tables.  By default the
++value is small.
++
++Enum
++Name(or1k_cmodel_type) Type(enum or1k_cmodel_type)
++Known code model types (for use with the -mcmodel= option):
++
++EnumValue
++Enum(or1k_cmodel_type) String(small) Value(CMODEL_SMALL)
++
++EnumValue
++Enum(or1k_cmodel_type) String(large) Value(CMODEL_LARGE)
++
+ mcmov
+ Target RejectNegative Mask(CMOV)
+ Enable generation of conditional move (l.cmov) instructions.  By default the
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index eabeec944e7..eda350c99ec 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -1102,7 +1102,8 @@ Objective-C and Objective-C++ Dialects}.
+ @gccoptlist{-mboard=@var{name}  -mnewlib  -mhard-mul  -mhard-div @gol
+ -msoft-mul  -msoft-div @gol
+ -msoft-float  -mhard-float  -mdouble-float -munordered-float @gol
+--mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm}
++-mcmov  -mror  -mrori  -msext  -msfimm  -mshftimm @gol
++-mcmodel=@var{code-model}}
+ 
+ @emph{PDP-11 Options}
+ @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
+@@ -25111,6 +25112,15 @@ Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
+ @code{l.slli}) instructions.  By default extra instructions will be generated
+ to store the immediate to a register first.
+ 
++ at item -mcmodel=small
++ at opindex mcmodel=small
++Generate OpenRISC code for the small model: The GOT is limited to 64k. This is
++the default model.
++
++ at item -mcmodel=large
++ at opindex mcmodel=large
++Generate OpenRISC code for the large model: The GOT may grow up to 4G in size.
++
+ 
+ @end table
+ 
+-- 
+2.25.1
+
package/gcc/10.3.0/0003-or1k-Use-cmodel-large-when-building-crtstuff.patch new file +60 -0

60 lines not on this page · raw message

package/gcc/9.3.0/0006-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch new file +201 -0

201 lines not on this page · raw message

package/gcc/9.3.0/0007-or1k-Use-cmodel-large-when-building-crtstuff.patch new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.25.1
#12 lore raw

PATCH 4/9 package/libgeos: fix build failure due to missing -mcmodel=large

In reply to Giulio Benetti

When building libgeos for or1k -mcmodel=large is needed to link, so let's add that gcc option in case we're building for or1k.

---
 package/libgeos/libgeos.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/libgeos/libgeos.mk +4 -0
index a355732af8..43211d0434 100644
@@ -23,6 +23,10 @@ ifeq ($(BR2_arm)$(BR2_armeb),y)
 LIBGEOS_CONF_OPTS += -DDISABLE_GEOS_INLINE=ON
 endif
 
+ifeq ($(BR2_or1k),y)
+LIBGEOS_CXXFLAGS += -mcmodel=large
+endif
+
 LIBGEOS_CONF_OPTS += -DCMAKE_CXX_FLAGS="$(LIBGEOS_CXXFLAGS)"
 
 $(eval $(cmake-package))
Signature · 1 line
2.25.1
#13 lore raw

PATCH 5/9 package/protobuf: fix build failure due to missing -mcmodel=large

In reply to Giulio Benetti

When building protobuf for or1k -mcmodel=large is needed to link, so let's add that gcc option in case we're building for or1k.

---
 package/protobuf/protobuf.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/protobuf/protobuf.mk +4 -0
index ea75480038..d6b3557020 100644
@@ -24,6 +24,10 @@ ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
 PROTOBUF_CXXFLAGS += -O0
 endif
 
+ifeq ($(BR2_or1k),y)
+PROTOBUF_CXXFLAGS += -mcmodel=large
+endif
+
 PROTOBUF_CONF_ENV = CXXFLAGS="$(PROTOBUF_CXXFLAGS)"
 
 ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
Signature · 1 line
2.25.1
#14 lore raw

PATCH 6/9 toolchain: remove binutils bug 21464

In reply to Giulio Benetti

This bug has been fixed upstream and backported to buildroot binutils package. So let's remove it.

---
 toolchain/Config.in | 6 ------
 1 file changed, 6 deletions(-)
toolchain/Config.in +0 -6
index 78444f6130..06c338ee7d 100644
@@ -71,12 +71,6 @@ source "package/gdb/Config.in.host"
 
 comment "Toolchain Generic Options"
 
-# https://sourceware.org/bugzilla/show_bug.cgi?id=21464
-# Affect toolchains built with binutils 2.31.1, still not fixed.
-config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
-	bool
-	default y if BR2_or1k
-
 # https://sourceware.org/bugzilla/show_bug.cgi?id=27100
 # Affect toolchains built with binutils 2.33.1 (fixed in binutils 2.36)
 config BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27100
Signature · 1 line
2.25.1
#15 lore raw

PATCH 7/9 package/libgeos: remove binutils bug 21464 dependency

In reply to Giulio Benetti
---
 package/libgeos/Config.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/libgeos/Config.in +1 -3
index ebe40bd1ff..b659c98460 100644
@@ -2,7 +2,6 @@ config BR2_PACKAGE_LIBGEOS
 	bool "libgeos"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
 	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
 	help
 	  GEOS (Geometry Engine - Open Source) is a C++ port of the
@@ -13,7 +12,6 @@ config BR2_PACKAGE_LIBGEOS
 
 	  https://trac.osgeo.org/geos
 
-comment "libgeos needs a toolchain w/ C++, wchar, not binutils bug 21464, 27597"
+comment "libgeos needs a toolchain w/ C++, wchar, not binutils bug 27597"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR || \
-		   !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464 || \
 		   !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
Signature · 1 line
2.25.1
#16 lore raw

PATCH 8/9 package/postgis: remove libgeos binutils bug 21464 inheritance

In reply to Giulio Benetti
---
 package/postgis/Config.in | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
package/postgis/Config.in +1 -3
index 49887b61c0..553c89d9dd 100644
@@ -6,7 +6,6 @@ config BR2_PACKAGE_POSTGIS
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 # C++11, proj
 	depends on BR2_TOOLCHAIN_HAS_THREADS # proj
 	depends on BR2_USE_WCHAR # libgeos, proj
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464 # libgeos
 	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597 # libgeos
 	select BR2_PACKAGE_LIBGEOS
 	select BR2_PACKAGE_PROJ
@@ -20,9 +19,8 @@ config BR2_PACKAGE_POSTGIS
 
 	  https://postgis.net/
 
-comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.7, not binutils bug 21464, 27597"
+comment "postgis needs a toolchain w/ C++, threads, wchar, gcc >= 4.7, not binutils bug 27597"
 	depends on !BR2_microblazeel && !BR2_microblazebe # ICE
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 || \
 		!BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR || \
-		!BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464 || \
 		!BR2_TOOLCHAIN_HAS_BINUTILS_BUG_27597
Signature · 1 line
2.25.1
#17 lore raw

PATCH 9/9 package/protobuf: remove binutils bug 21464 dependency

In reply to Giulio Benetti
---
 package/protobuf/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/protobuf/Config.in +0 -1
index 30050950aa..46c820b9cf 100644
@@ -24,7 +24,6 @@ config BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS
 	default y if BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on BR2_USE_MMU # fork()
-	depends on !BR2_TOOLCHAIN_HAS_BINUTILS_BUG_21464
 
 config BR2_PACKAGE_PROTOBUF
 	bool "protobuf"
Signature · 1 line
2.25.1
#18 lore raw

cover Fix binutils bug 21464 and remove it

In reply to Giulio Benetti

Hi Giulio,

Thanks for these!

Quoted 9 lines · Giulio Benetti

This patchset fixes binutils bug 21464 and fixes libgeos build failure by introducing the gcc option flag -mcmodel. This is done by adding upstreamed binutils and gcc patches. Note tha this way buildroot toolchains can be considered bug binutils 21464 free and the only other OpenRisc toolchain supported is the external Bootlin one. So this patchset has to be considered valid once Bootlin updates its OpenRisc by adding binutils and gcc patches that are added with patches in this patchset.

Quoted 7 lines

Giulio Benetti (9):
package/binutils: update or1k patches for plt link version with
upstream
package/binutils: add upstream backported patches to support
-mcmodel=large gcc option
package/gcc: add upstream patches that introduce -mcmodel=large option
for or1k

Patches 1-3 applied to master. Note that I had to fix all of them up because
they failed check-package. The [PATCH N/M] things are not allowed. Ideally, when you add patches, you shouldn't just pluck them from the mailing list. Instead, you should apply them in a git clone - preferably by cherry-picking with git cherry-pick -x <sha1> if they have been applied upstream. Then you should regenerate *all* patches git format-patch -N <base>... Then verify that only the patches that you intended to change have actually changed.

Quoted 2 lines

package/libgeos: fix build failure due to missing -mcmodel=large package/protobuf: fix build failure due to missing -mcmodel=large

As mentioned, these can only be applied after Thomas updates the bootlin
toolchains *and* the patch to update them in Buildroot has been merged. That's not going to happen on master :-)

Quoted 4 lines

toolchain: remove binutils bug 21464 package/libgeos: remove binutils bug 21464 dependency package/postgis: remove libgeos binutils bug 21464 inheritance package/protobuf: remove binutils bug 21464 dependency

These four should be squashed into a single patch.

Regards,
Arnout

Quoted 57 lines
 .../0010-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 .../0003-bfd-elf32-or1k-fix-ld-assert.patch   |  35 --
 ...ith-plt-link-failure-for-local-calls.patch |  59 +++
 ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
 ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
 ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
 ...-mcmodel-option-to-handle-large-GOTs.patch | 200 +++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 +++
 ...-mcmodel-option-to-handle-large-GOTs.patch | 201 +++++++
 ...-cmodel-large-when-building-crtstuff.patch |  60 +++
 package/libgeos/Config.in                     |   4 +-
 package/libgeos/libgeos.mk                    |   4 +
 package/postgis/Config.in                     |   4 +-
 package/protobuf/Config.in                    |   1 -
 package/protobuf/protobuf.mk                  |   4 +
 toolchain/Config.in                           |   6 -
 30 files changed, 4035 insertions(+), 153 deletions(-)
 delete mode 100644 package/binutils/2.32/0010-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.32/0010-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.34/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.34/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.35.2/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.35.2/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 delete mode 100644 package/binutils/2.36.1/0003-bfd-elf32-or1k-fix-ld-assert.patch
 create mode 100644 package/binutils/2.36.1/0003-or1k-Fix-issue-with-plt-link-failure-for-local-calls.patch
 create mode 100644 package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
 create mode 100644 package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
 create mode 100644 package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
 create mode 100644 package/gcc/10.3.0/0002-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/10.3.0/0003-or1k-Use-cmodel-large-when-building-crtstuff.patch
 create mode 100644 package/gcc/9.3.0/0006-or1k-Add-mcmodel-option-to-handle-large-GOTs.patch
 create mode 100644 package/gcc/9.3.0/0007-or1k-Use-cmodel-large-when-building-crtstuff.patch
#19 lore raw

cover Fix binutils bug 21464 and remove it

Hi Arnout,

Quoted 3 lines · Arnout Vandecappelle

Hi Giulio,

Thanks for these!

Happy to help :-)

Quoted 18 lines · Giulio Benetti
Quoted 9 lines

This patchset fixes binutils bug 21464 and fixes libgeos build failure by introducing the gcc option flag -mcmodel. This is done by adding upstreamed binutils and gcc patches. Note tha this way buildroot toolchains can be considered bug binutils 21464 free and the only other OpenRisc toolchain supported is the external Bootlin one. So this patchset has to be considered valid once Bootlin updates its OpenRisc by adding binutils and gcc patches that are added with patches in this patchset.

Quoted 7 lines

Giulio Benetti (9):
package/binutils: update or1k patches for plt link version with
upstream
package/binutils: add upstream backported patches to support
-mcmodel=large gcc option
package/gcc: add upstream patches that introduce -mcmodel=large option
for or1k

Quoted 7 lines

Patches 1-3 applied to master. Note that I had to fix all of them up because
they failed check-package. The [PATCH N/M] things are not allowed. Ideally, when you add patches, you shouldn't just pluck them from the mailing list. Instead, you should apply them in a git clone - preferably by cherry-picking with git cherry-pick -x <sha1> if they have been applied upstream. Then you should regenerate *all* patches git format-patch -N <base>... Then verify that only the patches that you intended to change have actually changed.

Oh right, thank you for modifying them, I've forgotten to check-package them.

Quoted 7 lines
Quoted 3 lines

package/libgeos: fix build failure due to missing -mcmodel=large package/protobuf: fix build failure due to missing -mcmodel=large

As mentioned, these can only be applied after Thomas updates the bootlin
toolchains *and* the patch to update them in Buildroot has been merged. That's not going to happen on master :-)

Ok

Quoted 6 lines
Quoted 4 lines

toolchain: remove binutils bug 21464 package/libgeos: remove binutils bug 21464 dependency package/postgis: remove libgeos binutils bug 21464 inheritance package/protobuf: remove binutils bug 21464 dependency

These four should be squashed into a single patch.

I've just sent a v2 for this:
https://patchwork.ozlabs.org/project/buildroot/patch/20210521140942.3032331-1-giulio.benetti at benettiengineering.com/

Kind regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
#20 lore raw

cover Fix binutils bug 21464 and remove it

Giulio, Arnout, All,

On 2021-05-21 16:21 +0200, Giulio Benetti spake thusly:

Quoted 9 lines · Arnout Vandecappelle
Quoted 6 lines · Giulio Benetti
Quoted 4 lines

toolchain: remove binutils bug 21464 package/libgeos: remove binutils bug 21464 dependency package/postgis: remove libgeos binutils bug 21464 inheritance package/protobuf: remove binutils bug 21464 dependency

These four should be squashed into a single patch.

I've just sent a v2 for this:
https://patchwork.ozlabs.org/project/buildroot/patch/20210521140942.3032331-1-giulio.benetti at benettiengineering.com/

As a consequence, I've marked the original 4 as supersded in Patchwork, which only leaves the remaining two:

package/libgeos: fix build failure due to missing -mcmodel=large package/protobuf: fix build failure due to missing -mcmodel=large

Thanks!

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#21 lore raw

cover Fix binutils bug 21464 and remove it

Quoted 10 lines · Yann E. MORIN

Giulio, Arnout, All,

On 2021-05-21 16:21 +0200, Giulio Benetti spake thusly:

Quoted 7 lines · Arnout Vandecappelle
Quoted 6 lines · Giulio Benetti
Quoted 4 lines

toolchain: remove binutils bug 21464 package/libgeos: remove binutils bug 21464 dependency package/postgis: remove libgeos binutils bug 21464 inheritance package/protobuf: remove binutils bug 21464 dependency

These four should be squashed into a single patch.

Quoted 8 lines
Quoted 2 lines

I've just sent a v2 for this:
https://patchwork.ozlabs.org/project/buildroot/patch/20210521140942.3032331-1-giulio.benetti at benettiengineering.com/

As a consequence, I've marked the original 4 as supersded in Patchwork, which only leaves the remaining two:

package/libgeos: fix build failure due to missing -mcmodel=large package/protobuf: fix build failure due to missing -mcmodel=large

Oh yes, I've forgotten, thank you :-)

Kind regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas