[Bug gas/10558] New: gas emits invalid reloc which causes ld to abort

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug gas/10558] New: gas emits invalid reloc which causes ld to abort

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The follow mips asm fragment when assembled and link -shared the following error messages from ld:

mips64el--netbsd-as -KPIC -mabi=new -o devname.so devname.o
mips64el--netbsd-ld: error: /tmp/devname.so contains a reloc (0x0000000000000914) for section
.text that references a non-existent global symbol
mips64el--netbsd-ld: final link failed: Bad value

        .file   1 "devname.c"
        .section .mdebug.abiN32
        .previous
        .abicalls
       
        addiu   $sp,$sp,-16
        move    $12,$28
        lui     $28,%hi(%neg(%gp_rel(_devname)))
        addu    $28,$28,$25
        addiu   $28,$28,%lo(%neg(%gp_rel(_devname)))
        lw      $2,%got_page($LC4+5)($28)
        addiu   $2,$2,%got_ofst($LC4+5)
        move    $28,$12
        j       $31
        addiu   $sp,$sp,16

        .set    macro
        .set    reorder
        .end    _devname
        .size   _devname, .-_devname

However, if the follow diff is applied then the error goes away.

@@ -25,8 +25,9 @@
        lui     $28,%hi(%neg(%gp_rel(_devname)))
        addu    $28,$28,$25
        addiu   $28,$28,%lo(%neg(%gp_rel(_devname)))
-       lw      $2,%got_page($LC4+5)($28)
-       addiu   $2,$2,%got_ofst($LC4+5)
+$LC5=$LC4+5
+       lw      $2,%got_page($LC5)($28)
+       addiu   $2,$2,%got_ofst($LC5)
        move    $28,$12
        j       $31
        addiu   $sp,$sp,16

Obviously that change should not caused anything to change but it did.  It seems that when the reloc is
emitted, the $LC4 + 5 should have been changed to .rodata.str1.8 + offset($LC4) + 5.  This bug exists
in 2.16 and in 2.19 and on HEAD.

--
           Summary: gas emits invalid reloc which causes ld to abort
           Product: binutils
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: matt at NetBSD dot org
                CC: bug-binutils at gnu dot org
 GCC build triplet: x86_64--netbsd
  GCC host triplet: x86_64--netbsd
GCC target triplet: mips64el--netbsd


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug gas/10558] gas emits invalid reloc which causes ld to abort

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From matt at NetBSD dot org  2009-08-25 20:28 -------
This is actually a bug in objcopy:

gas/as-new -KPIC -mabi=n32 -o /tmp/devname.so /tmp/devname.s      
ld/ld-new -shared -o /tmp/devname.so.1 /tmp/devname.so            
binutils/objcopy -x /tmp/devname.so                                
ld/ld-new -shared -o /tmp/devname.so.1 /tmp/devname.so
ld/ld-new: error: /tmp/devname.so contains a reloc (0x0000000000000914) for section .text that
references a non-existent global symbol
ld/ld-new: final link failed: Bad value


--


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug gas/10558] gas emits invalid reloc which causes ld to abort

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From matt at NetBSD dot org  2009-08-25 20:37 -------
However I'd like re-iterate that gas should have emitted the reloc with the local symbol in the first place.

--


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

[Bug gas/10558] gas emits invalid reloc which causes ld to abort

by Bugzilla from sourceware-bugzilla@sourceware.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


------- Additional Comments From amodra at bigpond dot net dot au  2009-10-29 05:41 -------
Your asm snippet doesn't assemble.  I added a .ent directive, and definitions
for _devname and $LC4, and current mainline then assembles and links OK.  Please
correct your testcase.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


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

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


_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils