(original) (raw)

On 4/24/2017 11:55 AM, Andrew Kelley wrote:


On Mon, Apr 24, 2017 at 2:53 PM, Friedman, Eli <efriedma@codeaurora.org> wrote:
On 4/23/2017 10:10 AM, Andrew Kelley via llvm-dev wrote:
Here is a module:

@vals = internal unnamed\_addr global \[20000000 x i32\] undef, align 4

LLVM puts the global in the .data section, and results in a 77MB .o file of mostly zeroes. Why does this variable not go in the .bss section?


I think it's just an oversight; it doesn't matter for clang because it never emits globals like that. See TargetLoweringObjectFile::getKindForGlobal for the relevant logic.

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.

Sure, patch welcome.

-Eli

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