Compiling embedded assembly code (was: Cross compiling).

Brendan Simon
Mon Aug 2 17:28:00 GMT 1999

Franklin Wingate wrote:

> When I try to compile with gcc -b i386 filename, I get the error
> installation problem, cannot exec cc1: No such file or directory. Am i
> using the correct compiler options?

Hi Franklin,

The gcc manual (info gcc) says :

   The `-b' and `-V' options actually work by controlling part of the
file name used for the executable files and libraries used for
compilation.  A given version of GNU CC, for a given target machine, is
normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.

   Thus, sites can customize the effect of `-b' or `-V' either by
changing the names of these directories or adding alternate names (or
symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
`80386' is a link to the file `i386v', then `-b 80386' becomes an alias
for `-b i386v'.

Therefore using the -b i386 would require a /usr/local/gcc-lib/i386
directory.  You need to substitute the cygwin install directory for
/usr/local.  I am assuming that you are using cygwin (since this is the cygwin
mailing list).  If you are using cygwin then you shouldn't need the -b i386 as
the cygwin compiler understands 386 assembly code.

I've had a look at the demo code you attached and the assembler coder does not
appear to be adhere to the GCC syntax for assembler code.  It looks like a
BorlandC or MicrosoftC extension for embedded assembly.  You will have to
convert it to GCC syntax if you want it to work.  Have a look at the
GCC manuals (there are some at ).

For example

/* sets the graphic mode to mode mode !? */
void setmode(int mode)
asm     mov     ax,mode
asm     int     10h

converts to :

/* sets the graphic mode to mode mode !? */
void setmode(int mode)
    asm(" mov   ax,%0" : /* no outputs */ : "r" (mode) );
    asm(" int     10h");

I think this is correct but I am not an i386 assembly expert, nor a GCC
embedded assembler expert.  I would read the assembler code syntax in the GCC
manual, have an attempt at rewriting your code and compile it.  If you can't
get it to work then cut the C routines with the assebler from the code and
paste (not attach) them in an email asking for help.  Include your attempts so
people can see what you have tried.  Hopefully someone can correct your

Brendan Simon.

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list