The Chemical link between stars and their rocky planets