You always need to be prepared for the unexpected, so travel with a supply of snacks ie, (commercially sealed) tinned food that can be eaten cold or heated, muesli bars, rice crackers, corn thins or biscuits. Always have a small meal or two (depending on flight length) and a few different snacks for your flight. This is also useful when you are transiting at airports as a lot of fast food is not Gluten Free or you are too tired to find out (as you can not speak the language!!) and this is the easiest and safest option.
Many people believe they can not take food into a foreign country. Having traveled extensively through many continents, I have had no problem taking in prepacked (unopened and in original seal) commercial products into countries. Always declare that you are carrying food (on your Immigration / Customs / Quarantine Card that you fill out on the plane prior to landing) and once it is inspected, items declared will normally be returned to you. Even if they are taken off you, it is still better than getting into trouble with authorities.
Do your homework before you go and check with the customs and quarantine of the country you are visiting. "Food" includes anything you eat or drink such as processed foods, uncooked food, airline food, snacks and ingredients.
Also some countries will have a large variety of gluten free products available to buy in the country itself so you would only need to take enough for your flight. Celiac Societies in most countries could help with this information.