<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 --- - [Mips] -mabi=n32 option creates 64bit ELF file" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23651&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=S4k79t73FgGsmcFDQaiQzz0YJSoiwbSyswYWdQNrJ0s&s=RXTqZb96zRedhb7VjyQRo2aIf595CXHJZluuDJY9Igo&e=">23651</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Mips] -mabi=n32 option creates 64bit ELF file
          </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>Linux
          </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>kai@redstar.de
          </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=14382" name="attach_14382" title="Demo file for compilation">attachment 14382</a> <a href="attachment.cgi?id=14382&action=edit" title="Demo file for compilation">[details]</a></span>
Demo file for compilation

Using the attached hello.ll on a mips64-unknown-linux-gnu machine:

localhost ldc # /build/work/llvm/bin/llc -filetype=obj -target-abi=n32 hello.ll
localhost ldc # file hello.o
hello.o: ELF 64-bit MSB relocatable, MIPS, MIPS64 version 1 (GNU/Linux), not
stripped
localhost ldc # /build/work/llvm/bin/llc -filetype=asm -target-abi=n32 hello.ll
localhost ldc # gcc -mabi=n32 -c hello.s
localhost ldc # file hello.o
hello.o: ELF 32-bit MSB relocatable, MIPS, N32 MIPS-III version 1 (SYSV), not
stripped
localhost ldc #

If I add -mattr=mips64 or -mattr=mips64r2 then I get the expected result:

localhost ldc # /build/work/llvm/bin/llc -filetype=asm -target-abi=n32
-mattr=mips64r2 hello.ll
localhost ldc # file hello.o
hello.o: ELF 32-bit MSB relocatable, MIPS, N32 MIPS64 rel2 version 1 (SYSV),
not stripped
localhost ldc # /build/work/llvm/bin/llc -filetype=asm -target-abi=n32
-mattr=mips64 hello.ll
localhost ldc # file hello.o
hello.o: ELF 32-bit MSB relocatable, MIPS, N32 MIPS64 rel2 version 1 (SYSV),
not stripped

(Note that in the last line the MIPS version is wrong: it should be MIPS64
version 1 (SYSV))</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>