It's a fairly common legend that trolls turn to stone when exposed to daylight, and I was thinking about using such a creature in a story. I'm searching for a plausible way of justifying such a weakness - there's nothing similar existing in nature that I know about.
For background; I'm visualising these trolls as primitive, ape-like creatures that can grow to very large sizes. They are nocturnal / subterranean animals, and the sun is bane to them. They can move around on the surface at night, but in the daytime they have to take shelter under bridges or in caves.
Direct sunlight is their big weakness. These trolls are like lobsters - they are biologically immortal and they will continue to grow for as long they live. The trolls keep on growing and getting larger until they can't support their own mass, or until they can't hide from the sunlight any more.
When they die in the sunlight, their skin calcifies and they become rock. It's a slow and painful death; their skin turns to stone from the outwards inwards, until they finally crack apart.
The very largest trolls might become mountains. In this world, there are lots of strange rock formations that have been left behind by dead trolls.
It's possible that young trolls have resistance to sunlight and can operate in the day, but as they get older they lose this resistance. Young trolls are born in droves, but very few of them reach large sizes.
So; biologically speaking, what could justify this fatal trait of trolls? I want to avoid just using magic as a reason, and I'm more looking for broadly feasible suggestions about how and why trolls might develop like this. Is there any deficiency, medical or evolutionary reason on why would sunburn would cause troll's skin to calcify?