This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
request for assistance in understanding undocumented gas directives
- From: Daniel Wilkerson <daniel dot wilkerson at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 29 Jun 2014 03:58:13 -0700
- Subject: request for assistance in understanding undocumented gas directives
- Authentication-results: sourceware.org; auth=none
I want to write a assembly language simulator for purposes of dynamic
semantic analysis (rather than for performance). Note that I need the
debugging annotations so I can map things back to the higher-level
constructs they came from; think of the needs of gdb.
I thought I would try MIPS64, but I might also try other 64-bit
architectures (MIPS seems to be cleanly designed and "See MIPS Run" is
very well written). I would simulate ELF/DWARF files directly but
they are harder to generate (LLVM will gen assembly, but won't
assemble it for you) and I don't know a library to read them that
isn't GPL3 (I don't want to be required to GPL my code.)
As Clang/LLVM is designed to cross-compile out of the box (unlike
gcc), the straightforward way to generate test input seems to be
"clang -target mips64 -S -O0 -g". The output seems to be MIPS64
assembly in the GNU as format. Further, if I omit the "-target
mips64" argument, then clang -S does generate x86 assembly that my
native gcc install will assemble and the result does run. Examining
the output, it contains many of the directives that I see in online
copies of the GNU assembler manual, so, as far as I can tell, it seems
to be GNU as code.
Unfortunately, it also contains uses of odd assembler directives that
I can't find explained in the online GNU documentation: .abicalls,
.fmask, a use of .previous in what seems to be the first section,
which doesn't make sense as far as I understand. Also, much of the
debugging information is encoded in blocks of binary. This
documentation: https://sourceware.org/binutils/docs-2.22/as/Loc.html#Loc
speaks of DWARF2, when I think DWARF4 is current. I don't know if I
should as you guys or the LLVM guys, but if I want to make sense of
this, where do I find up to date documentation?
Daniel