Fix link ordering issue on FreeBSD