When rain hits rock it does so with mechanical energy and dilute acid. The acid dissolves many types of minerals and rocks though, of course, very slowly. When a mineral like feldspar is dissolved, it lets sodium ions into the sea; chlorine ions come from other minerals. The sea tastes salty because of the elements which have been dissolved out of rocks.