I have written a blog post (and there is an accompanying Github repository with some examples) on this topic.
To address the issue you are facing, I defined a new helper (using kfunc) that does nothing. Then I use this helper function in the XDP program so that the MAP is associated with the program when the verifier is doing its pass. This avoids the error you are getting.