bug-binutils
[Top][All Lists]
Advanced

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

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


From: vincent dot riviere at freesbee dot fr
Subject: [Bug gas/3041] Bogus jump to weak symbol on m68k-unknown-netbsd
Date: 8 May 2007 13:35:55 -0000

------- Additional Comments From vincent dot riviere at freesbee dot fr  
2007-05-08 14:35 -------
Created an attachment (id=1778)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1778&action=view)
Write correct offsets into a.out object files

There is still a bug when the reference to the weak symbol contains an offset.
With my previous patch, the offset is unconditionnaly set to 0.

Here is the updated testcase :

$ cat bug.s
        jmp     mylabel+2
        nop
        .weak   mylabel
mylabel:
        nop
        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-0x8>:
   0:   4ef9 0000 0000  jmp 0 <mylabel-0x8>
   6:   4e71            nop

00000008 <mylabel>:
   8:   4e71            nop
   a:   4e71            nop

We can see that the "+2" has disappeared.

The attached patch fixes this problem.
Here is the result after applying it :

$ objdump -d bug.o

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

Disassembly of section .text:

00000000 <mylabel-0x8>:
   0:   4ef9 0000 0002  jmp 2 <mylabel-0x6>
   6:   4e71            nop

00000008 <mylabel>:
   8:   4e71            nop
   a:   4e71            nop

Now, the right offset is written into the code segment.
The reloc and linker output are good, too.

I think this time it should be correct.

When searching for md_apply_fix() in BFD sources, I found various workarounds
against bfd_install_relocation(). ELF targets seems to be OK, but every other
target uses its own workaround... I'm sure that there are still hidden bugs
with weak symbols.

Could someone check this patch, please ?

Vincent


-- 


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]