Skip to contentSkip to conversation

package/elf2flt: refresh patches

PATCH In review Thomas Petazzoni via buildroot 2 participants 8 messages Aug 6, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 package/elf2flt: refresh patches

Some patches had some fuzz, and patch 0004 was no longer applicable using "git am". Patch 0006 is renamed so that it matches the commit log title, as generated automatically by git format-patch.

---
 .checkpackageignore                           |  2 +-
 .../0001-elf2flt-handle-binutils-2.34.patch   |  4 ++--
 ...tate-32-byte-alignment-for-.data-sec.patch |  4 ++--
 ...03-elf2flt-add-riscv-64-bits-support.patch |  8 ++++----
 ...2flt-create-a-common-helper-function.patch | 20 +++++++++----------
 ...l-error-regression-on-m68k-xtensa-ri.patch |  8 ++++----
 ...=> 0006-xtensa-fix-text-relocations.patch} | 10 +++++-----
 7 files changed, 28 insertions(+), 28 deletions(-)
 rename package/elf2flt/{0006-elf2flt-xtensa-fix-text-relocations.patch => 0006-xtensa-fix-text-relocations.patch} (88%)
.checkpackageignore +1 -1
index f846cc7a87..74c58d0c6f 100644
@@ -397,7 +397,7 @@ package/elf2flt/0002-elf2flt.ld-reinstate-32-byte-alignment-for-.data-sec.patch
 package/elf2flt/0003-elf2flt-add-riscv-64-bits-support.patch Upstream
 package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch Upstream
 package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch Upstream
-package/elf2flt/0006-elf2flt-xtensa-fix-text-relocations.patch Upstream
+package/elf2flt/0006-xtensa-fix-text-relocations.patch Upstream
 package/elftosb/0001-fixes-includes.patch Upstream
 package/elftosb/0002-force-cxx-compiler.patch Upstream
 package/elfutils/0001-Add-a-enable-disable-progs-configure-option.patch Upstream
package/elf2flt/0001-elf2flt-handle-binutils-2.34.patch +2 -2
index 4aa473c244..f9e493a761 100644
@@ -1,4 +1,4 @@
-From d78acba6510527aaa01a41eaf4c931f7a57e5f44 Mon Sep 17 00:00:00 2001
+From 2821fcb55cbe0f2b77237d89b5b3467fb3ad058b Mon Sep 17 00:00:00 2001
 From: Romain Naour <[email protected]>
 Date: Wed, 5 Feb 2020 10:31:32 +0100
 Subject: [PATCH] elf2flt: handle binutils >= 2.34
@@ -373,5 +373,5 @@ index 7ac0617..ea6b5a1 100644
  	fatal("read error section %s", s->name);
        }
 -- 
-2.35.1
+2.41.0
 
package/elf2flt/0002-elf2flt.ld-reinstate-32-byte-alignment-for-.data-sec.patch +2 -2
index 4df3ea5929..8bd0383683 100644
@@ -1,4 +1,4 @@
-From 85ba5664eb368eb1cbd2c30b7cd574acd75edd4c Mon Sep 17 00:00:00 2001
+From 37b281e4dd0fb5832181e51943a4eb3c74d4f618 Mon Sep 17 00:00:00 2001
 From: Niklas Cassel <[email protected]>
 Date: Mon, 4 Apr 2022 15:30:24 +0200
 Subject: [PATCH] elf2flt.ld: reinstate 32 byte alignment for .data section
@@ -77,5 +77,5 @@ index 0df999d..e5aea14 100644
  		@SYMBOL_PREFIX@__data_start = . ;
  		@SYMBOL_PREFIX@data_start = . ;
 -- 
-2.35.1
+2.41.0
 
package/elf2flt/0003-elf2flt-add-riscv-64-bits-support.patch +4 -4
index 15c191c83d..c2aa538d02 100644
@@ -1,4 +1,4 @@
-From 3f1f323feb5cf25d8c80861991d0360784f4d2e6 Mon Sep 17 00:00:00 2001
+From 1498503bde2a6055a83f1e9f3eaa6f2a104bd597 Mon Sep 17 00:00:00 2001
 From: Damien Le Moal <[email protected]>
 Date: Wed, 9 Sep 2020 17:31:33 +0900
 Subject: [PATCH] elf2flt: add riscv 64-bits support
@@ -27,7 +27,7 @@ Signed-off-by: Damien Le Moal <[email protected]>
  3 files changed, 25 insertions(+)
 
 diff --git a/elf2flt.c b/elf2flt.c
-index da25e93..a03ea3a 100644
+index ea6b5a1..c2816b6 100644
 --- a/elf2flt.c
 +++ b/elf2flt.c
 @@ -81,6 +81,8 @@ const char *elf2flt_progname;
@@ -48,7 +48,7 @@ index da25e93..a03ea3a 100644
  #else
  #error "Don't know how to support your CPU architecture??"
  #endif
-@@ -812,6 +816,18 @@ output_relocs (
+@@ -821,6 +825,18 @@ output_relocs (
  					goto good_32bit_resolved_reloc;
  				default:
  					goto bad_resolved_reloc;
@@ -99,5 +99,5 @@ index 7cb02d5..75ee1bb 100644
  	if (!linker_script)
  		linker_script = concat(ldscriptpath, "/elf2flt.ld", NULL);
 -- 
-2.36.1
+2.41.0
 
package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch +10 -10
index 6fee99d45a..be8d57affa 100644
@@ -1,4 +1,4 @@
-From 37e1e0ace8ccebf54ec2f5522bfc1f9db86946ad Mon Sep 17 00:00:00 2001
+From 4f28e4329897b7f23d828b375fb365d0e30c9cb5 Mon Sep 17 00:00:00 2001
 From: Niklas Cassel <[email protected]>
 Date: Tue, 9 Aug 2022 12:13:50 +0200
 Subject: [PATCH] elf2flt: create a common helper function
@@ -14,10 +14,10 @@ Signed-off-by: Niklas Cassel <[email protected]>
  1 file changed, 11 insertions(+), 8 deletions(-)
 
 diff --git a/elf2flt.c b/elf2flt.c
-index 669591e..9c32f9a 100644
+index c2816b6..8cd48d9 100644
 --- a/elf2flt.c
 +++ b/elf2flt.c
-@@ -337,6 +337,13 @@ compare_relocs (const void *pa, const void *pb)
+@@ -346,6 +346,13 @@ compare_relocs (const void *pa, const void *pb)
  }
  #endif
  
@@ -31,7 +31,7 @@ index 669591e..9c32f9a 100644
  static uint32_t *
  output_relocs (
    bfd *abs_bfd,
-@@ -428,8 +435,7 @@ output_relocs (
+@@ -437,8 +444,7 @@ output_relocs (
  	 */
  	if ((!pic_with_got || ALWAYS_RELOC_TEXT) &&
  	    ((a->flags & SEC_CODE) ||
@@ -41,7 +41,7 @@ index 669591e..9c32f9a 100644
  		sectionp = text + (a->vma - text_vma);
  	else if (a->flags & SEC_DATA)
  		sectionp = data + (a->vma - data_vma);
-@@ -1893,8 +1899,7 @@ int main(int argc, char *argv[])
+@@ -1902,8 +1908,7 @@ int main(int argc, char *argv[])
      bfd_vma sec_vma;
  
      if ((s->flags & SEC_CODE) ||
@@ -51,7 +51,7 @@ index 669591e..9c32f9a 100644
        vma = &text_vma;
        len = &text_len;
      } else if (s->flags & SEC_DATA) {
-@@ -1932,8 +1937,7 @@ int main(int argc, char *argv[])
+@@ -1941,8 +1946,7 @@ int main(int argc, char *argv[])
     * data sections.*/
    for (s = abs_bfd->sections; s != NULL; s = s->next)
      if ((s->flags & SEC_CODE) ||
@@ -60,8 +60,8 @@ index 669591e..9c32f9a 100644
 +	ro_reloc_data_section_should_be_in_text(s))
        if (!bfd_get_section_contents(abs_bfd, s,
  				   text + (s->vma - text_vma), 0,
- 				   bfd_section_size(abs_bfd, s)))
-@@ -1962,8 +1966,7 @@ int main(int argc, char *argv[])
+ 				   elf2flt_bfd_section_size(s)))
+@@ -1971,8 +1975,7 @@ int main(int argc, char *argv[])
     * data sections already included in the text output section.*/
    for (s = abs_bfd->sections; s != NULL; s = s->next)
      if ((s->flags & SEC_DATA) &&
@@ -70,7 +70,7 @@ index 669591e..9c32f9a 100644
 +	!ro_reloc_data_section_should_be_in_text(s))
        if (!bfd_get_section_contents(abs_bfd, s,
  				   data + (s->vma - data_vma), 0,
- 				   bfd_section_size(abs_bfd, s)))
+ 				   elf2flt_bfd_section_size(s)))
 -- 
-2.37.1
+2.41.0
 
package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch +4 -4
index 616bbc891f..96befd53d8 100644
@@ -1,4 +1,4 @@
-From a8c9f650b82109abf7aa730f298ea5182ed62613 Mon Sep 17 00:00:00 2001
+From 87d45736a6855f2147ef9c88d2bce2cabc84cb52 Mon Sep 17 00:00:00 2001
 From: Niklas Cassel <[email protected]>
 Date: Tue, 9 Aug 2022 21:06:05 +0200
 Subject: [PATCH] elf2flt: fix fatal error regression on m68k, xtensa, riscv64
@@ -50,10 +50,10 @@ Signed-off-by: Niklas Cassel <[email protected]>
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/elf2flt.c b/elf2flt.c
-index e0d7891..39d035f 100644
+index 8cd48d9..60bfa57 100644
 --- a/elf2flt.c
 +++ b/elf2flt.c
-@@ -341,8 +341,13 @@ compare_relocs (const void *pa, const void *pb)
+@@ -349,8 +349,13 @@ compare_relocs (const void *pa, const void *pb)
  static bool
  ro_reloc_data_section_should_be_in_text(asection *s)
  {
@@ -70,5 +70,5 @@ index e0d7891..39d035f 100644
  
  static uint32_t *
 -- 
-2.39.0
+2.41.0
 
package/elf2flt/0006-xtensa-fix-text-relocations.patch renamed from package/elf2flt/0006-elf2flt-xtensa-fix-text-relocations.patch +5 -5
similarity index 88%
rename from package/elf2flt/0006-elf2flt-xtensa-fix-text-relocations.patch
rename to package/elf2flt/0006-xtensa-fix-text-relocations.patch
index 3664775906..19c47cca90 100644
@@ -1,4 +1,4 @@
-From e248d9774506fdd8698b14a7edead113f19ecdb0 Mon Sep 17 00:00:00 2001
+From 7e1c17d7fe72a0889d56d5e6a1390d493d1de144 Mon Sep 17 00:00:00 2001
 From: Max Filippov <[email protected]>
 Date: Tue, 29 Nov 2022 17:47:54 -0800
 Subject: [PATCH] xtensa: fix text relocations
@@ -21,10 +21,10 @@ Signed-off-by: Max Filippov <[email protected]>
  1 file changed, 14 insertions(+), 1 deletion(-)
 
 diff --git a/elf2flt.c b/elf2flt.c
-index b93aecdaced3..cec3f4a22239 100644
+index 60bfa57..0fcb747 100644
 --- a/elf2flt.c
 +++ b/elf2flt.c
-@@ -808,7 +808,20 @@ output_relocs (
+@@ -833,7 +833,20 @@ output_relocs (
  					continue;
  				case R_XTENSA_32:
  				case R_XTENSA_PLT:
@@ -45,7 +45,7 @@ index b93aecdaced3..cec3f4a22239 100644
 +					break;
  				default:
  					goto bad_resolved_reloc;
- #else
+ #elif defined(TARGET_riscv64)
 -- 
-2.30.2
+2.41.0
 
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/3 package/elf2flt: backport upstream patch to remove use of BFD_VMA_FMT

This commit backports upstream commit
https://github.com/uclinux-dev/elf2flt/commit/a36df7407d9e3f93ca6449841ff0821b0d980438
to fix a build issue with binutils 2.40 or later:

elf2flt.c:223:31: error: expected ‘)’ before ‘BFD_VMA_FMT’

We prefer a backport over updating to a newer elf2flt version for now as there has been multiple other changes in elf2flt, and elf2flt is very fragile. Therefore for now we prefer to be conservative.

Fixes:

http://autobuild.buildroot.net/results/938a59b5e52d712786590e80328bb45b1c5fc519/

---
 ...07-elf2flt-remove-use-of-BFD_VMA_FMT.patch | 169 ++++++++++++++++++
 1 file changed, 169 insertions(+)
 create mode 100644 package/elf2flt/0007-elf2flt-remove-use-of-BFD_VMA_FMT.patch
package/elf2flt/0007-elf2flt-remove-use-of-BFD_VMA_FMT.patch new file +169 -0
new file mode 100644
index 0000000000..82e693f35f
@@ -0,0 +1,169 @@
+From 9ec7dd9dead2f3c4c73c3ab2166a1f81bfb41825 Mon Sep 17 00:00:00 2001
+From: Greg Ungerer <[email protected]>
+Date: Thu, 13 Apr 2023 22:58:20 +1000
+Subject: [PATCH] elf2flt: remove use of BFD_VMA_FMT
+
+In binutils-2.40 the BFD_VMA_FMT definition used for printf style
+formatting specifiers has been removed. For reference this was done in
+commit b82817674f46 ("Don't use BFD_VMA_FMT in binutils") in the
+binutils git development tree.
+
+BFD_VMA_FMT is used in a number of places in the elf2flt code to output
+bfd offsets, values and the like. So it is broken when using the bfd
+code from binutils-2.40 and newer.
+
+According to the binutils change PRIx64 (and friends) is used to replace
+it, with appropriate casts to keep it clean for 32 and 64 bit platforms.
+Change the elf2flt.c use of it in the same way to fix.
+
+This does not change the output in any way in normal use. This fix can
+be used on all versions of binutils (older and newer), there is no
+need to only do this on 2.40 and newer.
+
+Signed-off-by: Greg Ungerer <[email protected]>
+Upstream: https://github.com/uclinux-dev/elf2flt/commit/a36df7407d9e3f93ca6449841ff0821b0d980438
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ elf2flt.c | 58 ++++++++++++++++++++++++++++---------------------------
+ 1 file changed, 30 insertions(+), 28 deletions(-)
+
+diff --git a/elf2flt.c b/elf2flt.c
+index 0fcb747..6685bff 100644
+--- a/elf2flt.c
++++ b/elf2flt.c
+@@ -220,8 +220,8 @@ dump_symbols(asymbol **symbol_table, long number_of_symbols)
+   long i;
+   printf("SYMBOL TABLE:\n");
+   for (i=0; i<number_of_symbols; i++) {
+-	printf("  NAME=%s  VALUE=0x%"BFD_VMA_FMT"x\n",
+-		symbol_table[i]->name, symbol_table[i]->value);
++	printf("  NAME=%s  VALUE=0x%"PRIx64"\n",
++		symbol_table[i]->name, (uint64_t) symbol_table[i]->value);
+   }
+   printf("\n");
+   return(0);
+@@ -466,8 +466,8 @@ output_relocs (
+ 	if (r == NULL)
+ 	  continue;
+ 	if (verbose)
+-	  printf(" RELOCS: %s [%p]: flags=0x%x vma=0x%"BFD_VMA_FMT"x\n",
+-			r->name, r, r->flags, elf2flt_bfd_section_vma(r));
++	  printf(" RELOCS: %s [%p]: flags=0x%x vma=0x%"PRIx64"\n",
++			r->name, r, r->flags, (uint64_t) elf2flt_bfd_section_vma(r));
+   	if ((r->flags & SEC_RELOC) == 0)
+   	  continue;
+ 	relsize = bfd_get_reloc_upper_bound(rel_bfd, r);
+@@ -952,12 +952,13 @@ output_relocs (
+ 					if (verbose)
+ 						fprintf(stderr,
+ 							"%s vma=0x%x, "
+-							"value=0x%"BFD_VMA_FMT"x, "
+-							"address=0x%"BFD_VMA_FMT"x "
++							"value=0x%"PRIx64", "
++							"address=0x%"PRIx64" "
+ 							"sym_addr=0x%x rs=0x%x, opcode=0x%x\n",
+ 							"ABS32",
+-							sym_vma, (*(q->sym_ptr_ptr))->value,
+-							q->address, sym_addr,
++							sym_vma, 
++							(uint64_t) (*(q->sym_ptr_ptr))->value,
++							(uint64_t) q->address, sym_addr,
+ 							(*p)->howto->rightshift,
+ 							*(uint32_t *)r_mem);
+ 					sym_vma = elf2flt_bfd_section_vma(sym_section);
+@@ -971,12 +972,13 @@ output_relocs (
+ 					if (verbose)
+ 						fprintf(stderr,
+ 							"%s vma=0x%x, "
+-							"value=0x%"BFD_VMA_FMT"x, "
+-							"address=0x%"BFD_VMA_FMT"x "
++							"value=0x%"PRIx64", "
++							"address=0x%"PRIx64" "
+ 							"sym_addr=0x%x rs=0x%x, opcode=0x%x\n",
+ 							"PLT32",
+-							sym_vma, (*(q->sym_ptr_ptr))->value,
+-							q->address, sym_addr,
++							sym_vma,
++							(uint64_t) (*(q->sym_ptr_ptr))->value,
++							(uint64_t) q->address, sym_addr,
+ 							(*p)->howto->rightshift,
+ 							*(uint32_t *)r_mem);
+ 				case R_ARM_PC24:
+@@ -994,8 +996,8 @@ output_relocs (
+ 				case R_V850_ZDA_16_16_OFFSET:
+ 				case R_V850_ZDA_16_16_SPLIT_OFFSET:
+ 					/* Can't support zero-relocations.  */
+-					printf ("ERROR: %s+0x%"BFD_VMA_FMT"x: zero relocations not supported\n",
+-							sym_name, q->addend);
++					printf ("ERROR: %s+0x%"PRIx64": zero relocations not supported\n",
++							sym_name, (uint64_t) q->addend);
+ 					continue;
+ #endif /* TARGET_v850 */
+ 
+@@ -1194,12 +1196,12 @@ output_relocs (
+ 					temp |= (exist_val & 0x3f);
+ 					*(unsigned long *)r_mem = htoniosl(temp);
+ 					if (verbose)
+-						printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
++						printf("omit: offset=0x%"PRIx64" symbol=%s%s "
+ 								"section=%s size=%d "
+-								"fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x) GPREL\n",
+-								q->address, sym_name, addstr,
++								"fixup=0x%x (reloc=0x%"PRIx64") GPREL\n",
++								(uint64_t) q->address, sym_name, addstr,
+ 								section_name, sym_reloc_size,
+-								sym_addr, section_vma + q->address);
++								sym_addr, (uint64_t) section_vma + q->address);
+ 					continue;
+ 				}
+ 				case R_NIOS2_PCREL16:
+@@ -1214,12 +1216,12 @@ output_relocs (
+ 					exist_val |= ((sym_addr & 0xFFFF) << 6);
+ 					*(unsigned long *)r_mem = htoniosl(exist_val);
+ 					if (verbose)
+-						printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
++						printf("omit: offset=0x%"PRIx64" symbol=%s%s "
+ 								"section=%s size=%d "
+-								"fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x) PCREL\n",
+-								q->address, sym_name, addstr,
++								"fixup=0x%x (reloc=0x%"PRIx64") PCREL\n",
++								(uint64_t) q->address, sym_name, addstr,
+ 								section_name, sym_reloc_size,
+-								sym_addr, section_vma + q->address);
++								sym_addr, (uint64_t) section_vma + q->address);
+ 					continue;
+ 				}
+ 
+@@ -1231,9 +1233,9 @@ output_relocs (
+ 					    && (p[-1]->sym_ptr_ptr == p[0]->sym_ptr_ptr)
+ 					    && (p[-1]->addend == p[0]->addend)) {
+ 						if (verbose)
+-							printf("omit: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
++							printf("omit: offset=0x%"PRIx64" symbol=%s%s "
+ 								"section=%s size=%d LO16\n",
+-								q->address, sym_name, addstr,
++								(uint64_t) q->address, sym_name, addstr,
+ 								section_name, sym_reloc_size);
+ 						continue;
+ 					}
+@@ -1646,13 +1648,13 @@ DIS29_RELOCATION:
+ 			 */
+ 			if (relocation_needed) {
+ 				if (verbose)
+-					printf("  RELOC[%d]: offset=0x%"BFD_VMA_FMT"x symbol=%s%s "
++					printf("  RELOC[%d]: offset=0x%"PRIx64" symbol=%s%s "
+ 						"section=%s size=%d "
+-						"fixup=0x%x (reloc=0x%"BFD_VMA_FMT"x)\n",
++						"fixup=0x%x (reloc=0x%"PRIx64")\n",
+ 						flat_reloc_count,
+-						q->address, sym_name, addstr,
++						(uint64_t) q->address, sym_name, addstr,
+ 						section_name, sym_reloc_size,
+-						sym_addr, section_vma + q->address);
++						sym_addr, (uint64_t) section_vma + q->address);
+ 
+ #ifndef TARGET_bfin
+ 				flat_relocs = realloc(flat_relocs,
+-- 
+2.41.0
+
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH 3/3 package/elf2flt: fix build with binutils >= 2.41 due to libbfd location

In reply to Thomas Petazzoni via buildroot

elf2flt needs to link against libbfd.a and libiberty.a which are provided by host-binutils, but not installed, so we poke directory into the host-binutils build directory. While not very nice, it has already been like this for a long time. We could build host-binutils with --enable-install-libbfd and --enable-install-libiberty so that those libraries are installed, but we prefer to do this separately, and there is a serious potential for perturbations to other packages by having libbfd/libiberty installed in $(HOST_DIR).

In the mean time, an issue of poking directly into the host-binutils build directory is that the location of libbfd.a has changed in binutils >= 2.41, so we special case binutils 2.39 and 2.40, which are the two remaining versions still using the "old" path".

Note: the ARC-special binutils version is not considered because Buildroot only supports ARC CPUs with a MMU and therefore host-elf2flt is never used on ARC.

Fixes:

gcc: error: /builds/buildroot.org/toolchains-builder/build/output/build/host-binutils-2.41/bfd/libbfd.a: No such file or directory

When build host-elf2flt against host-binutils 2.41.

This issue is not visible in the autobuilders as it is hidden by the BFD_VMA_FMT issue fixed in the previous commit.

---
 package/elf2flt/elf2flt.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
package/elf2flt/elf2flt.mk +16 -1
index 6cd0786c3d..a524b1b737 100644
@@ -14,12 +14,27 @@ HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib
 # 0001-elf2flt-handle-binutils-2.34.patch
 HOST_ELF2FLT_AUTORECONF = YES
 
+# elf2flt needs to link against libbfd.a and libiberty.a which are
+# provided by host-binutils, but not installed, so we poke directory
+# into the host-binutils build directory. Turns out that the location
+# of libbfd.a has changed in binutils >= 2.41, so we special case
+# binutils 2.39 and 2.40, which are the two remaining versions still
+# using the "old" path". Note: the ARC-special binutils version is not
+# considered because Buildroot only supports ARC CPUs with a MMU and
+# therefore host-elf2flt is never used on ARC. libiberty.a has
+# remained at the same location.
+ifeq ($(BR2_BINUTILS_VERSION_2_39_X)$(BR2_BINUTILS_VERSION_2_40_X),y)
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/libbfd.a
+else
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/.libs/libbfd.a
+endif
+
 # It is not exactly a host variant, but more a cross variant, which is
 # why we pass a special --target option.
 HOST_ELF2FLT_CONF_OPTS = \
 	--with-bfd-include-dir=$(HOST_BINUTILS_DIR)/bfd/ \
 	--with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \
-	--with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \
+	--with-libbfd=$(HOST_ELF2FLT_LIBBFD_PATH) \
 	--with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \
 	--target=$(GNU_TARGET_NAME) \
 	--disable-werror
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 3/3] package/elf2flt: fix build with binutils >= 2.41 due to libbfd location

Hi Thomas,

Quoted 37 lines · Thomas Petazzoni via buildroot

elf2flt needs to link against libbfd.a and libiberty.a which are provided by host-binutils, but not installed, so we poke directory into the host-binutils build directory. While not very nice, it has already been like this for a long time. We could build host-binutils with --enable-install-libbfd and --enable-install-libiberty so that those libraries are installed, but we prefer to do this separately, and there is a serious potential for perturbations to other packages by having libbfd/libiberty installed in $(HOST_DIR).

In the mean time, an issue of poking directly into the host-binutils build directory is that the location of libbfd.a has changed in binutils >= 2.41, so we special case binutils 2.39 and 2.40, which are the two remaining versions still using the "old" path".

Note: the ARC-special binutils version is not considered because Buildroot only supports ARC CPUs with a MMU and therefore host-elf2flt is never used on ARC.

Fixes:

gcc: error: /builds/buildroot.org/toolchains-builder/build/output/build/host-binutils-2.41/bfd/libbfd.a: No such file or directory

When build host-elf2flt against host-binutils 2.41.

This issue is not visible in the autobuilders as it is hidden by the BFD_VMA_FMT issue fixed in the previous commit.

---
 package/elf2flt/elf2flt.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
package/elf2flt/elf2flt.mk +0 -0
index 6cd0786c3d..a524b1b737 100644

package/elf2flt/elf2flt.mk HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib · line 18

Quoted 5 lines
package/elf2flt/elf2flt.mk +2 -0
@@ -14,12 +14,27 @@ HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib
 # 0001-elf2flt-handle-binutils-2.34.patch
 HOST_ELF2FLT_AUTORECONF = YES
 
+# elf2flt needs to link against libbfd.a and libiberty.a which are
+# provided by host-binutils, but not installed, so we poke directory

s/directory/directly/, I believe.

The same issue in also the commit log above.

baruch

Quoted 23 lines
package/elf2flt/elf2flt.mk +14 -1
+# into the host-binutils build directory. Turns out that the location
+# of libbfd.a has changed in binutils >= 2.41, so we special case
+# binutils 2.39 and 2.40, which are the two remaining versions still
+# using the "old" path". Note: the ARC-special binutils version is not
+# considered because Buildroot only supports ARC CPUs with a MMU and
+# therefore host-elf2flt is never used on ARC. libiberty.a has
+# remained at the same location.
+ifeq ($(BR2_BINUTILS_VERSION_2_39_X)$(BR2_BINUTILS_VERSION_2_40_X),y)
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/libbfd.a
+else
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/.libs/libbfd.a
+endif
+
 # It is not exactly a host variant, but more a cross variant, which is
 # why we pass a special --target option.
 HOST_ELF2FLT_CONF_OPTS = \
 	--with-bfd-include-dir=$(HOST_BINUTILS_DIR)/bfd/ \
 	--with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \
-	--with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \
+	--with-libbfd=$(HOST_ELF2FLT_LIBBFD_PATH) \
 	--with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \
 	--target=$(GNU_TARGET_NAME) \
 	--disable-werror
Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH 3/3] package/elf2flt: fix build with binutils >= 2.41 due to libbfd location

Quoted 6 lines · On Sun, 06 Aug 2023 13:47:41 +0300 Baruch Siach via buildroot…

package/elf2flt/elf2flt.mk HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib · line 18

Quoted 2 lines
package/elf2flt/elf2flt.mk +2 -0
+# elf2flt needs to link against libbfd.a and libiberty.a which are
+# provided by host-binutils, but not installed, so we poke directory  

s/directory/directly/, I believe.

The same issue in also the commit log above.

Good point, fixed when applying! Thanks for the review.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Tested-by on v1 1/3
#5 lore raw
In reply to Thomas Petazzoni via buildroot

Hi Thomas,

I tested the series and it worked well for following defconfigs:
qemu_m68k_mcf5208_defconfig qemu_riscv64_nommu_virt_defconfig qemu_xtensa_lx60_nommu_defconfig

You can add if you like a

best regards
Waldemar

Thomas Petazzoni wrote,

Quoted 5 lines

Some patches had some fuzz, and patch 0004 was no longer applicable using "git am". Patch 0006 is renamed so that it matches the commit log title, as generated automatically by git format-patch.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

Hello Waldemar,

Quoted 7 lines · On Sun, 6 Aug 2023 14:54:45 +0200 Waldemar Brodkorb <[email protected]> wrote:

I tested the series and it worked well for following defconfigs:
qemu_m68k_mcf5208_defconfig qemu_riscv64_nommu_virt_defconfig qemu_xtensa_lx60_nommu_defconfig

You can add if you like a

Thanks a lot for having tested the whole series!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 5 lines · On Sun, 6 Aug 2023 12:25:51 +0200 Thomas Petazzoni via buildroot…

Some patches had some fuzz, and patch 0004 was no longer applicable using "git am". Patch 0006 is renamed so that it matches the commit log title, as generated automatically by git format-patch.

Quoted 10 lines
---
 .checkpackageignore                           |  2 +-
 .../0001-elf2flt-handle-binutils-2.34.patch   |  4 ++--
 ...tate-32-byte-alignment-for-.data-sec.patch |  4 ++--
 ...03-elf2flt-add-riscv-64-bits-support.patch |  8 ++++----
 ...2flt-create-a-common-helper-function.patch | 20 +++++++++----------
 ...l-error-regression-on-m68k-xtensa-ri.patch |  8 ++++----
 ...=> 0006-xtensa-fix-text-relocations.patch} | 10 +++++-----  
 7 files changed, 28 insertions(+), 28 deletions(-)
 rename package/elf2flt/{0006-elf2flt-xtensa-fix-text-relocations.patch => 0006-xtensa-fix-text-relocations.patch} (88%)

Series applied to master, with the Tested-by from Waldemar.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot