This contradiction is more apparent than real"contradiction" actually does not exist.
First, Mark 2:26 does NOT say that Abiathar gave David the bread (as the OP suggest); all that Mark says is that the incident occurred during the priesthood ("during the days of") Abiathar the High priest. Note the verse as quoted below:
In the days of Abiathar the high priest, he entered the house of God and ate the consecrated bread, which is lawful only for priests to eat. And he also gave some to his companions."
This is similar to that found in places like Luke 3:1, 2 where an almost identical time=location phrase is used: "during the high-priesthood of …"
The reference in 1 Sam 21:1-6 clearly says that the actual priest involved in the transaction was "Ahimelech the priest".
I see no contradiction here at all.