Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:41:39+00:00 2026-06-07T10:41:39+00:00

I am just trying to compile some simple example code I typed in from

  • 0

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:

$ cat -n test.cpp

 1  #define READ_COMMAND    3
 2  
 3  #define MSG_LENGTH  128
 4  
 5  #include <stdlib.h>
 6  #include <stdio.h>
 7  
 8  int main(int argc, char *arg[])
 9  {
10      int syslog_command = READ_COMMAND;
11      int bytes_to_read = MSG_LENGTH;
12      int retval;
13      char buffer[MSG_LENGTH];
14  
15      asm volatile(
16          "movl %1, %%ebx\n\t"
17          "movl %2, %%ecx\n\t"
18          "movl %3, %%edx\n\t"
19          "movl $103, %%eax\n\t"
20          "int $128\n\t"
21          "movl %%eax, %0"
22          :"=r" (retval)
23          :"m"(syslog_command),"r"(buffer),"m"(bytes_to_read)
24          :"%eax","%ebx","%ecx","%edx");
25      if (retval > 0) printf("%s\n", buffer);
26  
27  }
28  
29  

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:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu

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

Thread model: posix

gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

Heres the full error:

$ gcc test.cpp

test.cpp: Assembler messages:

test.cpp:25: Error: unsupported for `mov'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:41:40+00:00Added an answer on June 7, 2026 at 10:41 am

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

    movl -24(%rbp), %ebx
    movl %rsi, %ecx       <--- error here
    movl -28(%rbp), %edx
    movl $103, %eax
    int $128
    movl %eax, %r12d
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to canvas some opinions here. I was wondering how people go about
I'm just learning Haskell and I am trying to write some code that simply
Finding dead code in Delphi is usually real simple: just compile and then scan
I'm trying to write some code that will render a texture onto a simple
I'm a very new to java, just trying to run some simple programs. I
I'm trying to use G++ to compile some C++ code. It seems to work
I am just trying to compile a bit bigger project using the Visual Studio
just trying to test for equality in this piece of code, but getting a
Recently, I was trying to prototype some jQuery-based menu into ASP.NET MVC. Just to
I'm trying to unmarshal a simple xml document from a public api from Convio.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.