Why the optimizer removes unused "volatile" globals?

PIC16 does not want globals marked with section attributes being deleted. But I see llvm-ld removes them even if the user marks them as "volatile".I wonder why?

- Sanjiv

If there aren't any references to a global with internal linkage, it's
assumed to be unused, and deleted. Try taking a look at the generated
code when __attribute__((used)) is applied to a global. (volatile is
irrelevant here.)