Can't pass -extldflags to golang

248 views
Skip to first unread message

Olivia Nelson

unread,
Feb 28, 2020, 8:07:58 AM2/28/20
to golang-nuts

I'm trying to use extldflags with golang:

-ldflags '-extld gcc -extldflags="-headerpad 0x500" -w -s'

But go link does not recognize it, it prints the help dialog

# command-line-arguments
usage: link [options] main.o
  -B note
        add an ELF NT_GNU_BUILD_ID note when using ELF

  ...

  -extld linker
        use linker when linking in external mode
  -extldflags flags
        pass flags to external linker

Any ideas?

Ian Lance Taylor

unread,
Feb 28, 2020, 11:26:06 AM2/28/20
to Olivia Nelson, golang-nuts
go build -ldflags '-extld gcc "-extldflags=-headerpad 0x500" -w -s'

Ian
Reply all
Reply to author
Forward
0 new messages