All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv
@ 2022-08-11  9:40 Niklas Cassel via buildroot
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 1/2] package/elf2flt: remove broken patch Niklas Cassel via buildroot
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Niklas Cassel via buildroot @ 2022-08-11  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, buildroot,
	romain.naour, yann.morin.1998

Hello buildroot folks,

This series fixes a fatal error at link time on m68k, xtensa,
and riscv64, caused by a bad upstream elf2flt commit.

With this series, m68k and riscv64 boots to login prompt.

xtensa crashes when loading init, the same behavior as when
reverting the bad upstream elf2flt commit completely.

Changes since v2:
-Added xtensa to the list of archs that require different
 handling from ARM.


Kind regards,
Niklas

Niklas Cassel (2):
  package/elf2flt: remove broken patch
  package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64

 ...3-elf2flt-add-riscv-64-bits-support.patch} |  0
 ...f2flt-fix-.eh_frame-section-handling.patch | 73 ------------------
 ...2flt-create-a-common-helper-function.patch | 76 +++++++++++++++++++
 ...l-error-regression-on-m68k-xtensa-ri.patch | 73 ++++++++++++++++++
 4 files changed, 149 insertions(+), 73 deletions(-)
 rename package/elf2flt/{0004-elf2flt-add-riscv-64-bits-support.patch => 0003-elf2flt-add-riscv-64-bits-support.patch} (100%)
 delete mode 100644 package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch
 create mode 100644 package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch
 create mode 100644 package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch

-- 
2.37.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 1/2] package/elf2flt: remove broken patch
  2022-08-11  9:40 [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Niklas Cassel via buildroot
@ 2022-08-11  9:40 ` Niklas Cassel via buildroot
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 Niklas Cassel via buildroot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Niklas Cassel via buildroot @ 2022-08-11  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, buildroot,
	romain.naour, yann.morin.1998

Remove broken elf2flt patch:
package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch

The patch modifies main(), but does not perform a similar change in
output_relocs(), which might cause sectionp in output_relocs() to be
initialized with an invalid address, causing random memory to be
overwritten.

This leads to a segfault when linking e.g. busybox for m68k.

We cannot perform a similar change in output_relocs(), since at this
point in time, data_len will always be non-zero.

Revert this patch completely, so that we can add a working patch.

Note that even with this patch reverted, elf2flt is still broken
on archs like m68k and xtensa, resulting in the fatal error:
ERROR: text=0x3bab8 overlaps data=0x33f60 ?

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 ...3-elf2flt-add-riscv-64-bits-support.patch} |  0
 ...f2flt-fix-.eh_frame-section-handling.patch | 73 -------------------
 2 files changed, 73 deletions(-)
 rename package/elf2flt/{0004-elf2flt-add-riscv-64-bits-support.patch => 0003-elf2flt-add-riscv-64-bits-support.patch} (100%)
 delete mode 100644 package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch

diff --git a/package/elf2flt/0004-elf2flt-add-riscv-64-bits-support.patch b/package/elf2flt/0003-elf2flt-add-riscv-64-bits-support.patch
similarity index 100%
rename from package/elf2flt/0004-elf2flt-add-riscv-64-bits-support.patch
rename to package/elf2flt/0003-elf2flt-add-riscv-64-bits-support.patch
diff --git a/package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch b/package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch
deleted file mode 100644
index e7e8c6f25b..0000000000
--- a/package/elf2flt/0003-elf2flt-fix-.eh_frame-section-handling.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 8b7fdb1dedfb8a6e858b46e5af33029fe0462ab8 Mon Sep 17 00:00:00 2001
-From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-Date: Tue, 10 May 2022 23:14:36 +0900
-Subject: [PATCH] elf2flt: fix .eh_frame section handling
-
-elf2flt.ld linker script positions the .eh_frame section in an output
-section after the .text and .data output sections.
-
-However, when elf2flt.c is supplied the ELF linked using the elf2flt.ld
-linker script, it only looks at the flags for each input section, and
-then puts it in either a bFLT text, data or bss output section.
-
-Commit ba379d08bb7 ("elf2flt: fix for segfault on some ARM ELFs")
-modified the section scanning loop of elf2flt main() function to put
-read-only relocation data sections in the bFLT text output section so
-that the .ARM.exidx section is placed in the .text flat output section.
-Previously a read-only relocation data section would be put in the data
-output section.
-
-On ARM, the .eh_frame section does not have the SEC_RELOC flag set, so
-it will still end up in the data output section. However, on
-architectures that generates the .eh_frame section with the SEC_RELOC
-flag set, this section will now be placed in the text output section.
-
-The logic in elf2flt will handle all sections in order, and since the
-input order is .text, .data, and .eh_frame, putting .eh_frame in text
-output section does not work, since elf2flt.c has already put the .data
-input section in the bFLT data output section. This leads to the
-following print (example for riscv64 architecture):
-
-buildroot/output/host/riscv64-buildroot-linux-uclibc/bin/elf2flt:
-ERROR: text=0x3bab8 overlaps data=0x33f60 ?
-
-The way that elf2flt is written, we cannot append to the text output
-section after an input section has been added to the data output
-section. It might be possible to change this, but that would require
-moving all the code the was already placed in the data output section.
-
-Instead, let's allow putting a read-only relocation data section in the
-text output section (so that .ARM.exidx will still be placed correctly),
-but only if there has not yet been anything placed in the data output
-section.
-
-That way .ARM.exidx will still be placed correctly, and .eh_frame will
-be placed correctly in the .data output section, regardless if it has
-flag SEC_RELOC set or not.
-
-Fixes: ba379d08bb7 ("elf2flt: fix for segfault on some ARM ELFs")
-Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
-Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
----
- elf2flt.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/elf2flt.c b/elf2flt.c
-index 7ac0617..da25e93 100644
---- a/elf2flt.c
-+++ b/elf2flt.c
-@@ -1877,8 +1877,9 @@ int main(int argc, char *argv[])
-     bfd_vma sec_vma;
- 
-     if ((s->flags & SEC_CODE) ||
--       ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
--                    (SEC_DATA | SEC_READONLY | SEC_RELOC))) {
-+        (((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
-+                     (SEC_DATA | SEC_READONLY | SEC_RELOC)) &&
-+          !data_len)) {
-       vma = &text_vma;
-       len = &text_len;
-     } else if (s->flags & SEC_DATA) {
--- 
-2.35.1
-
-- 
2.37.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-08-11  9:40 [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Niklas Cassel via buildroot
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 1/2] package/elf2flt: remove broken patch Niklas Cassel via buildroot
@ 2022-08-11  9:40 ` Niklas Cassel via buildroot
  2022-08-11 20:30   ` Thomas Petazzoni via buildroot
  2022-09-15  7:21   ` Peter Korsgaard
  2022-08-11 20:28 ` [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Thomas Petazzoni via buildroot
  2022-09-23 20:40 ` Thomas Petazzoni via buildroot
  3 siblings, 2 replies; 11+ messages in thread
From: Niklas Cassel via buildroot @ 2022-08-11  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, buildroot,
	romain.naour, yann.morin.1998

This series fixes a fatal error at link time on m68k, xtensa,
and riscv64, caused by a bad upstream elf2flt commit.

Without this patch, m68k, xtensa, and riscv64 would result in
a fatal error:
ERROR: text=0x3bab8 overlaps data=0x33f60 ?

With this patch, qemu_m68k_mcf5208_defconfig,
qemu_riscv64_nommu_virt_defconfig, and
qemu_xtensa_lx60_nommu_defconfig builds properly.

riscv64 and m68k boots to login prompt.
xtensa crashes when loading init, the same behavior as when
reverting the bad upstream elf2flt commit completely.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 ...2flt-create-a-common-helper-function.patch | 76 +++++++++++++++++++
 ...l-error-regression-on-m68k-xtensa-ri.patch | 73 ++++++++++++++++++
 2 files changed, 149 insertions(+)
 create mode 100644 package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch
 create mode 100644 package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch

diff --git a/package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch b/package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch
new file mode 100644
index 0000000000..9fa5ff986f
--- /dev/null
+++ b/package/elf2flt/0004-elf2flt-create-a-common-helper-function.patch
@@ -0,0 +1,76 @@
+From 37e1e0ace8ccebf54ec2f5522bfc1f9db86946ad Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <niklas.cassel@wdc.com>
+Date: Tue, 9 Aug 2022 12:13:50 +0200
+Subject: [PATCH 1/2] elf2flt: create a common helper function
+
+In order to make the code more maintainable,
+move duplicated code to a common helper function.
+
+No functional change intended.
+
+Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
+---
+ elf2flt.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/elf2flt.c b/elf2flt.c
+index 669591e..9c32f9a 100644
+--- a/elf2flt.c
++++ b/elf2flt.c
+@@ -337,6 +337,13 @@ compare_relocs (const void *pa, const void *pb)
+ }
+ #endif
+ 
++static bool
++ro_reloc_data_section_should_be_in_text(asection *s)
++{
++  return (s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
++	  (SEC_DATA | SEC_READONLY | SEC_RELOC);
++}
++
+ static uint32_t *
+ output_relocs (
+   bfd *abs_bfd,
+@@ -428,8 +435,7 @@ output_relocs (
+ 	 */
+ 	if ((!pic_with_got || ALWAYS_RELOC_TEXT) &&
+ 	    ((a->flags & SEC_CODE) ||
+-	    ((a->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+-		         (SEC_DATA | SEC_READONLY | SEC_RELOC))))
++	     ro_reloc_data_section_should_be_in_text(a)))
+ 		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[])
+     bfd_vma sec_vma;
+ 
+     if ((s->flags & SEC_CODE) ||
+-       ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+-                    (SEC_DATA | SEC_READONLY | SEC_RELOC))) {
++	ro_reloc_data_section_should_be_in_text(s)) {
+       vma = &text_vma;
+       len = &text_len;
+     } else if (s->flags & SEC_DATA) {
+@@ -1932,8 +1937,7 @@ int main(int argc, char *argv[])
+    * data sections.*/
+   for (s = abs_bfd->sections; s != NULL; s = s->next)
+     if ((s->flags & SEC_CODE) ||
+-       ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+-                    (SEC_DATA | SEC_READONLY | SEC_RELOC)))
++	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[])
+    * data sections already included in the text output section.*/
+   for (s = abs_bfd->sections; s != NULL; s = s->next)
+     if ((s->flags & SEC_DATA) &&
+-       ((s->flags & (SEC_READONLY | SEC_RELOC)) !=
+-                    (SEC_READONLY | SEC_RELOC)))
++	!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)))
+-- 
+2.37.1
+
diff --git a/package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch b/package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch
new file mode 100644
index 0000000000..4224eacd9f
--- /dev/null
+++ b/package/elf2flt/0005-elf2flt-fix-fatal-error-regression-on-m68k-xtensa-ri.patch
@@ -0,0 +1,73 @@
+From 65ac5f9e69cfb989d970da74c41e478774d29be5 Mon Sep 17 00:00:00 2001
+From: Niklas Cassel <niklas.cassel@wdc.com>
+Date: Tue, 9 Aug 2022 21:06:05 +0200
+Subject: [PATCH 2/2] elf2flt: fix fatal error regression on m68k, xtensa,
+ riscv64
+
+Commit ba379d08bb78 ("elf2flt: fix for segfault on some ARM ELFs")
+changed the condition of which input sections that should be included
+in the .text output section from:
+((a->flags & (SEC_DATA | SEC_READONLY)) == (SEC_DATA | SEC_READONLY))
+to:
+((a->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+(SEC_DATA | SEC_READONLY | SEC_RELOC))
+
+On ARM, the .eh_frame input section does not have the SEC_RELOC flag
+set, so this specific change had no effect on ARM.
+
+However, on e.g. m68k and riscv64, the .eh_frame input section does
+have the SEC_RELOC flag set, which means that after commit ba379d08bb78
+("elf2flt: fix for segfault on some ARM ELFs"), read-only relocation
+data sections were placed in .text output section, instead of .data
+output section.
+
+This will result in a fatal error on m68k, xtensa and riscv64:
+ERROR: text=0x3bab8 overlaps data=0x33f60 ?
+
+This is because elf2flt cannot append to .text after .data has been
+appended to.
+
+Note that the binutils maintainer says that the correct thing is
+to put read-only relocation data sections in .text:
+https://sourceware.org/legacy-ml/binutils/2019-10/msg00132.html
+
+So the proper fix is probably to rewrite elf2flt so that it can append
+to .text after .data has been appended to (which will require elf2flt
+to move/relocate everything that has already been appended to .data,
+since the virtual addresses are contiguous).
+
+However, for now, add an exception for m68k, xtensa and riscv64
+(specifically for the problematic input section, .eh_frame), so that we
+get the same behavior as older elf2flt releases, where we put read-only
+relocation data in .data, which was working perfectly fine.
+
+Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
+---
+ elf2flt.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/elf2flt.c b/elf2flt.c
+index 9c32f9a..a680c89 100644
+--- a/elf2flt.c
++++ b/elf2flt.c
+@@ -340,8 +340,15 @@ compare_relocs (const void *pa, const void *pb)
+ static bool
+ ro_reloc_data_section_should_be_in_text(asection *s)
+ {
+-  return (s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
+-	  (SEC_DATA | SEC_READONLY | SEC_RELOC);
++  if ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) ==
++      (SEC_DATA | SEC_READONLY | SEC_RELOC)) {
++#if defined(TARGET_m68k) || defined(TARGET_riscv64) || defined(TARGET_xtensa)
++    if (!strcmp(".eh_frame", s->name))
++      return false;
++#endif
++    return true;
++  }
++  return false;
+ }
+ 
+ static uint32_t *
+-- 
+2.37.1
+
-- 
2.37.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv
  2022-08-11  9:40 [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Niklas Cassel via buildroot
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 1/2] package/elf2flt: remove broken patch Niklas Cassel via buildroot
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 Niklas Cassel via buildroot
@ 2022-08-11 20:28 ` Thomas Petazzoni via buildroot
  2022-09-23 20:40 ` Thomas Petazzoni via buildroot
  3 siblings, 0 replies; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-08-11 20:28 UTC (permalink / raw)
  To: Niklas Cassel via buildroot
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, romain.naour,
	yann.morin.1998

Hello Niklas,

On Thu, 11 Aug 2022 11:40:47 +0200
Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:

> Niklas Cassel (2):
>   package/elf2flt: remove broken patch
>   package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64

Thanks a lot for your work, I have applied both patches.

Could you make sure to upstream them to the official elf2flt project?

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 Niklas Cassel via buildroot
@ 2022-08-11 20:30   ` Thomas Petazzoni via buildroot
  2022-08-12  0:02     ` Max Filippov
  2022-09-15  7:21   ` Peter Korsgaard
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-08-11 20:30 UTC (permalink / raw)
  To: Max Filippov
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, buildroot,
	romain.naour, yann.morin.1998

Hello Max,

On Thu, 11 Aug 2022 11:40:49 +0200
Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:

> This series fixes a fatal error at link time on m68k, xtensa,
> and riscv64, caused by a bad upstream elf2flt commit.
> 
> Without this patch, m68k, xtensa, and riscv64 would result in
> a fatal error:
> ERROR: text=0x3bab8 overlaps data=0x33f60 ?
> 
> With this patch, qemu_m68k_mcf5208_defconfig,
> qemu_riscv64_nommu_virt_defconfig, and
> qemu_xtensa_lx60_nommu_defconfig builds properly.
> 
> riscv64 and m68k boots to login prompt.
> xtensa crashes when loading init, the same behavior as when
> reverting the bad upstream elf2flt commit completely.

As you can see here, apparently the xtensa noMMU defconfig in Buildroot
no longer boots. We had a regression in elf2flt, but even with this
regression fixed the problem persists, and we're apparently back to
what it was before the elf2flt regression was introduced.

Do you think you could have a look?

Thanks a lot,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-08-11 20:30   ` Thomas Petazzoni via buildroot
@ 2022-08-12  0:02     ` Max Filippov
  0 siblings, 0 replies; 11+ messages in thread
From: Max Filippov @ 2022-08-12  0:02 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, buildroot,
	romain.naour, yann.morin.1998

Hi Thomas,

On Thu, Aug 11, 2022 at 1:30 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> On Thu, 11 Aug 2022 11:40:49 +0200
> Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:
>
> > This series fixes a fatal error at link time on m68k, xtensa,
> > and riscv64, caused by a bad upstream elf2flt commit.
> >
> > Without this patch, m68k, xtensa, and riscv64 would result in
> > a fatal error:
> > ERROR: text=0x3bab8 overlaps data=0x33f60 ?
> >
> > With this patch, qemu_m68k_mcf5208_defconfig,
> > qemu_riscv64_nommu_virt_defconfig, and
> > qemu_xtensa_lx60_nommu_defconfig builds properly.
> >
> > riscv64 and m68k boots to login prompt.
> > xtensa crashes when loading init, the same behavior as when
> > reverting the bad upstream elf2flt commit completely.
>
> As you can see here, apparently the xtensa noMMU defconfig in Buildroot
> no longer boots. We had a regression in elf2flt, but even with this
> regression fixed the problem persists, and we're apparently back to
> what it was before the elf2flt regression was introduced.
>
> Do you think you could have a look?

Sure, I will. Thank you for the heads up.

-- 
Thanks.
-- Max
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-08-11  9:40 ` [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 Niklas Cassel via buildroot
  2022-08-11 20:30   ` Thomas Petazzoni via buildroot
@ 2022-09-15  7:21   ` Peter Korsgaard
  2022-09-15 11:18     ` Niklas Cassel via buildroot
  1 sibling, 1 reply; 11+ messages in thread
From: Peter Korsgaard @ 2022-09-15  7:21 UTC (permalink / raw)
  To: Niklas Cassel via buildroot
  Cc: Niklas Cassel, damien.lemoal, alistair, geert, Thomas Petazzoni,
	romain.naour, yann.morin.1998

>>>>> "Niklas" == Niklas Cassel via buildroot <buildroot@buildroot.org> writes:

 > This series fixes a fatal error at link time on m68k, xtensa,
 > and riscv64, caused by a bad upstream elf2flt commit.

 > Without this patch, m68k, xtensa, and riscv64 would result in
 > a fatal error:
 > ERROR: text=0x3bab8 overlaps data=0x33f60 ?

 > With this patch, qemu_m68k_mcf5208_defconfig,
 > qemu_riscv64_nommu_virt_defconfig, and
 > qemu_xtensa_lx60_nommu_defconfig builds properly.

 > riscv64 and m68k boots to login prompt.
 > xtensa crashes when loading init, the same behavior as when
 > reverting the bad upstream elf2flt commit completely.

 > Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>

When was this regression introduced? With the update to elf2flt 2021.08?
Are 2022.02.x and 2022.05.x also affected?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-09-15  7:21   ` Peter Korsgaard
@ 2022-09-15 11:18     ` Niklas Cassel via buildroot
  2022-09-15 14:01       ` Peter Korsgaard
  0 siblings, 1 reply; 11+ messages in thread
From: Niklas Cassel via buildroot @ 2022-09-15 11:18 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: damien.lemoal, alistair, geert, Thomas Petazzoni,
	Niklas Cassel via buildroot, romain.naour, yann.morin.1998

On Thu, Sep 15, 2022 at 09:21:52AM +0200, Peter Korsgaard wrote:
> >>>>> "Niklas" == Niklas Cassel via buildroot <buildroot@buildroot.org> writes:
> 
>  > This series fixes a fatal error at link time on m68k, xtensa,
>  > and riscv64, caused by a bad upstream elf2flt commit.
> 
>  > Without this patch, m68k, xtensa, and riscv64 would result in
>  > a fatal error:
>  > ERROR: text=0x3bab8 overlaps data=0x33f60 ?
> 
>  > With this patch, qemu_m68k_mcf5208_defconfig,
>  > qemu_riscv64_nommu_virt_defconfig, and
>  > qemu_xtensa_lx60_nommu_defconfig builds properly.
> 
>  > riscv64 and m68k boots to login prompt.
>  > xtensa crashes when loading init, the same behavior as when
>  > reverting the bad upstream elf2flt commit completely.
> 
>  > Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>

Hello Peter,

> 
> When was this regression introduced? With the update to elf2flt 2021.08?

While I didn't include the SHA1 in the buildroot patch,
the SHA1 is included in the elf2flt patch embedded in the
buildroot patch.

ba379d08bb78 ("elf2flt: fix for segfault on some ARM ELFs")

$ git tag --contains ba379d08bb78
v2021.08

So yes, the regression was introduced with elf2flt 2021.08.

> Are 2022.02.x and 2022.05.x also affected?

Buildroot branches 2022.02.x and 2022.05.x both includes
the patch the upgrades elf2flt to 2021.08, so these branches
should also be affected.

I've tried to upstream my patches to elf2flt:
https://github.com/uclinux-dev/elf2flt/pull/24

But maintainer seems to have gone AWOL :)


Kind regards,
Niklas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
  2022-09-15 11:18     ` Niklas Cassel via buildroot
@ 2022-09-15 14:01       ` Peter Korsgaard
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Korsgaard @ 2022-09-15 14:01 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: damien.lemoal, alistair, geert, Thomas Petazzoni,
	Niklas Cassel via buildroot, romain.naour, yann.morin.1998

>>>>> "Niklas" == Niklas Cassel <Niklas.Cassel@wdc.com> writes:

Hi,

 >> Are 2022.02.x and 2022.05.x also affected?

 > Buildroot branches 2022.02.x and 2022.05.x both includes
 > the patch the upgrades elf2flt to 2021.08, so these branches
 > should also be affected.

Thanks for the feedback!

Committed to 2022.05.x and 2022.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv
  2022-08-11  9:40 [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Niklas Cassel via buildroot
                   ` (2 preceding siblings ...)
  2022-08-11 20:28 ` [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Thomas Petazzoni via buildroot
@ 2022-09-23 20:40 ` Thomas Petazzoni via buildroot
  2023-01-17 15:45   ` Niklas Cassel via buildroot
  3 siblings, 1 reply; 11+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-09-23 20:40 UTC (permalink / raw)
  To: Niklas Cassel
  Cc: damien.lemoal, alistair, geert, buildroot, romain.naour, yann.morin.1998

Hello Niklas,

On Thu, 11 Aug 2022 11:40:47 +0200
Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:

> Niklas Cassel (2):
>   package/elf2flt: remove broken patch
>   package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64

I am sorry to report that on Buildroot 2022.08, which has those
patches, the following defconfig still fails to build:

BR2_m68k=y
BR2_m68k_cf5208=y
BR2_KERNEL_HEADERS_5_4=y
BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
BR2_PTHREAD_DEBUG=y
BR2_BINUTILS_VERSION_2_39_X=y
BR2_BINUTILS_GPROFNG=y
BR2_GCC_VERSION_12_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_GCC_ENABLE_OPENMP=y
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_PYTHON3=y
BR2_GDB_VERSION_12=y
BR2_INIT_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GDB=y
# BR2_TARGET_ROOTFS_TAR is not set

It fails with:

/home/thomas/buildroot/outputs/m68k-coldfire-uclibc-bleeding-edge/host/m68k-buildroot-uclinux-uclibc/bin/elf2flt: ERROR: text=0x3c826 overlaps data=0x256e0 ?

while building gdb for the target.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv
  2022-09-23 20:40 ` Thomas Petazzoni via buildroot
@ 2023-01-17 15:45   ` Niklas Cassel via buildroot
  0 siblings, 0 replies; 11+ messages in thread
From: Niklas Cassel via buildroot @ 2023-01-17 15:45 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: damien.lemoal, alistair, geert, buildroot, romain.naour, yann.morin.1998

On Fri, Sep 23, 2022 at 10:40:39PM +0200, Thomas Petazzoni wrote:
> Hello Niklas,
> 
> On Thu, 11 Aug 2022 11:40:47 +0200
> Niklas Cassel via buildroot <buildroot@buildroot.org> wrote:
> 
> > Niklas Cassel (2):
> >   package/elf2flt: remove broken patch
> >   package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
> 
> I am sorry to report that on Buildroot 2022.08, which has those
> patches, the following defconfig still fails to build:
> 
> BR2_m68k=y
> BR2_m68k_cf5208=y
> BR2_KERNEL_HEADERS_5_4=y
> BR2_TOOLCHAIN_BUILDROOT_LOCALE=y
> BR2_PTHREAD_DEBUG=y
> BR2_BINUTILS_VERSION_2_39_X=y
> BR2_BINUTILS_GPROFNG=y
> BR2_GCC_VERSION_12_X=y
> BR2_TOOLCHAIN_BUILDROOT_CXX=y
> BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
> BR2_GCC_ENABLE_OPENMP=y
> BR2_PACKAGE_HOST_GDB=y
> BR2_PACKAGE_HOST_GDB_TUI=y
> BR2_PACKAGE_HOST_GDB_PYTHON3=y
> BR2_GDB_VERSION_12=y
> BR2_INIT_NONE=y
> # BR2_PACKAGE_BUSYBOX is not set
> BR2_PACKAGE_GDB=y
> # BR2_TARGET_ROOTFS_TAR is not set
> 
> It fails with:
> 
> /home/thomas/buildroot/outputs/m68k-coldfire-uclibc-bleeding-edge/host/m68k-buildroot-uclinux-uclibc/bin/elf2flt: ERROR: text=0x3c826 overlaps data=0x256e0 ?
> 
> while building gdb for the target.


Hello Thomas,

I decided to (finally) cross this one off from my TODO list.

Submitted a fix here:
https://patchwork.ozlabs.org/project/buildroot/patch/20230117153503.2075602-1-niklas.cassel@wdc.com/


Kind regards,
Niklas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-17 15:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  9:40 [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Niklas Cassel via buildroot
2022-08-11  9:40 ` [Buildroot] [PATCH v2 1/2] package/elf2flt: remove broken patch Niklas Cassel via buildroot
2022-08-11  9:40 ` [Buildroot] [PATCH v2 2/2] package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64 Niklas Cassel via buildroot
2022-08-11 20:30   ` Thomas Petazzoni via buildroot
2022-08-12  0:02     ` Max Filippov
2022-09-15  7:21   ` Peter Korsgaard
2022-09-15 11:18     ` Niklas Cassel via buildroot
2022-09-15 14:01       ` Peter Korsgaard
2022-08-11 20:28 ` [Buildroot] [PATCH v2 0/2] fix elf2flt on m68k, xtensa, riscv Thomas Petazzoni via buildroot
2022-09-23 20:40 ` Thomas Petazzoni via buildroot
2023-01-17 15:45   ` Niklas Cassel via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.