How to link runtime into shared library

I am trying to add module data for shared go library and getting this error. Can someone suggest how to solve this error.

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-540345387/go.o: relocation R_X86_64_PC32 against symbol `runtime.firstmoduledata’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

I tried pass -ldflags ‘-extldflags “-fPIC”’ in go build but still same error.

While making a shared library, it also compile the runtime code. How does it compile the runtime code? Can I pass fpic while compiling runtime code?