<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - relocation R_MIPS_26 against `a local symbol' can not be used when making a shared object; recompile with -fPIC" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24286&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=xLkfl9-cVRejcfvZnk0W3948nXXJdfUqkqkQRDi4Of0&s=YstyORxIxdXMM0qGWdg4BTlY8ViJbUVMyfIACQGB96k&e=">24286</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>relocation R_MIPS_26 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: MIPS
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brooks@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14655" name="attach_14655" title="crtbeginS.c processed by clang">attachment 14655</a> <a href="attachment.cgi?id=14655&action=edit" title="crtbeginS.c processed by clang">[details]</a></span>
crtbeginS.c processed by clang

When trying to link FreeBSD's libc compiled for mips64-unknown-freebsd I get
this linker error with ld from binutils 2.25:

/usr/local/mips64-freebsd/bin/ld:
/home/bed22/obj/mips.mips64/home/bed22/git/cheribsd/tmp/usr/lib/crtbeginS.o:
relocation R_MIPS_26 against `a local symbol' can not be used when making a
shared object; recompile with -fPIC
/home/bed22/obj/mips.mips64/home/bed22/git/cheribsd/tmp/usr/lib/crtbeginS.o:
error adding symbols: Bad value

Compiler invocation to build crtbegin.o:

/home/bed22/git/llvm-cheri/Build/bin/clang -target mips64-unknown-freebsd
-integrated-as -msoft-float -target mips64-unknown-freebsd11.0
--sysroot=/home/bed22/obj/mips.mips64/home/bed22/git/cheribsd/tmp
-B/usr/local/mips64-freebsd/bin/ -O -pipe -G0   -DIN_GCC -DHAVE_LD_EH_FRAME_HDR
-DDT_CONFIG -D__GLIBC__=3 -fno-inline-functions -fno-exceptions 
-fno-zero-initialized-in-bss -fno-asynchronous-unwind-tables 
-fno-omit-frame-pointer
-I/home/bed22/git/cheribsd/gnu/lib/csu/../../../contrib/gcclibs/include
-I/home/bed22/git/cheribsd/gnu/lib/csu/../../../contrib/gcc/config
-I/home/bed22/git/cheribsd/gnu/lib/csu/../../../contrib/gcc -I. 
-I/home/bed22/git/cheribsd/gnu/lib/csu/../../usr.bin/cc/cc_tools -std=gnu89  
-Qunused-arguments -g0 -DCRT_BEGIN -DCRTSTUFFS_O -DSHARED -fpic  -c -o
crtbeginS.o
/home/bed22/git/cheribsd/gnu/lib/csu/../../../contrib/gcc/crtstuff.c

This actual compiler is fairly heavily modified, but merged with trunk as of a
few weeks ago.  I've found the same problems with trunk, but trunk suffers from
all the issues referenced in 23370 which prevent me from getting far enough to
get this error.

objdump -r output from crtbeginS.o:
--<cut>--

/home/bed22/obj/mips.mips64/home/bed22/git/cheribsd/tmp/usr/lib/crtbeginS.o:   
 file 
format elf64-tradbigmips-freebsd

RELOCATION RECORDS FOR [.text]:                                             
[51/1943]
OFFSET           TYPE              VALUE 
000000000000001c R_MIPS_GPREL16    __do_global_dtors_aux
000000000000001c R_MIPS_SUB        *ABS*
000000000000001c R_MIPS_HI16       *ABS*
0000000000000024 R_MIPS_GPREL16    __do_global_dtors_aux
0000000000000024 R_MIPS_SUB        *ABS*
0000000000000024 R_MIPS_LO16       *ABS*
0000000000000028 R_MIPS_GOT_PAGE   __do_global_dtors_aux.completed
0000000000000028 R_MIPS_NONE       *ABS*
0000000000000028 R_MIPS_NONE       *ABS*
000000000000002c R_MIPS_GOT_OFST   __do_global_dtors_aux.completed
000000000000002c R_MIPS_NONE       *ABS*
000000000000002c R_MIPS_NONE       *ABS*
0000000000000038 R_MIPS_GOT_DISP   __cxa_finalize
0000000000000038 R_MIPS_NONE       *ABS*
0000000000000038 R_MIPS_NONE       *ABS*
0000000000000044 R_MIPS_GOT_DISP   __dso_handle
0000000000000044 R_MIPS_NONE       *ABS*
0000000000000044 R_MIPS_NONE       *ABS*
0000000000000048 R_MIPS_CALL16     __cxa_finalize
0000000000000048 R_MIPS_NONE       *ABS*
0000000000000048 R_MIPS_NONE       *ABS*
0000000000000054 R_MIPS_GOT_PAGE   __do_global_dtors_aux.p
0000000000000054 R_MIPS_NONE       *ABS*
0000000000000054 R_MIPS_NONE       *ABS*
0000000000000058 R_MIPS_GOT_OFST   __do_global_dtors_aux.p
0000000000000058 R_MIPS_NONE       *ABS*
0000000000000058 R_MIPS_NONE       *ABS*
0000000000000070 R_MIPS_GOT_OFST   __do_global_dtors_aux.p
0000000000000070 R_MIPS_NONE       *ABS*
0000000000000070 R_MIPS_NONE       *ABS*
0000000000000074 R_MIPS_GOT_OFST   __do_global_dtors_aux.p
0000000000000074 R_MIPS_NONE       *ABS*
0000000000000074 R_MIPS_NONE       *ABS*
0000000000000088 R_MIPS_GOT_OFST   __do_global_dtors_aux.completed
0000000000000088 R_MIPS_NONE       *ABS*
0000000000000088 R_MIPS_NONE       *ABS*
00000000000000c0 R_MIPS_GPREL16    frame_dummy
00000000000000c0 R_MIPS_SUB        *ABS*
00000000000000c0 R_MIPS_HI16       *ABS*
00000000000000c8 R_MIPS_GPREL16    frame_dummy
00000000000000c8 R_MIPS_SUB        *ABS*
00000000000000c8 R_MIPS_LO16       *ABS*
00000000000000cc R_MIPS_GOT_PAGE   __JCR_LIST__
00000000000000cc R_MIPS_NONE       *ABS*
00000000000000cc R_MIPS_NONE       *ABS*
00000000000000d0 R_MIPS_GOT_OFST   __JCR_LIST__
00000000000000d0 R_MIPS_NONE       *ABS*
00000000000000d0 R_MIPS_NONE       *ABS*
00000000000000dc R_MIPS_GOT_DISP   _Jv_RegisterClasses
00000000000000dc R_MIPS_NONE       *ABS*
00000000000000dc R_MIPS_NONE       *ABS*
00000000000000ec R_MIPS_GOT_OFST   __JCR_LIST__
00000000000000ec R_MIPS_NONE       *ABS*
00000000000000ec R_MIPS_NONE       *ABS*


RELOCATION RECORDS FOR [.fini]:
OFFSET           TYPE              VALUE 
0000000000000008 R_MIPS_26         .text
0000000000000008 R_MIPS_NONE       *ABS*
0000000000000008 R_MIPS_NONE       *ABS*


RELOCATION RECORDS FOR [.init]:
OFFSET           TYPE              VALUE 
0000000000000008 R_MIPS_26         .text+0x00000000000000b0
0000000000000008 R_MIPS_NONE       *ABS*+0x00000000000000b0
0000000000000008 R_MIPS_NONE       *ABS*+0x00000000000000b0


RELOCATION RECORDS FOR [.pdr]:
OFFSET           TYPE              VALUE 
0000000000000000 R_MIPS_32         .text
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000020 R_MIPS_32         .text+0x00000000000000b0
0000000000000020 R_MIPS_NONE       *ABS*+0x00000000000000b0
0000000000000020 R_MIPS_NONE       *ABS*+0x00000000000000b0


RELOCATION RECORDS FOR [.sdata]:
OFFSET           TYPE              VALUE 
0000000000000000 R_MIPS_64         __dso_handle
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000000 R_MIPS_NONE       *ABS*


RELOCATION RECORDS FOR [.data.rel.local]:
OFFSET           TYPE              VALUE 
0000000000000000 R_MIPS_64         .dtors+0x0000000000000008
0000000000000000 R_MIPS_NONE       *ABS*+0x0000000000000008
0000000000000000 R_MIPS_NONE       *ABS*+0x0000000000000008


--<cut>--</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>