Hi,
On Thu, 30 Apr 2015, Raluca Vartic wrote:
> 2. Are we missing some tools that could be used to convert gcc assembler to
> ARM Assembler (translation of pseudo instructions)?
Yes - have a look at gas-preprocessor:
git://
git.libav.org/gas-preprocessor.git
https://git.libav.org/?p=gas-preprocessor.git;a=summary
This started out as tool to expand gas macros for use with apple's
assembler, but can nowadays do a full translation from gas style to
armasm. It is done on the fly while compiling, so instead of "arm-foo-gcc
-c asm.s -o asm.o" you do "
gas-preprocessor.pl -as-type armasm
-force-thumb -- armasm -nologo -c asm.s -o asm.o". This invokes the cpp
preprocessor to expand all C preprocessor directives, translates the
output into armasm format, and feeds it to the assembler. One example of
using it is within OpenH264:
https://github.com/cisco/openh264/blob/master/build/msvc-common.mk#L12
While gas-preprocessor handles everything in the libav and OpenH264
projects, it isn't necessarily intended to handle every possible gas
syntax, but at least the subset of the syntax used by these projects.
Adapting other projects to use this tool shouldn't hopefully be too hard.
One slightly tricky detail is that you need to run it at build time, so
you need to build in an environment that has got access to a cpp
preprocessor and perl (so on windows, you need to have mingw/msys tools in
the path).
If you really need to do the conversion "offline", not as part of the
actual build, you can probably do something like this:
GASPP_DEBUG=1
gas-preprocessor.pl -as-type armasm -- armasm -c file.s -o foo.o > file.asm
Then you can assemble this file separately later with "armasm file.asm".
(The GASPP_DEBUG macro disables writing something to the file denoted by
-o and instead dumps the converted asm source to stdout.)
// Martin