For the first kill of the week, loot is determined based on the spec you were at boss' death. For Elder Charms loot is determined based on the spec you are when you choose to use the coin, not necessarily the same spec you were when you killed the boss.
Its based on your spec.
I always que for dps and heals cause its faster. The loot I get are all tank gear since I entered with tank spec (even though my role is dps and heals)
Im not sure what will happen if you change spec when your already inside.
Im just playing safe so I never swap spec and I make sure I enter in prot so I get prot gear no matter what role I have. Same goes with the bonus loot, it will only give you something you need in what ever spec you have before you entered the raid.
One more Im not sure is, what will happen if you change spec outside the raid then teleport back in? will that also change the loot? no idea.