mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
all: include picolibc for bare metal targets
This is necessary for better CGo support on bare metal. Existing libraries expect to be able to include parts of libc and expect to be able to link to those symbols. Because with this all targets have a working libc, it is now possible to add tests to check that a libc in fact works basically. Not all parts of picolibc are included, such as the math or stdio parts. These should be added later, when needed. This commit also avoids the need for the custom memcpy/memset/memcmp symbols that are sometimes emitted by LLVM. The C library will take care of that.
This commit is contained in:
committed by
Ron Evans
parent
9ec426e25e
commit
f316ebc23b
@@ -76,17 +76,3 @@ func abort() {
|
||||
for {
|
||||
}
|
||||
}
|
||||
|
||||
// Implement memset for LLVM and compiler-rt.
|
||||
//go:export memset
|
||||
func libc_memset(ptr unsafe.Pointer, c byte, size uintptr) {
|
||||
for i := uintptr(0); i < size; i++ {
|
||||
*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
|
||||
}
|
||||
}
|
||||
|
||||
// Implement memmove for LLVM and compiler-rt.
|
||||
//go:export memmove
|
||||
func libc_memmove(dst, src unsafe.Pointer, size uintptr) {
|
||||
memmove(dst, src, size)
|
||||
}
|
||||
|
||||
@@ -95,23 +95,3 @@ func handleHardFault(sp *interruptStack) {
|
||||
println()
|
||||
abort()
|
||||
}
|
||||
|
||||
// Implement memset for LLVM and compiler-rt.
|
||||
//go:export memset
|
||||
func libc_memset(ptr unsafe.Pointer, c byte, size uintptr) {
|
||||
for i := uintptr(0); i < size; i++ {
|
||||
*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
|
||||
}
|
||||
}
|
||||
|
||||
// Implement memmove for LLVM and compiler-rt.
|
||||
//go:export memmove
|
||||
func libc_memmove(dst, src unsafe.Pointer, size uintptr) {
|
||||
memmove(dst, src, size)
|
||||
}
|
||||
|
||||
// Implement memcpy for LLVM and compiler-rt.
|
||||
//go:export memcpy
|
||||
func libc_memcpy(dst, src unsafe.Pointer, size uintptr) {
|
||||
memcpy(dst, src, size)
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// +build tinygo.riscv
|
||||
|
||||
package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Implement memset for LLVM.
|
||||
//go:export memset
|
||||
func libc_memset(ptr unsafe.Pointer, c byte, size uintptr) {
|
||||
for i := uintptr(0); i < size; i++ {
|
||||
*(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
|
||||
}
|
||||
}
|
||||
|
||||
// Implement memmove for LLVM.
|
||||
//go:export memmove
|
||||
func libc_memmove(dst, src unsafe.Pointer, size uintptr) {
|
||||
memmove(dst, src, size)
|
||||
}
|
||||
Reference in New Issue
Block a user