[LLVMbugs] [Bug 14456] New: MIPS backend generates wrong reloc info for static data

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 29 04:08:15 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14456

             Bug #: 14456
           Summary: MIPS backend generates wrong reloc info for static
                    data
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: llvmc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: frederic.heitzmann at cea.fr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9607
  --> http://llvm.org/bugs/attachment.cgi?id=9607
test case in C file

I use llvm-clang with a MIPS target, and it seems that the backend generates
wrong reloc info.

Test scenario :
$ clang -integrated-as -g -Wall -Wextra -c test.c -o test.o
$ mips-elf-objdump -S rtos.o > test.s
$ mips-elf-readelf -a test.o > test.readelf

test.s shows some unresolved reference, which seems normal, e.g.
int testvar2(){
  24:   27bdfff8        addiu   sp,sp,-8
  28:   24010000        li      at,0
  return (var2)?1:0;
  2c:   8f820000        lw      v0,0(gp)    << relocation needed for var2
  30:   00401026        xor     v0,v0,zero
  34:   0002102b        sltu    v0,zero,v0
  38:   afa10004        sw      at,4(sp)
  3c:   27bd0008        addiu   sp,sp,8
  40:   03e00008        jr      ra
  44:   00000000        nop
...

var2 is well defined in .symtab
Symbol table '.symtab' contains 31 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
...
    13: 00000000     4 OBJECT  LOCAL  DEFAULT    4 var1
    14: 00000004     4 OBJECT  LOCAL  DEFAULT    4 var2
...

However, section .rel.text in test.readelf looks bad :
Relocation section '.rel.text' at offset 0x9dc contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
00000008  00001107 R_MIPS_GPREL16    00000000   .bss
0000002c  00001107 R_MIPS_GPREL16    00000000   .bss  << expect address of var2
00000058  00001107 R_MIPS_GPREL16    00000000   .bss
00000060  00001107 R_MIPS_GPREL16    00000000   .bss

In general, all relocations for static data are 0000 ?!

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list