2023-08-06 04:25:51 -06:00
|
|
|
From 4f28e4329897b7f23d828b375fb365d0e30c9cb5 Mon Sep 17 00:00:00 2001
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
From: Niklas Cassel <niklas.cassel@wdc.com>
|
|
|
|
Date: Tue, 9 Aug 2022 12:13:50 +0200
|
|
|
|
Subject: [PATCH] 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
|
2023-08-06 04:25:51 -06:00
|
|
|
index c2816b6..8cd48d9 100644
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
--- a/elf2flt.c
|
|
|
|
+++ b/elf2flt.c
|
2023-08-06 04:25:51 -06:00
|
|
|
@@ -346,6 +346,13 @@ compare_relocs (const void *pa, const void *pb)
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
}
|
|
|
|
#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,
|
2023-08-06 04:25:51 -06:00
|
|
|
@@ -437,8 +444,7 @@ output_relocs (
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
*/
|
|
|
|
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);
|
2023-08-06 04:25:51 -06:00
|
|
|
@@ -1902,8 +1908,7 @@ int main(int argc, char *argv[])
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
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) {
|
2023-08-06 04:25:51 -06:00
|
|
|
@@ -1941,8 +1946,7 @@ int main(int argc, char *argv[])
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
* 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,
|
2023-08-06 04:25:51 -06:00
|
|
|
elf2flt_bfd_section_size(s)))
|
|
|
|
@@ -1971,8 +1975,7 @@ int main(int argc, char *argv[])
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
* 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,
|
2023-08-06 04:25:51 -06:00
|
|
|
elf2flt_bfd_section_size(s)))
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
--
|
2023-08-06 04:25:51 -06:00
|
|
|
2.41.0
|
package/elf2flt: fix fatal error regression on m68k, xtensa, riscv64
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2022-08-11 03:40:49 -06:00
|
|
|
|