This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using C on x86-64, why emit .text for global data?


On Fri, Sep 27, 2019 at 10:44 AM Bob Plantz <rgplantz@outlook.com> wrote:
> Why does gcc emit an extra .text before the global data?
>
> .file "globalData.c"
> .text
> .globl x
> .data

Compile an empty file, and you will see that it starts with the same
two lines.  This probably just simplifies logic somewhere else in the
compiler to force the assembler into a known state at the beginning,
regardless of what is actually in the C file.  There is no harm in
emitting an extra unnecessary .text directive to the assembler.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]