I believe you use the -nostdlib option to leave out all of the standard library stuff, including _start which kicks off all the things Ali mentioned and more and then finally calls main(). In your program you'll then need to define _start yourself. If you're writing your program in assembly, then all you need to do is include a label called _start and put everything you want to run after it. If your program uses any system calls you'll have to implement stubs for those since those are part of the standard library too.
Gabe Ali Saidi wrote: > No it's probably from all the libc _start code that is executed. Even > if main() is a single line there is much more code that is included in > the binary to setup the environment properly, get the arguments in > order, see if the terminal is character or line buffered, etc. You > should be able to convince the linker to not include all of this -fno- > builtin, but you'll need to define a _start symbol. > > Ali > > On Nov 10, 2008, at 11:21 PM, Shoaib Akram wrote: > > >> I wrote a simple program with 3 branches and ran it on m5. The >> statstics show much more branches and the number of instructions >> executed are also more than the assembly generated. Is it because of >> noise from emulated system calls? >> _______________________________________________ >> m5-users mailing list >> [email protected] >> http://m5sim.org/cgi-bin/mailman/listinfo/m5-users >> >> > > _______________________________________________ > m5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/m5-users > _______________________________________________ m5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/m5-users
