What a good question. But unanswerable by me and my prior knowledge and skill in google-fu. I have some general answers. This is a complicated area, since smell is both a physical issue and an individual and unmeasurable issue. Olfactory science is at a surprisingly basic level, given how far we are generally. I tried investigating what compounds in rice provide odour, the answer seems to be; way more than I could possibly have thought. Check out this article - while it is rough to digest a scientific articl unless you have basis knowledge just look at that list at page 505-506. There are many aromas in rice!
As for what functions they perform - looking at the list it is probably impossible to generalize down to what functions such a wide array of compounds do. Certainly, some compounds that are odorous has a primary function of being odorous, attracting pollinators and attracting mates. For rice, which has been around humans since time immemorial (at least 9k BC) they have probably been through a selection process, the most benevolent smelling rice plants being selectively bred, but this is speculation on my part. Other compounds have other functions and just happen to have a strong odour. Generally, to be odorous, the compound must have some volatility. What can also be said generally and very broadly is that alcohols and aldehydes / ketones are more often odorous than other compounds. There are also certain inorganic compounds that are (and often strongly so), Ammonia, Sulfide and the "garlic" series (S-Se-Te) for instance.
Good question. If you learn more, let us know.