bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

assembler 'movl ss, (ebp)' produce an error for target i686


From: Henry Nestler
Subject: assembler 'movl ss, (ebp)' produce an error for target i686
Date: Sun, 04 Sep 2005 23:52:44 +0200
User-agent: Mozilla Thunderbird 0.6 (Windows/20040502)

* Bug: 'movl %ss, (%ebp)' produce an error for target i686 (32 bit):
  " Error: suffix or operands invalid for `mov' "

* Version of `as'.
>>> as --version >>>
GNU assembler 2.16.91 20050827
This assembler was configured for a target of `i686-pc-linux-gnu'.
<<< end <<<

* Source from mingw (no additional patches)
  http://heanet.dl.sourceforge.net/sourceforge/mingw/
  binutils-2.16.91-20050827-1-src.tar.gz

* Type of machine: i686

* Operating system: SuSE Linux 9.0

* 'as' compiled with: gcc (GCC) 3.3.1 (SuSE Linux)
  Configured with prefix only,
  target was auto detect as 'i686-pc-linux-gnu'.

* The inputfile was a C file with inline assembler.
  A "gcc movl_ss_bp.c" stop with an error, if using AS version 2.16.91.
>>> inputfile: movl_ss_bp.c >>>
int main (void)
{
    __asm__("    movl %ss, 0x40(%ebp)");
    __asm__("    movl %ss, (%ebp)");
    __asm__("    movl %ss, -16(%ebp)");

    return (0);
}
<<< end inputfile <<<

* For error tracking build assembler output with 'gcc -S movl_ss_bp.c'
>>> cat movl_ss_bp.s >>>
        .file   "movl_ss_bp.c"
        .text
.globl main
        .type   main, @function
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
#APP
            movl %ss, 0x40(%ebp)
            movl %ss, (%ebp)
            movl %ss, -16(%ebp)
#NO_APP
        movl    $0, %eax
        leave
        ret
        .size   main, .-main
        .ident  "GCC: (GNU) 3.3.1 (SuSE Linux)"
<<< end <<<

* Using this file as input for assembler produce the bug.
>>> output from 'as movl_ss_bp.s' >>>
movl_ss_bp.s: Assembler messages:
movl_ss_bp.s:13: Error: suffix or operands invalid for `mov'
movl_ss_bp.s:14: Error: suffix or operands invalid for `mov'
movl_ss_bp.s:15: Error: suffix or operands invalid for `mov'
<<< end error output <<<

* Other assembler versions tested with same source 'movl_ss_bp.s':
2.14.90.0.5 20030722 (SuSE Linux), target i586-suse-linux: OK
2.15.91 20040904 (Mingw source), target i686-pc-mingw32: OK
2.15.94 20050118 (Mingw source), target i686-pc-linux-gnu: OK
2.16.91 20050827 (Mingw source), target i686-pc-linux-gnu: fail
2.16.91 20050827 (Mingw source), target i686-pc-mingw32: fail

* Other sample for this find in building of Linux kernel 2.6.11 for i386. Assembler stopps with same error message for all inline assembler lines in the file arch/i386/kernel/process.c with register usage FS or GS. Listed some of them:

        movl %fs,488(%eax)
        movl %gs,492(%eax)

        movl %fs,40(%esi)
        movl %gs,44(%esi)

        movl 40(%ebx),%fs

        movl 44(%ebx),%gs

>>> grep linux-2.6.11/arch/i386/kernel/process.c >>>
int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
        unsigned long unused,
        struct task_struct * p, struct pt_regs * regs)
{
...
        savesegment(fs,p->thread.fs);
        savesegment(gs,p->thread.gs);
<<< end <<<

>>> grep preprocessor output >>>
 asm volatile("movl %%" "fs" ",%0":"=m" (*(int *)&(p->thread.fs)));
 asm volatile("movl %%" "gs" ",%0":"=m" (*(int *)&(p->thread.gs)));
<<< end <<<

>>> grep assembler inputfile >>>
        movl %fs,488(%eax)
        movl %gs,492(%eax)
<<< end <<<


* If I use "mov %ss,(%ebp)", than the assembler build the right code.
  But 'objdump -d' from same binutils version shows the "movl" again:
  13:   8c 55 00                movl   %ss,0x0(%ebp)

--
Henry Nestler





reply via email to

[Prev in Thread] Current Thread [Next in Thread]