This is the mail archive of the gcc@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]

How can I get rid of __main ?


Hi All,

When I compile the following code (using the -S switch) under windows,
GCC outputs an assembly file containing the symbol "__main" (two
underscores) Code:

int main()
{
return 0;
}

The reason I know that on some systems, gcc inserts a call to __main()
at the start of the code that it generates for main().  __main() is
called to 
Execute initialization code, in particular constructors for C++ objects
with global or namespace scope.

Problem:

When I generate relocatable file (*.o) of (*.s) file then the
disassembly of 'jal __main" does not display properly in GDB
disassmebler. It displays as "jal  0x0<main>" because __main linked only
during linking process.

Can I get rid of __main in relocatable file or assembly file? 

Thanks in advance
Regards,
Monika Chaddha



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