[llvm-dev] why do undefined globals end up in .data instead of .bss?

Tobias Edler von Koch via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 25 13:51:54 PDT 2017

On 04/25/2017 03:48 PM, Andrew Kelley wrote:
>     Can you elaborate a little on why you think "undef" is the correct
>     value? Inside LLVM, undef essentially means "any value we choose".
>     The language reference has a section on this. It would be entirely
>     correct if we emitted all 1s instead of all 0s for undef. If you
>     really want it to be .bss, zeroinitializer seems to be the better
>     choice.
> Yes, any value would be semantically correct. What I am communicating 
> to LLVM is "any value will be fine here" which means that LLVM can do 
> whatever it wants here to achieve better performance, compile time 
> speed, smaller object size, or another goal that I have not thought 
> of. And in this email thread I am suggesting that LLVM should probably 
> choose the smaller object size goal in this situation, choose 0 for 
> the value, and put it in .bss.

Ah ok, in that case it makes sense. As Eli said, feel free to submit a 



Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170425/92822c38/attachment.html>

More information about the llvm-dev mailing list