tinygo/builder
Ayke van Laethem 8cbfbcae5a build: avoid sharing GlobalValues between build instances
This happens with `tinygo test` for example when testing multiple
packages at the same time. I found this because the compiler crashed in
`make tinygo-test-fast`:

    fatal error: concurrent map writes
    fatal error: concurrent map read and map write

    goroutine 15 [running]:
    github.com/tinygo-org/tinygo/builder.Build({0x40002d0be0, 0xa}, {0x0, 0x0}, {0x4000398048, 0x14}, 0x40003b0000)
            /home/ayke/src/tinygo/tinygo/builder/build.go:131 +0x388
    main.buildAndRun({0x40002d0be0, 0xa}, 0x40003b0000, {0x8bc178, 0x40003a4090}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...)
            /home/ayke/src/tinygo/tinygo/main.go:856 +0x45c
    main.Test({0x40002d0be0, 0xa}, {0x8bc118, 0x40000b3a08}, {0x0?, 0x0?}, 0x40001e6000, {0x0, 0x0})
            /home/ayke/src/tinygo/tinygo/main.go:270 +0x758
    main.main.func3()
            /home/ayke/src/tinygo/tinygo/main.go:1718 +0xe4
    created by main.main in goroutine 1
            /home/ayke/src/tinygo/tinygo/main.go:1712 +0x34ec

My solution is essentially to copy the map over instead of modifying it
directly.

I've also moved the code up a little, because I think that's a more
sensible place (out of the way of the whole package compile logic).
2023-10-04 16:20:32 +02:00
..
ar.go compiler: add compiler-rt and wasm symbols to table 2023-07-31 14:52:26 +02:00
build.go build: avoid sharing GlobalValues between build instances 2023-10-04 16:20:32 +02:00
builder_test.go wasm: add support for GOOS=wasip1 2023-08-17 18:16:54 +02:00
buildid.go Fix for builds of tinygo using an Android host 2022-08-09 11:14:39 +02:00
builtins.go avr: drop GNU toolchain dependency 2022-11-06 09:05:05 +01:00
cc.go builder: remove non-ThinLTO build mode 2023-02-26 19:22:10 +01:00
cc1as.cpp all: switch to LLVM 16 2023-09-18 21:58:02 +02:00
cc1as.h all: switch to LLVM 16 2023-09-18 21:58:02 +02:00
cc_test.go builder: cache C and assembly file outputs 2021-04-05 20:52:04 +02:00
clang.cpp all: remove remaining +build lines 2023-01-17 23:35:53 +01:00
commands.go builder: remove extra formatting verb from error message 2022-05-18 09:06:03 +02:00
config.go builder: update message for max supported Go version 2023-08-09 19:27:15 +02:00
darwin-libsystem.go all: remove support for LLVM 11 and LLVM 12 2022-05-07 17:15:35 +02:00
elfpatch.go rp2040: patch elf to checksum 2nd stage boot 2021-06-17 12:10:04 +02:00
env.go all: move from os.IsFoo to errors.Is(err, ErrFoo) 2022-08-07 10:32:23 +02:00
error.go compiler: add location information to the IR checker 2019-12-21 20:49:51 +01:00
esp.go fix some comments 2023-04-18 22:51:49 +02:00
jobs.go builder: print the status of the job that just completed 2023-04-22 10:01:02 +02:00
library.go all: remove LLVM 14 support 2023-10-01 18:32:15 +02:00
lld.cpp ci: build LLVM with thread support on Windows 2023-03-07 22:38:14 +01:00
mingw-w64.go windows: add ARM64 support 2023-01-30 21:42:47 +01:00
musl.go all: remove LLVM 14 support 2023-10-01 18:32:15 +02:00
nrfutil.go builder: implement Nordic DFU file writer in Go 2023-05-13 09:52:42 +02:00
objcopy.go all: remove calls to deprecated ioutil package 2022-08-07 10:32:23 +02:00
picolibc.go avr: drop GNU toolchain dependency 2022-11-06 09:05:05 +01:00
sizes.go compiler: account for alignment with -size=full 2023-03-08 07:09:46 +01:00
sizes_test.go all: use the new LLVM pass manager 2023-10-04 13:05:58 +02:00
tools-builtin.go windows: add ARM64 support 2023-01-30 21:42:47 +01:00
tools-external.go build: drop deprecated build tags 2022-12-19 23:20:11 +01:00
tools.go main: implement tinygo lldb subcommand 2021-10-05 06:26:21 +02:00
uf2.go all: remove calls to deprecated ioutil package 2022-08-07 10:32:23 +02:00