Skip to contentSkip to conversation

New: hifive_unleashed_defconfig: Linker errors in opensbi-0.9

Buildroot [email protected] 1 participant 11 messages Jun 22, 2023 – Jul 16, 2023

lore
Share & tools
lore
#0 lore raw

https://bugs.busybox.net/show_bug.cgi?id=15658

            Bug ID: 15658
           Summary: hifive_unleashed_defconfig: Linker errors in
                    opensbi-0.9
           Product: buildroot
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Target Milestone: ---

As of c765ac9c02dbddd53cf6813cf59c8f265b043caf, I see this build error:

[build 2023-06-20 03:57:13] ELF platform/generic/firmware/fw_dynamic.elf
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(sbi_init.o):
in function `sbi_init':
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_init.c:385:
undefined reference to `__stack_chk_guard'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(sbi_ipi.o):
in function `sbi_ipi_send_many':
[build 2023-06-20 03:57:13]
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_ipi.c:78:
undefined reference to `__stack_chk_guard'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_ipi.c:92:
undefined reference to `__stack_chk_fail'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(sbi_tlb.o):
in function `sbi_tlb_process':
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_tlb.c:213:
undefined reference to `__stack_chk_guard'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_tlb.c:220:
undefined reference to `__stack_chk_fail'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(sbi_tlb.o):
in function `sbi_tlb_update':
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/sbi/sbi_tlb.c:308:
undefined reference to `__stack_chk_guard'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(sbi_tlb.o):
in function `sbi_tlb_process_count':

[...]

[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/utils/libfdt/fdt_wip.c:81:
undefined reference to `__stack_chk_guard'
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/host/lib/gcc/riscv64-buildroot-linux-gnu/11.3.0/../../../../riscv64-buildroot-linux-gnu/bin/ld:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/lib/libplatsbi.a(fdt_wip.o):
in function `fdt_nop_region_':
[build 2023-06-20 03:57:13] /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/lib/utils/libfdt/fdt_wip.c:55:
undefined reference to `__stack_chk_fail'
[build 2023-06-20 03:57:13] collect2: error: ld returned 1 exit status
[build 2023-06-20 03:57:13] make[1]: *** [Makefile:351:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/build/platform/generic/firmware/fw_dynamic.elf] Error 1
[build 2023-06-20 03:57:13] make[1]: Leaving directory '/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9'
[build 2023-06-20 03:57:13] make: *** [package/pkg-generic.mk:293:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/5/buildroot/output/build/opensbi-0.9/.stamp_built]
Error 2

(Build log at
http://toolchain.lug-owl.de/laminar/jobs/buildroot-hifive_unleashed_defconfig/5
)

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

https://bugs.busybox.net/show_bug.cgi?id=15658

--- Comment #1 from Zhen XIN <[email protected]> ---
Created attachment 9613
--> https://bugs.busybox.net/attachment.cgi?id=9613&action=edit
one line patch that adds -fno-stack-protector to the CFLAGS for opensbi-0.9

Put this patch in boot/opensbi/0.9/ and it builds fine.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Yann E. MORIN <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |INVALID
                 CC|                            |[email protected]
             Status|NEW                         |RESOLVED

--- Comment #2 from Yann E. MORIN <[email protected]> --- Jan-Benedict, All,

You want to get the patch added by 2f7582538fa5 (boot/opensbi: unconditionally disable SSP) and carry it locally in your global patch dir.

When we bumped opensbi from 0.9 to 1.2, that patch no longer applied to 1.2. We can't indefinitely carry patches against older versions, so we dropped it.

It is your responsibility when using a custom version (c765ac9c02db is 2023.05-rc2, which already has opensbi 1.2), to provide any necessary patch, or to use an already patched version.

Regards,
Yann E. MORIN.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

--- Comment #3 from Jan-Benedict Glaw <[email protected]> ---
I'm just doing plain builds with the provided configs. With 0.9 being stripped, maybe the default config needs an update?

BR2_TARGET_OPENSBI=y
BR2_TARGET_OPENSBI_CUSTOM_VERSION=y
BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE="0.9"
BR2_TARGET_OPENSBI_PLAT="generic"

I'll drop the two people that worked on that area an email to get their opinion about it.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Yann E. MORIN <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from Yann E. MORIN <[email protected]> --- Jan-Benedict, All,

(In reply to Jan-Benedict Glaw from comment #3)

Quoted 1 line

I'm just doing plain builds with the provided [hifive_unleashed_defconfig]

Right, sorry, I totally missed that.

So, then we have two options (in order of preference, but n reverse order of simplicity):

1. switch hifive_unleashed_defconfig to use opensbi 1.2

2. add the patch from 2f7582538fa5 into board/sifive/hifive-unleashed/linux/ and use a global patch dir to point to board/sifive/hifive-unleashed/

Seeing commit fad36fa91d9a (configs/hifive_unleashed_defconfig: explicitly use OpenSBI 0.9), there does not seem to be a reason to not use 1.2, so we should at least try that. Could you please report wether opensbi 1.2 also works?

Regards,
Yann E. MORIN.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Yann E. MORIN <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Yann E. MORIN <[email protected]> --- Jan-Benedict, All,

Thanks for the report. We believe it has now ben fixed by commit 02f6d77fbd (configs/hifive_unleashed: Update to use OpenSBI 1.2).

If the issue still persists, do not hesitate to reopen.

Regards,
Yann E. MORIN.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

--- Comment #6 from Jan-Benedict Glaw <[email protected]> --- Started a new build for this configuration
(http://toolchain.lug-owl.de/laminar/jobs/buildroot-hifive_unleashed_defconfig/7),
will let you know how it turned out.

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

--- Comment #7 from Jan-Benedict Glaw <[email protected]> --- Now breaks in uboot:

[build 2023-06-26 20:19:23] /usr/bin/make -f ./scripts/Makefile.build
obj=scripts/dtc/pylibfdt
[build 2023-06-26 20:19:23] cat scripts/dtc/pylibfdt/libfdt.i_shipped >
scripts/dtc/pylibfdt/libfdt.i
[build 2023-06-26 20:19:23] unset CROSS_COMPILE; unset CFLAGS;
CC="/usr/bin/gcc -O2 -isystem /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/host/include" LDSHARED="/usr/bin/gcc -O2 -isystem /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/host/include
-shared "
LDFLAGS="-L/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/host/lib -Wl,-rpath,/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/host/lib" VERSION="2023.04" CPPFLAGS=" -I/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt" OBJDIR=scripts/dtc/pylibfdt SOURCES="/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_ro.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_wip.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_sw.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_rw.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_strerror.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_empty_tree.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_addresses.c /var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/fdt_overlay.c scripts/dtc/pylibfdt/libfdt.i" SWIG_OPTS="-I/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt -I/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/libfdt/.." python3 scripts/dtc/pylibfdt/setup.py --quiet build_ext --inplace
[build 2023-06-26 20:19:23] Traceback (most recent call last):
[build 2023-06-26 20:19:23] File
"/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/scripts/dtc/pylibfdt/setup.py", line 23, in <module>
[build 2023-06-26 20:19:23] from setuptools import setup, Extension
[build 2023-06-26 20:19:23] ModuleNotFoundError: No module named 'setuptools'
[build 2023-06-26 20:19:23] make[3]: *** [scripts/dtc/pylibfdt/Makefile:33:
rebuild] Error 1
[build 2023-06-26 20:19:23] make[2]: *** [scripts/Makefile.build:397:
scripts/dtc/pylibfdt] Error 2
[build 2023-06-26 20:19:23] make[1]: *** [Makefile:2003: scripts_dtc] Error 2
[build 2023-06-26 20:19:23] make[1]: Leaving directory '/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04'
[build 2023-06-26 20:19:23] make: *** [package/pkg-generic.mk:293:
/var/lib/laminar/run/buildroot-hifive_unleashed_defconfig/7/buildroot/output/build/uboot-2023.04/.stamp_built] Error 2

I'm doing the CI builds in quite minimal Docker containers, with just the bare minimum documented packages installed. Shall I add Python's setuptools? Or is it a missing dependency? (Maybe I'd have put that into a new ticket?)

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Jan-Benedict Glaw <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #8 from Jan-Benedict Glaw <[email protected]> --- Hits on --target=i686-pc-msdosdjgpp as well
(http://toolchain.lug-owl.de/laminar/jobs/binutils-i686-pc-msdosdjgpp/38).

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Jan-Benedict Glaw <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |NEW

--- Comment #9 from Jan-Benedict Glaw <[email protected]> --- Sorry, that former comment was ment for a different ticket!

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

[Buildroot] [Bug 15658] hifive_unleashed_defconfig: Linker errors in opensbi-0.9

In reply to [email protected]

https://bugs.busybox.net/show_bug.cgi?id=15658

Peter Korsgaard <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #10 from Peter Korsgaard <[email protected]> --- (In reply to Jan-Benedict Glaw from comment #7)

Looks like the new U-Boot version needs BR2_TARGET_UBOOT_NEEDS_PYLIBFDT. Could you check that?

In the mean time I have cherry picked the opensbi bump for 2023.05.x, so I'm closing this issue - Thanks!

Signature · 6 lines
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot