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: 28 Apr 2007 20:38:21 -0000

------- Additional Comments From vincent dot riviere at freesbee dot fr  
2007-04-28 21:38 -------
Created an attachment (id=1739)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=1739&action=view)
Write correct values and relocs into a.out object files

After spending *weeks* in the debugger, I finally managed to get it work.
My patch is attached to this message. It is is composed of 4 parts :

1) The patch provided by Nick in Comment #5. It is necessary to generate a
reloc with the correct symbol name.

2) Never relax references to weak symbols, as they must be full absolute
pointers in order to be relocated.

3) In md_apply_fix(): Always put zero values into frags referencing a weak
symbol.

4) In tc_gen_reloc(): Adjust addend in order to force bfd_install_relocation()
to put a zero value into the frags referencing a weak symbol.

This patch affects only a.out and m68k, and only when weak symbols are used.
It may not affect anything else.
I think it works as expected.

Could someone verify it is OK and check this in, please ?

Vincent


Here are the detailed results :

$ 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-0x8>:
   0:   4ef9 0000 0000  jmp 0 <mylabel-0x8>
   6:   4e71            nop

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

$ objdump -r bug.o

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

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

$ nm bug.o
00000008 W mylabel

$ ld bug.o -o bug
$ objdump -d bug

bug:     file format a.out-m68k-netbsd

Disassembly of section .text:

00002020 <bug.o>:
    2020:       4ef9 0000 2028  jmp 2028 <mylabel>
    2026:       4e71            nop

00002028 <mylabel>:
    2028:       4e71            nop
        ...

0000202c <__etext>:
        ...


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #1292 is|0                           |1
           obsolete|                            |


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]