bug-binutils
[Top][All Lists]
Advanced

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

[Bug gas/3041] New: Bogus jump to weak symbol on m68k-unknown-netbsd


From: vincent dot riviere at freesbee dot fr
Subject: [Bug gas/3041] New: Bogus jump to weak symbol on m68k-unknown-netbsd
Date: 14 Aug 2006 12:57:03 -0000

When assembled, a jump to weak symbol produces a jump to an invalid address. I 
found that problem on m68k-unknown-netbsd, but it may affect all m68k-*-aout 
targets.

$ cat bug.s
        jmp     mylabel
        nop
        .weak mylabel
mylabel:
        nop

$ as bug.s -o bug.o
$ objdump -d bug.o

bug.o:     file format a.out-m68k-netbsd

Disassembly of section .text:

00000000 <mylabel-0x6>:
   0:   4efa 000a       jmp %pc@(c <mylabel+0x6>)
   4:   4e71            nop

00000006 <mylabel>:
   6:   4e71            nop

The value of the jmp instruction is wrong : it should be %pc@(6 <mylabel>)
It might not be a problem, because there is a relocation.

$ objdump -r bug.o

bug.o:     file format a.out-m68k-netbsd

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE              VALUE
00000002 DISP16            .text

Here, it is clearly wrong. The relocation offset is good, but the value should 
be "mylabel" instead of ".text"
After linking, there is no more relocation, but the value of the jump is still 
bad.

The same problem was present in gas 2.14 for m68k-unknown-netbsd (already using 
BFD).
The problem was not present in gas 2.14 for m68k-linux-aout (not using BFD) :

$ objdump -d bug.o # binutils 2.14 m68k-linux-aout

bug.o:     file format a.out-zero-big

Disassembly of section .text:

00000000 <mylabel-0x6>:
   0:   4efa 0004       jmp %pc@(6 <mylabel>)
   4:   4e71            nop

00000006 <mylabel>:
   6:   4e71            nop

I think the above result is correct and the current version of gas for m68k-
unknown-netbsd should behave like that.

-- 
           Summary: Bogus jump to weak symbol on m68k-unknown-netbsd
           Product: binutils
           Version: 2.18 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: vincent dot riviere at freesbee dot fr
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: m68k-unknown-netbsd


http://sourceware.org/bugzilla/show_bug.cgi?id=3041

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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