diff options
author | Lucas Teske <[email protected]> | 2020-05-20 13:05:25 -0300 |
---|---|---|
committer | Ayke <[email protected]> | 2020-05-21 00:57:19 +0200 |
commit | 726d735ad35f1c1ea0ffc59a25a44e2d167a8ccf (patch) | |
tree | bd609c09ef2bc58f72b21ff9d2f6f2b5132edcfc /loader | |
parent | b9fd6cee6f0e427d1f2317734f49411e190cec75 (diff) | |
download | tinygo-726d735ad35f1c1ea0ffc59a25a44e2d167a8ccf.tar.gz tinygo-726d735ad35f1c1ea0ffc59a25a44e2d167a8ccf.zip |
cgo: Add LDFlags support
Diffstat (limited to 'loader')
-rw-r--r-- | loader/loader.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/loader/loader.go b/loader/loader.go index 5682bfa4a..28ade8d2e 100644 --- a/loader/loader.go +++ b/loader/loader.go @@ -31,6 +31,7 @@ type Program struct { Dir string // current working directory (for error reporting) TINYGOROOT string // root of the TinyGo installation or root of the source code CFlags []string + LDFlags []string ClangHeaders string } @@ -425,11 +426,12 @@ func (p *Package) parseFiles(includeTests bool) ([]*ast.File, error) { if p.ClangHeaders != "" { cflags = append(cflags, "-Xclang", "-internal-isystem", "-Xclang", p.ClangHeaders) } - generated, errs := cgo.Process(files, p.Program.Dir, p.fset, cflags) + generated, ldflags, errs := cgo.Process(files, p.Program.Dir, p.fset, cflags) if errs != nil { fileErrs = append(fileErrs, errs...) } files = append(files, generated) + p.LDFlags = append(p.LDFlags, ldflags...) } if len(fileErrs) != 0 { return nil, Errors{p, fileErrs} |