← Back to team overview

touch-packages team mailing list archive

[Bug 82020] Re: binutils don't correctly compile assembly code with calls to an absolute address

 

** Changed in: binutils (Debian)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to binutils in Ubuntu.
https://bugs.launchpad.net/bugs/82020

Title:
  binutils don't correctly compile assembly code with calls to an
  absolute address

Status in binutils:
  Invalid
Status in binutils package in Ubuntu:
  Invalid
Status in binutils package in Debian:
  Fix Released

Bug description:
  Binary package hint: binutils

  The following assembly code should produce a program that simply exits with status 0 (success).
  -----------------------------------
  .text
  .globl _start
  _start:
  movl $1, %eax
  movl $0, %ebx
  call 0xffffe400
  -----------------------------------

  Calling absolute address 0xffffe400 should use the linux-gate
  mechanism to issue the _exit(2) system call.

  However, after assembling with as (as -o exit.o exit.S, assuming the
  source file is named "exit.S") and linking with ld (ld -o exit
  exit.o), the resulting binary produces a segmentation fault instead of
  the desired behaviour.

  Disassembling the object file "exit.o" with objdump -d -r yields:
  -----------------------------------
  00000000 <_start>:
     0:   b8 01 00 00 00          mov    $0x1,%eax
     5:   bb 02 00 00 00          mov    $0x2,%ebx
     a:   e8 fc e3 ff ff          call   ffffe40b <_start+0xffffe40b>
                          b: R_386_PC32   *ABS*
  -----------------------------------

  Thus, the call to absolute address 0xffffe400 somehow gets mangled to
  a call to 0xffffe40b.

  Disassembling the executable "exit" with objdump -d -r yields:
  -----------------------------------
  08048074 <_start>:
   8048074:       b8 01 00 00 00          mov    $0x1,%eax
   8048079:       bb 02 00 00 00          mov    $0x2,%ebx
   804807e:       e8 fc e3 ff ff          call   804647f <_start-0x1bf5>
  -----------------------------------

  In other words, the call got mangled even worse.

  I am using dapper with binutils version 2.16.1cvs20060117-1ubuntu2.1.

  This may be the same bug as debian #322478 [http://bugs.debian.org
  /cgi-bin/bugreport.cgi?bug=322478]

To manage notifications about this bug go to:
https://bugs.launchpad.net/binutils/+bug/82020/+subscriptions