Inside the Rock of Gibraltar itself , miles of tunnels were excavated from the limestone . Masses of rock were blasted out to build an " underground city " . In huge man @-@ made caverns , barracks , offices , and a fully equipped hospital were constructed , complete with an operating theatre and X @-@ ray equipment .