Linear dichroism in 3d core-level and 4f valence-band photoemission spectra of strongly correlated rare-earth compounds