The 49ers have signed Anthony Davis to a five-year contract extension.