cgo: add support for printf

The C printf function is sometimes needed for C files included using
CGo. This commit makes sure they're available on all systems where CGo
is fully supported (that is, everywhere except on AVR).

For baremetal systems using picolibc, I've picked the integer-only
version of printf to save on flash size. We might want to consider
providing a way to pick the floating point version instead, if needed.
This commit is contained in:
Ayke van Laethem
2024-01-27 12:43:45 +01:00
committed by Ron Evans
parent 3021e16bbf
commit 2eb39785fe
9 changed files with 45 additions and 7 deletions
+3 -2
View File
@@ -176,11 +176,12 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
defer unlock()
libcDependencies = append(libcDependencies, libcJob)
case "mingw-w64":
_, unlock, err := libMinGW.load(config, tmpdir)
job, unlock, err := libMinGW.load(config, tmpdir)
if err != nil {
return BuildResult{}, err
}
unlock()
defer unlock()
libcDependencies = append(libcDependencies, job)
libcDependencies = append(libcDependencies, makeMinGWExtraLibs(tmpdir, config.GOARCH())...)
case "":
// no library specified, so nothing to do