Skip to content

What does -fno-common actually do? #324

Description

@nivedita76

The GCC doc says:

some targets may carry a speed or code size penalty on variable references.

But is x86 actually one of them?

On x86_64 I see zero difference in the code generated. On 32-bit, there is a difference in the code generated by the compiler, but after linking, the two look identical.

On 32-bit the compiler generates
movl x@GOT(%eax), %eax
without -fno-common, vs
leal x@GOTOFF(%eax), %eax
but the linker seems to convert the mov into lea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions