In the executable is not normally the place to look for a function definition. You can do the compiling of all source files and run nm(1)
on them to see if any of them has a definition of main
. The executable is not the proper place as it will have no reference to the module it came from. The source files will be hard to follow (as some can have compilation directives with optionally compiled code /with a main
definition in case you don't provide one/ that will make uncertaing the place where you find it) but the compiled module will have a reference to main
to indicate the linker it can get it and solve all the main
references from this file. The linker divides a compiled input into a set of segments and piles them up to the appropiate places in the processor memory map, and so, you get a messed final executable with pieces of each module mixed up, making it more difficult to check if a main
definition is there (it applies to main
or to any other function)
Output should be something like:
0000000000000c10 T main
in the file that conttains it. In the opposite, all files that require main and need it provided by the linker appear as:
U memset
instead.