Sanjiv Gupta
2009-Jul-11 16:27 UTC
[LLVMdev] 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
Eli Friedman
2009-Jul-11 16:57 UTC
[LLVMdev] Why the optimizer removes unused "volatile" globals?
On Sat, Jul 11, 2009 at 9:27 AM, Sanjiv Gupta<sanjiv.gupta at microchip.com> wrote:> 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?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.) -Eli