cmd/ld: fix inconsistency in internal linking of common symbols.

Some variables declared in C could end up as undefined symbols
in the final binary and have null address.

Fixes issue 5114.
Fixes issue 5227.

R=golang-dev, iant, ajstarks, dave, r
CC=golang-dev
https://codereview.appspot.com/8602044