Gas giants are believed to form by the accretion of hydrogen-helium gas around an initial protocore of rock and ice. The question of whether the rocky parts of the core dissolve into the fluid H-He layers following formation has significant implications for planetary structure and evolution. Here we use ab initio calculations to study rock solubility in fluid hydrogen, choosing MgO as a representative example of planetary rocky materials, and find MgO to be highly soluble in H for temperatures in excess of approximately 10,000 K, implying the potential for significant redistribution of rocky core material in Jupiter and larger exoplanets.