Compile this program with the C frontend: ----- int X; ----- X is removed from the translation unit. In C, the variable must be declared as weak, and since LLVM has no notion of the difference between "linkonce" and "weak", the optimizer things the variable is safe to delete.
This is tested by: GlobalDCE/2003-10-09-PreserveWeakGlobals.ll
This has been fixed in the C Frontend. This just needs to be fixed in LLVM proper.
Weak linkage is now implemented