Hello, I'm building a simple program that has a dependency to github.com/DataDog/zstd, a wrapper of a C code. So by default, Go will use the external linker. When debugging with, I can see
host link: "clang" "-m64" "-Wl,-headerpad,1144" "-Wl,-no_pie" "-Wl,-pagezero_size,4000000" "-o" "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-build122622791/b001/exe/a.out" "-Qunused-arguments" "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-link-023224426/go.o" "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-link-023224426/000000.o" [...] "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-link-023224426/000053.o" "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-link-023224426/000054.o" "/var/folders/bb/w1lgkjdx47qd7695hb5r400h0000gn/T/go-link-023224426/000055.o" "-g" "-O2" "-g" "-O2" "-g" "-O2" "-lpthread" "-g" "-O2" "-framework" "CoreFoundation" "-framework" "Security" "-no-pie" It links 55 files, from 000000.o to 000055.oIf I had more custom debug, I can see than those files are mostly duplication: 000004.o is /path/to/go-build/67/678a3a394ba4feae32a2ddb829ea65c1cf24be64248dcbcc3dae709b8e3b826d-d github.com/DataDog/zstd /path/to/go-build/67/678a3a394ba4feae32a2ddb829ea65c1cf24be64248dcbcc3dae709b8e3b826d-d(_x005.o) 000005.o is /path/to/go-build/67/678a3a394ba4feae32a2ddb829ea65c1cf24be64248dcbcc3dae709b8e3b826d-d github.com/DataDog/zstd /path/to/go-build/67/678a3a394ba4feae32a2ddb829ea65c1cf24be64248dcbcc3dae709b8e3b826d-d(_x006.o) I can see 40 times this zstd package among the 55 files. Is it expected? What is the difference between them? Also, what would happen to the non known cgo packages (not net, os/user or runtime/cgo) if cgo is not enabled? How the internal linker will manage this cgo package? Thank you -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/db2d65de-8fc5-460e-b309-57f27cdf86cf%40googlegroups.com.