Skip to content

Commit

Permalink
cmd/link: external linking can fail on Solaris 11.2+
Browse files Browse the repository at this point in the history
Workaround external linking issues encountered on Solaris 11.2+ due to
the go.o object file being created with a NULL STT_FILE symtab entry by
using a placeholder name.

Fixes #14957

Change-Id: I89c501b4c548469f3c878151947d35588057982b
Reviewed-on: https://go-review.googlesource.com/21636
Reviewed-by: David Crawshaw <[email protected]>
  • Loading branch information
binarycrusader authored and bradfitz committed Apr 11, 2016
1 parent 3fafe2e commit e79fef8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cmd/link/internal/ld/symtab.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ func Asmelfsym() {

// Some linkers will add a FILE sym if one is not present.
// Avoid having the working directory inserted into the symbol table.
putelfsyment(0, 0, 0, STB_LOCAL<<4|STT_FILE, SHN_ABS, 0)
// It is added with a name to avoid problems with external linking
// encountered on some versions of Solaris. See issue #14957.
putelfsyment(putelfstr("go.go"), 0, 0, STB_LOCAL<<4|STT_FILE, SHN_ABS, 0)
numelfsym++

elfbind = STB_LOCAL
Expand Down

0 comments on commit e79fef8

Please sign in to comment.