Re: Which x86 assembler for Windows/Linux/Solaris?
- From: chapman Billy <spamtrap@xxxxxxxxxx>
- Date: Sun, 13 Nov 2005 19:43:22 -0000
In article <dl5jo702cu1@xxxxxxxxxxxxxxxxxx>, spamtrap@xxxxxxxxxx says...
> MASM was clearly the standard under DOS and Windows.
> We use MASM to support a quite sizable hand-tuned algorithm running SMP
> under Windows.
>
> I am faced with the problem of moving to Linux, but would
> like to continue supporting our Windows program.
One thought is to follow the slightly dated recommendation of Agner Fog.
His optimisation manual can be downloaded from
http://www.agner.org/assem/#optimize
Section 4.11 of the version I downloaded a few months ago reads:
"4.11 Using MASM under Linux
"The Gnu assembler that comes with Linux, BSD and similar operating
systems uses the terrible AT&T syntax. As I am in favor of standardizing
assembly syntax, I will recommend using the MASM assembler under Linux.
"Available tools for converting assembly files in MASM syntax to AT&T
syntax are not reliable, but tools for converting object files seem to
work well. You may assemble your code with MASM under Windows or under
Linux using Wine, the Windows emulator. Let MASM generate object files
in MS-COFF format and convert them to ELF format using the objcopy
utility from MingW32 mentioned above. The object files in ELF format can
then be linked into a C++ project using g++ or ld. Under Linux, the
process goes like this:
"wine -- ml.exe /c /Cx /coff myfile.asm
"wine -- objcopy.exe -Oelf32-i386 myfile.obj myfile.o
"g++ somefile.cpp myfile.o
"You may include this sequence in a make script or shell script. It may
seem awkward to use the MING version of objcopy which needs Wine to run
under Linux. It is probably possible to rebuild the native objcopy
utility to add support for the MS-COFF format (called pe-i386 in this
context), but I haven't figured out how.
"If you have leading underscores on your function names then add the
option --removeleading- char to the objcopy command line.
"If you want to build a function library that can be used under several
different operating systems, then make a .lib file under Windows using
the lib.exe utility that comes with Microsoft compilers and convert the
..lib file to ELF format with the command
"objcopy -Oelf32-i386 --remove-leading-char myfile.lib myfile.a
"The library myfile.a can then be used under Linux, BSD, UNIX, etc. Make
sure your library doesn't call any system functions."
I should stress I have not done this myself. I am merely pointing out
the existence of this possibility without holding any view on it at all.
It may be easier to rewrite the appropriate file rather than having the
additional debugging headache of wondering whether the ELF file is a
true representation of what was originally written. Maybe someone has
some practical experience of this.
Regards,
Simon.
.
- References:
- Which x86 assembler for Windows/Linux/Solaris?
- From: Ira Baxter
- Which x86 assembler for Windows/Linux/Solaris?
- Prev by Date: Re: Compiler inserts redundant comparison against zero
- Next by Date: Re: Compiler inserts redundant comparison against zero
- Previous by thread: Re: Which x86 assembler for Windows/Linux/Solaris?
- Next by thread: Re: Which x86 assembler for Windows/Linux/Solaris?
- Index(es):
Relevant Pages
|