aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder/ar.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2021-09-24 01:39:56 +0200
committerRon Evans <[email protected]>2021-10-26 17:08:30 +0200
commit14bb90c3c0f59b752cd4017648521b9adcfeb013 (patch)
tree3816fe95aae891c160213a2a2f8359015ec36919 /builder/ar.go
parent1645f45c1a42c57426017741643caebfaabc19ea (diff)
downloadtinygo-14bb90c3c0f59b752cd4017648521b9adcfeb013.tar.gz
tinygo-14bb90c3c0f59b752cd4017648521b9adcfeb013.zip
cgo: add support for stdio in picolibc and wasi-libc
This adds support for stdio in picolibc and fixes wasm_exec.js so that it can also support C puts. With this, C stdout works on all supported platforms.
Diffstat (limited to 'builder/ar.go')
-rw-r--r--builder/ar.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/builder/ar.go b/builder/ar.go
index 37b94af2f..ee8ba0706 100644
--- a/builder/ar.go
+++ b/builder/ar.go
@@ -5,6 +5,7 @@ import (
"debug/elf"
"encoding/binary"
"errors"
+ "fmt"
"io"
"os"
"path/filepath"
@@ -49,7 +50,7 @@ func makeArchive(archivePath string, objs []string) error {
// Read the symbols and add them to the symbol table.
dbg, err := elf.NewFile(objfile)
if err != nil {
- return err
+ return fmt.Errorf("failed to open file %s: %w", objpath, err)
}
symbols, err := dbg.Symbols()
if err != nil {
@@ -61,9 +62,8 @@ func makeArchive(archivePath string, objs []string) error {
// Don't include local symbols (STB_LOCAL).
continue
}
- if elf.ST_TYPE(symbol.Info) != elf.STT_FUNC {
+ if elf.ST_TYPE(symbol.Info) != elf.STT_FUNC && elf.ST_TYPE(symbol.Info) != elf.STT_OBJECT {
// Not a function.
- // TODO: perhaps globals variables should also be included?
continue
}
// Include in archive.