<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 - Missing support for MIPS --binary-architecture and --output-target values"
href="https://bugs.llvm.org/show_bug.cgi?id=41462">41462</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missing support for MIPS --binary-architecture and --output-target values
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llvm-objcopy/strip
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arichardson.kde@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>alexander.v.shaposhnikov@gmail.com, jake.h.ehrlich@gmail.com, jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org, rupprecht@google.com
</td>
</tr></table>
<p>
<div>
<pre>I am trying to switch CheriBSD (fork of FreeBSD with support for the MIPS-based
CHERI CPU) to use llvm binutils instead of elftoolchain.
The build currently fails while embedding a rootfs in the kernel with the
following command:
/Users/alex/cheri/output/sdk/bin/objcopy --input-target binary --output-target
elf64-tradbigmips --binary-architecture mips
/Users/alex/cheri/output/minimal-cheri128-disk.img
embedfs_minimal-cheri128-disk.o
I guess objcopy should support the same flags for --output-target as lld. There
is a list in lld/ELF/ScriptParser.cpp in parseBfdName(StringRef S).
The second flag: --binary-architecture is currently ignored by elftoolchain
objcopy.
I'm not sure what we should do here, to me "mips" would indicate 32-bit big
endian MIPS. If I parse binutils/bfd/archures.c correctly there also doesn't
seem to be a 64-bit version of mips for --binary-architecture.
I guess we can just remove the binary-architecture from the build system but it
would be nice to be GNU and elftoolchain compatible.
llvm-objcopy seems to override --output-target if --binary-architecture is
specified which is not what we want. However, if I run this command line with
GNU objcopy 2.32 I get the following file headers which seems to me like it is
using the --output-target flag instead of --binary-architecture:
File: embedfs_minimal-cheri128-disk.o
Format: ELF64-mips
Arch: mips64
AddressSize: 64bit
LoadName:
ElfHeader {
Ident {
Magic: (7F 45 4C 46)
Class: 64-bit (0x2)
DataEncoding: BigEndian (0x2)
FileVersion: 1
OS/ABI: SystemV (0x0)
ABIVersion: 0
Unused: (00 00 00 00 00 00 00)
}
Type: Relocatable (0x1)
Machine: EM_MIPS (0x8)
Version: 1
Entry: 0x0
ProgramHeaderOffset: 0x0
SectionHeaderOffset: 0x38001A0
Flags [ (0x0)
]
HeaderSize: 64
ProgramHeaderEntrySize: 0
ProgramHeaderCount: 0
SectionHeaderEntrySize: 64
SectionHeaderCount: 5
StringTableSectionIndex: 4
}</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>