Rory McIlroy overcame a spot of tree trouble to claim a share of the lead at the US PGA Championship.