Please don't merge before merging changes in GVSoC - my own submodules are linked in .gitmodules and changes are coupled. Also build flow expects a libc implementation in ${PULP_RISCV_LLVM_TOOLCHAIN}/picolibc/riscv. Let's please discuss a canonical libc implementation for SDKs.
This PR supports using the LLD linker with PULP-SDK projects on Linux platforms, and adds support for Mac platforms to run GVSoC and build PULP-SDK with Apple LLVM.
SDK
Changed
Linker script no longer aliases regions
Assembly function files correctly annotate section attributes ax and %progbits
Assembly files are compiled with -fno-inline-functions to ensure correct positioning in binary
Added -mno-relax flag to LLVM build flow to enable LLD linking
Added both -z norelro and -fuse-ld=lld flags to linker invocation to force use of lld when LLVM toolchain is set, and avoid linking errors related to unaligned .got and .relro sections -> This should be fixable by either removing .got in the linker script or removing the . ALIGN(4) attribute in the .got section and making it contiguous with the .rodata section.
GVSoC
Changed
Added conditional compile flags for APPLE platforms which avoid setting RTLD_DEEPBIND for dynamically linked libraries, as this is undefined for Apple Clang and the default behaviour on this platform, anyway.
Removed all dependencies on Linux-only prctl sys library. This was used to indicate parent exit to child processes to make them suicide. The same functionality is now implemented in POSIX compliant fashion, by spawning a third monitor process, which polls the parent until it closes. Once this happens, the monitor process closes the child process, then itself.
Removed __STDC_IEC_559__ requirement in flexfloat.h, as it's not really required and trips Apple platforms.
Fixed broken iterator loop in gvsoc_pulp which lead to undefined behaviour.
Removed
dpi_chip_wrapper should not be built on Apple platforms - Afaik there is 0 support for EDA tools on Apple platforms, so I just removed it.
Fixed
Small bug where file ending of dynamically linked libraries was set to ".so". Added conditional compile flag for Apple platforms, which uses ".dylib" instead.
Set required C++ standard to std=c++17, which is required for LLVM compilation
Fixed RPATH problems which were worked around by setting a global LD_LIBRARY_PATH export. Dynamic library location is now correctly set via the RPATH variable in dependent binaries, pointing to their final install location.
Please don't merge before merging changes in GVSoC - my own submodules are linked in
.gitmodules
and changes are coupled. Also build flow expects a libc implementation in${PULP_RISCV_LLVM_TOOLCHAIN}/picolibc/riscv
. Let's please discuss a canonical libc implementation for SDKs.This PR supports using the LLD linker with PULP-SDK projects on Linux platforms, and adds support for Mac platforms to run GVSoC and build PULP-SDK with Apple LLVM.
SDK
Changed
ax
and%progbits
-fno-inline-functions
to ensure correct positioning in binary-mno-relax
flag to LLVM build flow to enable LLD linking-z norelro
and-fuse-ld=lld
flags to linker invocation to force use of lld when LLVM toolchain is set, and avoid linking errors related to unaligned.got
and.relro
sections -> This should be fixable by either removing.got
in the linker script or removing the. ALIGN(4)
attribute in the.got
section and making it contiguous with the.rodata
section.GVSoC
Changed
RTLD_DEEPBIND
for dynamically linked libraries, as this is undefined for Apple Clang and the default behaviour on this platform, anyway.prctl
sys library. This was used to indicate parent exit to child processes to make them suicide. The same functionality is now implemented in POSIX compliant fashion, by spawning a third monitor process, which polls the parent until it closes. Once this happens, the monitor process closes the child process, then itself.__STDC_IEC_559__
requirement inflexfloat.h
, as it's not really required and trips Apple platforms.gvsoc_pulp
which lead to undefined behaviour.Removed
Fixed
".so"
. Added conditional compile flag for Apple platforms, which uses".dylib"
instead.std=c++17
, which is required for LLVM compilationLD_LIBRARY_PATH
export. Dynamic library location is now correctly set via the RPATH variable in dependent binaries, pointing to their final install location.