mbox series

[v5,0/8] tools/nolibc: add 32/64-bit powerpc support

Message ID cover.1691062722.git.falcon@tinylab.org
Headers show
Series tools/nolibc: add 32/64-bit powerpc support | expand

Message

Zhangjin Wu Aug. 3, 2023, 11:43 a.m. UTC
Hi, Willy

Here is the v5, purely include the ppc parts, with two critical fixups
for the latest gcc 13.1.0 toolchain, now, both run and run-user pass.

Here is the run-user test report:

    // with local toolchains
    $ for arch in ppc ppc64 ppc64le; do make run-user XARCH=$arch | grep "status: "; done
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning

    // with latest toolchains
    $ for arch in ppc ppc64 ppc64le; do make run-user XARCH=$arch CC=/path/to/gcc-13.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc | grep status; file nolibc-test; done
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning
    nolibc-test: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning
    nolibc-test: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped
    165 test(s): 157 passed,   8 skipped,   0 failed => status: warning
    nolibc-test: ELF 64-bit LSB executable, 64-bit PowerPC or cisco 7500, version 1 (SYSV), statically linked, stripped

Since the missing serial console enabling patch [1] for ppc32 has
already gotten a Reviewed-by line from the ppc maintainer, now, the ppc
defconfig aligns with the others', and it is able to simply move the
nolibc-test-config related stuff to the next tinyconfig series.

Based on v4 [2], beside removing several nolibc-test-config related
patches, two bugs with the latest gcc 13.1.0 have been fixed.

Changes from v4 --> v5:  

* tools/nolibc: add support for powerpc64
  selftests/nolibc: add XARCH and ARCH mapping support
  selftests/nolibc: add test support for ppc64
  selftests/nolibc: allow customize CROSS_COMPILE by architecture
  selftests/nolibc: customize CROSS_COMPILE for 32/64-bit powerpc

    Almost the same as v4.

* tools/nolibc: add support for powerpc

    For 32-bit PowerPC, with newer gcc compilers (e.g. gcc 13.1.0),
    "omit-frame-pointer" fails with __attribute__((no_stack_protector)) but
    works with __attribute__((__optimize__("-fno-stack-protector")))

    Using the later for ppc32 to workaround the issue.

* selftests/nolibc: add test support for ppc

    Add default CFLAGS for ppc to allow build with the
    latest powerpc64-linux-gcc toolchain from
    https://mirrors.edge.kernel.org/pub/tools/crosstool/ 

* selftests/nolibc: add test support for ppc64le

    Align with kernel, prefer elfv2 ABI to elfv1 ABI when the toolchain
    support, otherwise, ABI mismatched binary will not run.

Best regards,
Zhangjin Wu
---
[1]: https://lore.kernel.org/lkml/bb7b5f9958b3e3a20f6573ff7ce7c5dc566e7e32.1690982937.git.tanyuan@tinylab.org/
[2]: https://lore.kernel.org/lkml/cover.1690916314.git.falcon@tinylab.org/

Zhangjin Wu (8):
  tools/nolibc: add support for powerpc
  tools/nolibc: add support for powerpc64
  selftests/nolibc: add XARCH and ARCH mapping support
  selftests/nolibc: add test support for ppc
  selftests/nolibc: add test support for ppc64le
  selftests/nolibc: add test support for ppc64
  selftests/nolibc: allow customize CROSS_COMPILE by architecture
  selftests/nolibc: customize CROSS_COMPILE for 32/64-bit powerpc

 tools/include/nolibc/arch-powerpc.h     | 213 ++++++++++++++++++++++++
 tools/include/nolibc/arch.h             |   2 +
 tools/testing/selftests/nolibc/Makefile |  74 ++++++--
 3 files changed, 277 insertions(+), 12 deletions(-)
 create mode 100644 tools/include/nolibc/arch-powerpc.h