I watched this movie in maybe 1992 but it's not the iron giant for sure. I just remember a young boy finding the old war robot and some bad guys trying to take it. I seem to remember the robot was an old war relic and a chase scene with a steam train springs to mind. Thanks in advance for anyone who helps solve this.
In Castle in the Sky (1986) there is an ancient, broken robot that is later reanimated and begins attacking people.
The young boy (Pazu) doesn't find the robot, but he and a young girl (Sheeta) are taken to a fortress where the robot is already being studied. The "bad guys" were attempting to repair it.
There is a scene later in the movie where Pazu and Sheeta find another robot that is deactivated and overgrown with grass and moss. This may be where you got the "buried in a cliff" memory.
The movie also includes a steam train chase between the young boy and girl, a band of pirates, and a group of government and military men.