diff options
author | Ayke van Laethem <[email protected]> | 2020-01-15 15:59:51 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2020-03-22 17:14:59 +0100 |
commit | f316ebc23b025e497931cfe420ec143f1a217b57 (patch) | |
tree | 62099034937787559599a42a6adbd820417df7b3 /cgo | |
parent | 9ec426e25e6738be6e09e0239445d1ca558cbf57 (diff) | |
download | tinygo-f316ebc23b025e497931cfe420ec143f1a217b57.tar.gz tinygo-f316ebc23b025e497931cfe420ec143f1a217b57.zip |
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.
Diffstat (limited to 'cgo')
-rw-r--r-- | cgo/cgo.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cgo/cgo.go b/cgo/cgo.go index 58aaed81c..d6470a522 100644 --- a/cgo/cgo.go +++ b/cgo/cgo.go @@ -170,6 +170,11 @@ func Process(files []*ast.File, dir string, fset *token.FileSet, cflags []string enums: map[string]enumInfo{}, } + // Disable _FORTIFY_SOURCE as it causes problems on macOS. + // Note that it is only disabled for memcpy (etc) calls made from Go, which + // have better alternatives anyway. + cflags = append(cflags, "-D_FORTIFY_SOURCE=0") + // Add a new location for the following file. generatedTokenPos := p.fset.AddFile(dir+"/!cgo.go", -1, 0) generatedTokenPos.SetLines([]int{0}) |