On Mon, Feb 18, 2013 at 3:05 PM, Anuz Pratap Singh Tomar < [email protected]> wrote:
> > > On Mon, Feb 18, 2013 at 5:07 AM, horseriver <[email protected]> wrote: > >> hi:) >> >> I have compiled a .S file ,using command gcc -c x.S -o x. >> Then I use objdump to look up its asm code, even find that some code is >> not the >> same as that .S file , more important is , some code in origin .S file >> has disappear . >> >> what is about the reason ? If it is due to version , why some code >> chould get lost after compile? >> >> Couple of things > 1. Please don't piggy back questions over the unrelated topic, that is > totally misdirecting the discussion. > 2. You ask a lot of question related to compilation and stuff, which are > off-topic here, why not READ a little bit more or consult relevant > documentation? > 3. You seem to do no homework before asking viz googling or reading basic > books on relevant topic for example in this case reading a book on assembly > language programming. > > When you write any assembly code(or for that matter any code) your code is > written to be read by HUMANS and not machines. For machines a lot of that > code is redundant and has no use so machine code will be generated in such > a form that it is most optimized for the execution. For example take any > *.c code and do > > #gcc -S *.c > you will see an equivalent assembly code. It may not exactly be similar to > the code which you will write in assembly for same logic. There are some > rules according to which compilers generate code, please read some book on > compilers and lex and yacc. > > > Some more info about objdump and assembly code and why they are different. http://stackoverflow.com/questions/4309771/disassembling-modifying-and-then-reassembling-a-linux-executable And bit of correction: s/it is most optimized for the execution/it is optimized for compilation if there are no optimization flags used/ > >> thanks! >> > > > > -- > Thank you > Warm Regards > Anuz > -- Thank you Warm Regards Anuz
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
