Skip to content

Commit 263ffe4

Browse files
committed
builder: don't use precompiled libraries
We used these libraries in the past, but stopped doing so a while ago. This is a small cleanup to remove support for these entirely.
1 parent c1c074f commit 263ffe4

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

builder/library.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,8 @@ type Library struct {
4848
// target config. In other words, pass this libc if the library needs a libc to
4949
// compile.
5050
func (l *Library) load(config *compileopts.Config, tmpdir string, libc *compileJob) (job *compileJob, abortLock func(), err error) {
51-
outdir, precompiled := config.LibcPath(l.name)
51+
outdir := config.LibcPath(l.name)
5252
archiveFilePath := filepath.Join(outdir, "lib.a")
53-
if precompiled {
54-
// Found a precompiled library for this OS/architecture. Return the path
55-
// directly.
56-
return dummyCompileJob(archiveFilePath), func() {}, nil
57-
}
5853

5954
// Create a lock on the output (if supported).
6055
// This is a bit messy, but avoids a deadlock because it is ordered consistently with other library loads within a build.

compileopts/config.go

+7-16
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,9 @@ func MuslArchitecture(triple string) string {
247247
return CanonicalArchName(triple)
248248
}
249249

250-
// LibcPath returns the path to the libc directory. The libc path will be either
251-
// a precompiled libc shipped with a TinyGo build, or a libc path in the cache
252-
// directory (which might not yet be built).
253-
func (c *Config) LibcPath(name string) (path string, precompiled bool) {
250+
// LibcPath returns the path to the libc directory. The libc path will be a libc
251+
// path in the cache directory (which might not yet be built).
252+
func (c *Config) LibcPath(name string) string {
254253
archname := c.Triple()
255254
if c.CPU() != "" {
256255
archname += "-" + c.CPU()
@@ -266,17 +265,9 @@ func (c *Config) LibcPath(name string) (path string, precompiled bool) {
266265
archname += "-" + c.Target.Libc
267266
}
268267

269-
// Try to load a precompiled library.
270-
precompiledDir := filepath.Join(goenv.Get("TINYGOROOT"), "pkg", archname, name)
271-
if _, err := os.Stat(precompiledDir); err == nil {
272-
// Found a precompiled library for this OS/architecture. Return the path
273-
// directly.
274-
return precompiledDir, true
275-
}
276-
277268
// No precompiled library found. Determine the path name that will be used
278269
// in the build cache.
279-
return filepath.Join(goenv.Get("GOCACHE"), name+"-"+archname), false
270+
return filepath.Join(goenv.Get("GOCACHE"), name+"-"+archname)
280271
}
281272

282273
// DefaultBinaryExtension returns the default extension for binaries, such as
@@ -360,7 +351,7 @@ func (c *Config) LibcCFlags() []string {
360351
case "picolibc":
361352
root := goenv.Get("TINYGOROOT")
362353
picolibcDir := filepath.Join(root, "lib", "picolibc", "newlib", "libc")
363-
path, _ := c.LibcPath("picolibc")
354+
path := c.LibcPath("picolibc")
364355
return []string{
365356
"-nostdlibinc",
366357
"-isystem", filepath.Join(path, "include"),
@@ -370,7 +361,7 @@ func (c *Config) LibcCFlags() []string {
370361
}
371362
case "musl":
372363
root := goenv.Get("TINYGOROOT")
373-
path, _ := c.LibcPath("musl")
364+
path := c.LibcPath("musl")
374365
arch := MuslArchitecture(c.Triple())
375366
return []string{
376367
"-nostdlibinc",
@@ -390,7 +381,7 @@ func (c *Config) LibcCFlags() []string {
390381
return nil
391382
case "mingw-w64":
392383
root := goenv.Get("TINYGOROOT")
393-
path, _ := c.LibcPath("mingw-w64")
384+
path := c.LibcPath("mingw-w64")
394385
return []string{
395386
"-nostdlibinc",
396387
"-isystem", filepath.Join(path, "include"),

0 commit comments

Comments
 (0)