[LLVMdev] The mysterious case of the missing GlobalVariables.

Richard Pennington rich at pennware.com
Sat Jul 18 12:23:35 PDT 2009


Jeffrey Yasskin wrote:
> If the globals don't have 'external' linkage, the optimizers will
> happily eliminate them. If they are marked external, attaching the .bc
> file, reduced if possible, will give people a better chance of helping
> you.

The problem is that the .bc file is correct, so it wouldn't do any good. 
It's only when I don't create the files that I have the problem (all in 
memory). The optimizer shouldn't happily eliminate variables that are 
accessed, though.

Anton gave me a hint, though, that solved my (stupid) mystery: I had 
switched to formatted_raw_output for my assembly file writing and didn't 
notice that I needed a flush(). The declarations at the end of the file 
were left off.

-Rich



More information about the llvm-dev mailing list