Skip to content

Commit d50fc66

Browse files
committed
add -Wl,-Bsymbolic to link c-archive in the same way as c-shared
Thank you @ianlancetaylor for the suggestion and insight! This resolved the issue outlined in golang/go#30822.
1 parent d5d39d7 commit d50fc66

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

a/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: a.so
22

33
a.so: a.c go-a.a
4-
clang -shared -o $@ $^ -lpthread
4+
clang -Wl,-Bsymbolic -shared -o $@ $^ -lpthread
55

66
go-a.a: go-a.go
77
CGO_ENABLED=1 go build -buildmode=c-archive -o $@ $<

b/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: b.so
22

33
b.so: b.c go-b.a
4-
clang -shared -o $@ $^ -lpthread
4+
clang -Wl,-Bsymbolic -shared -o $@ $^ -lpthread
55

66
go-b.a: go-b.go
77
CGO_ENABLED=1 go build -buildmode=c-archive -o $@ $<

c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: c.so
22

33
c.so: c.c go-c.a
4-
clang -shared -o $@ $^ -lpthread
4+
clang -Wl,-Bsymbolic -shared -o $@ $^ -lpthread
55

66
go-c.a: go-c.go
77
CGO_ENABLED=1 go build -buildmode=c-archive -o $@ $<

0 commit comments

Comments
 (0)