It borders the counties of Hampshire , Dorset , Somerset , Gloucestershire , Oxfordshire and Berkshire , and contains the unitary authority of Swindon . It is landlocked and borders the counties of Dorset , Somerset , Hampshire , Gloucestershire , Oxfordshire and Berkshire .