Skip to content

-fno-zero-initialized-in-bss and tentative definitions #30973

@hubert-reinterpretcast

Description

@hubert-reinterpretcast
Bugzilla Link 31625
Version trunk
OS Linux
CC @erichkeane,@zygoloid

Extended Description

Clang's support for -fno-zero-initialized-in-bss does not match GCC's.
In particular, when using -fno-common, tentative definitions are still placed by GCC into BSS.

Online compiler:
http://melpon.org/wandbox/permlink/76ugV7cPaxxqjIMl

Source ():

int x;

Compiler invocation:

clang -c -o a.o -x c -fno-common -fno-zero-initialized-in-bss -

Additional commands:

objdump -wt a.o | grep -P '\b''x\b'

Expected output:

0000000000000000 g O .bss 0000000000000004 x

Actual output:

0000000000000000 g O .data 0000000000000004 x

clang -v:

clang version 4.0.0 (trunk 290110)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/llvm-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions