Fix link.h issues

See the commit logs for details.