<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [MIPS][FreeBSD] n32: error: la used to load 64-bit address"
   href="https://bugs.llvm.org/show_bug.cgi?id=43351">43351</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[MIPS][FreeBSD] n32: error: la used to load 64-bit address
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kevans@FreeBSD.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When compiling FreeBSD mipns32 libc:

error: la used to load 64-bit address

This is our usage that's failing:

root@viper:/usr/src/lib/libc/mips/gen# grep -in 'ptr_la' _ctx_start.S
51:     PTR_LA  t9, _ctx_done

So loading the address of _ctx_done into t9. We compile this something along
the lines of:

$ cc -target mips64-unknown-freebsd13.0 -EB -mabi=n32 -msoft-float

The above error comes from the MipsAsmParser, gated by a conditional:
Is32BitAddress && ABI.ArePtrs64bit()

Further diagnosis reveals that cc is accepting -mabi=n32 and usually doing the
right thing, but when _ctx_start.S is compiled -mabi=n32 is seemingly lost and
the above thinks we're compiling for n64, as the target triple would otherwise
indicate. std::cout in MipsABIInfo::computeTargetABI and in the clang mips
driver's mips::getMipsCPUAndABI confirms that in the former,
Options.getABIName() is an empty string and in the latter, ABIName=n32 by the
time the function returns.</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>