Skip to content

Commit 28a0836

Browse files
committed
cgo: allow --export= in LDFLAGS
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.
1 parent 7e7814a commit 28a0836

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cgo/security.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ var validLinkerFlags = []*regexp.Regexp{
142142
re(`-L([^@\-].*)`),
143143
re(`-O`),
144144
re(`-O([^@\-].*)`),
145+
re(`--export=(.+)`), // for wasm-ld
145146
re(`-f(no-)?(pic|PIC|pie|PIE)`),
146147
re(`-f(no-)?openmp(-simd)?`),
147148
re(`-fsanitize=([^@\-].*)`),

0 commit comments

Comments
 (0)