diff options
author | Ayke van Laethem <[email protected]> | 2022-09-14 13:07:27 +0200 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2022-09-15 11:36:29 +0200 |
commit | 28a083633c23d5ac0703aa9e98f49a97ffe12652 (patch) | |
tree | ec9d0e83337b47dab686f530f2c36fc059cc0939 /cgo/security.go | |
parent | 7e7814a0872c079d82d2f1837078e7eb5db06798 (diff) | |
download | tinygo-28a083633c23d5ac0703aa9e98f49a97ffe12652.tar.gz tinygo-28a083633c23d5ac0703aa9e98f49a97ffe12652.zip |
cgo: allow --export= in LDFLAGSwasm-no-malloc
This allows people to export some functions, such as malloc. Example:
// #cgo LDFLAGS: --export=malloc
import "C"
This exports the function malloc.
Note that this is somewhat unsafe right now, but it is used regardless.
By using this workaround, people have some time to transition away from
using malloc/free directly or until malloc is made safe to be used in
this way.
Diffstat (limited to 'cgo/security.go')
-rw-r--r-- | cgo/security.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/cgo/security.go b/cgo/security.go index 2fea40c8a..28bd23ef6 100644 --- a/cgo/security.go +++ b/cgo/security.go @@ -142,6 +142,7 @@ var validLinkerFlags = []*regexp.Regexp{ re(`-L([^@\-].*)`), re(`-O`), re(`-O([^@\-].*)`), + re(`--export=(.+)`), // for wasm-ld re(`-f(no-)?(pic|PIC|pie|PIE)`), re(`-f(no-)?openmp(-simd)?`), re(`-fsanitize=([^@\-].*)`), |