[llvm-bugs] [Bug 41462] New: Missing support for MIPS --binary-architecture and --output-target values

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 11 02:53:21 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41462

            Bug ID: 41462
           Summary: Missing support for MIPS --binary-architecture and
                    --output-target values
           Product: tools
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: llvm-objcopy/strip
          Assignee: unassignedbugs at nondot.org
          Reporter: arichardson.kde at gmail.com
                CC: alexander.v.shaposhnikov at gmail.com,
                    jake.h.ehrlich at gmail.com,
                    jh7370.2008 at my.bristol.ac.uk,
                    llvm-bugs at lists.llvm.org, rupprecht at google.com

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
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190411/3ce74b54/attachment.html>


More information about the llvm-bugs mailing list