how to pass the following compiler/linker flags using -gccgoflags build flag

65 views
Skip to first unread message

Yonatan Gizachew

unread,
Dec 23, 2020, 1:31:13 AM12/23/20
to golang-nuts
Hello,

I want to pass the '-Wl,--split-stack-adjust-size=0x8000' to the gold linker as follows:

go build -o libgotest.so -buildmode=c-shared -compiler=gccgo -gccgoflags='-Wl,--split-stack-adjust-size=0x8000' test_mmap.go
But there s "unrecognized option" error. Could you please tell me the correct way of passing these flags? 

Thank you!

Ian Lance Taylor

unread,
Dec 23, 2020, 1:38:44 AM12/23/20
to Yonatan Gizachew, golang-nuts
What you wrote looks about right to me. What is the exact and complete output?

Ian

Yonatan Gizachew

unread,
Dec 23, 2020, 1:47:50 AM12/23/20
to golang-nuts
# command-line-arguments
/usr/bin/ld: unrecognized option '--split-stack-adjust-size=0x8000'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status

Yonatan Gizachew

unread,
Dec 23, 2020, 2:42:59 AM12/23/20
to golang-nuts
Aha, I got the problem. I should have added -fuse-ld=gold. The following works well. 
go build -o libgotest.so -buildmode=c-shared -compiler=gccgo -gccgoflags='-fuse-ld=gold -Wl,--split-stack-adjust-size=0x8000' test_mmap.go

Thank you!
Reply all
Reply to author
Forward
0 new messages