Skip to content
Advertisement

What does the GCC error message, “Error: unsupported for `mov'”, mean?

I am just trying to compile some simple example code I typed in from a book, and GCC gives me the above error. Here’s my code:

JavaScript

The code is supposed to invoke the syslog() system call to read the last 128 bytes from the kernel printk() ring buffer. Here is some information about my OS and system configuration:

uname -a:

Linux 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

gcc -v:

JavaScript

Configured with: ../src/configure -v –with-pkgversion=’Ubuntu/Linaro 4.6.3-1ubuntu5′ –with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs –enable-languages=c,c++,fortran,objc,obj-c++ –prefix=/usr –program-suffix=-4.6 –enable-shared –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.6 –libdir=/usr/lib –enable-nls –with-sysroot=/ –enable-clocale=gnu –enable-libstdcxx-debug –enable-libstdcxx-time=yes –enable-gnu-unique-object –enable-plugin –enable-objc-gc –disable-werror –with-arch-32=i686 –with-tune=generic –enable-checking=release –build=x86_64-linux-gnu –host=x86_64-linux-gnu –target=x86_64-linux-gnu

JavaScript

Heres the full error:

JavaScript

Advertisement

Answer

You are attempting to compile 32-bit assembly code on a 64-bit machine. The inline assembly you list compiles to:

JavaScript

As you can see, you’re attempting to store a 64-bit register in a 32-bit register, which is illegal. More importantly, this isn’t the 64-bit ABI system call protocol either.

Try compiling with -m32 to force 32-bit ABI.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement