Both carmakers are facing overcapacity and the need for huge investments related to electric-vehicle and self-driving technologies.