aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2020-01-15 15:59:51 +0100
committerRon Evans <[email protected]>2020-03-22 17:14:59 +0100
commitf316ebc23b025e497931cfe420ec143f1a217b57 (patch)
tree62099034937787559599a42a6adbd820417df7b3 /main.go
parent9ec426e25e6738be6e09e0239445d1ca558cbf57 (diff)
downloadtinygo-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 'main.go')
-rw-r--r--main.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/main.go b/main.go
index c21b1377b..d4361d13b 100644
--- a/main.go
+++ b/main.go
@@ -786,7 +786,7 @@ func main() {
}
err := Build(pkgName, *outpath, options)
handleCompilerError(err)
- case "build-builtins":
+ case "build-library":
// Note: this command is only meant to be used while making a release!
if *outpath == "" {
fmt.Fprintln(os.Stderr, "No output filename supplied (-o).")
@@ -796,7 +796,22 @@ func main() {
if *target == "" {
fmt.Fprintln(os.Stderr, "No target (-target).")
}
- path, err := builder.CompilerRT.Load(*target)
+ if flag.NArg() != 1 {
+ fmt.Fprintf(os.Stderr, "Build-library only accepts exactly one library name as argument, %d given\n", flag.NArg())
+ usage()
+ os.Exit(1)
+ }
+ var lib *builder.Library
+ switch name := flag.Arg(0); name {
+ case "compiler-rt":
+ lib = &builder.CompilerRT
+ case "picolibc":
+ lib = &builder.Picolibc
+ default:
+ fmt.Fprintf(os.Stderr, "Unknown library: %s\n", name)
+ os.Exit(1)
+ }
+ path, err := lib.Load(*target)
handleCompilerError(err)
copyFile(path, *outpath)
case "flash", "gdb":