[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:41:00 PDT 2017
On 04/24/2017 01:55 PM, Andrew Kelley via llvm-dev wrote:
> I see, thanks. Would a patch be welcome which changed this behavior?
> Or I suppose I could emit zeroinitializer instead of undef. But it
> seems like undef is the more correct value.
Are you producing these undef values yourself (in a pass/fronted)? 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.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev