This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: assembly listings


Hi Ali,

I have created an assembly file by gcc named prog1.s. Then:
as -ah ./prog1.s
Why high level listing can not be seen?

Because you compiled prog1.s without debugging enabled, and you are creating a listing without including any assembler output For example:


  % gcc -S hello.c
  % as -ahl=hello.list hello.s -o hello.o
  % grep printf hello.list

14 0010 E8FCFFFF call printf

  % gcc -S -g hello.c
  % as -ahl=hello.list hello.s -o hello.o
  % grep printf hello.list

1:hello.c **** extern int printf (const char *, ...);
2:hello.c **** int main (void) { return printf ("hello world\n"); }
31 0010 E8FCFFFF call printf


You need to pass -g to gcc in order to include debugging info in the assembler outout file. The assembler needs this in order to be able to locate the high level source file(s) associated with the input assembly source file.

You need to include the 'l' option in the -a assembler option in order to generate a listing output. (The 'h' option is a qualifier that is applied to the 'l' option. If 'h' is present but 'l' is not then you do not get any output).

Cheers
  Nick



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