[cfe-dev] PE/COFF for MIPS
David Chisnall via cfe-dev
cfe-dev at lists.llvm.org
Mon Feb 24 02:57:49 PST 2020
I think there's also a broader question of 'which COFF'. A lot of the
LLVM code assumes that COFF approximates to Windows. If the goal is to
target NT 4 or WinCE, which both had MIPS ports, then it's some work but
it's largely a matter of adapting the code in the x86 and ARM back ends.
There are (were?) also a number of *NIX MIPS systems that used COFF as
their binary format and these have very little in common with the
Windows format (other than the container structure). Relocation types
are different, the C++ ABI is different and there are probably some
other differences. If this is for a hobby OS, what are the requirements?
As I recall, Sony has some changes to clang/llvm/FreeBSD-rtld to support
dllimport / dllexport in ELF binaries. If this is the requirement, then
perhaps asking them to upstream them would be a simpler solution? As I
recall, they were private because they didn't think anyone else wanted
them, rather than because they involved any competitive advantage.
David
On 24/02/2020 09:50, Simon Atanasyan via cfe-dev wrote:
> Hi,
>
> I think it's a rather difficult task. We need to create COFF object
> file writer for MIPS backend and support linking of COFF files in LLD
> linker. Now MIPS backend expects ELF output format only. For COFF we
> also have to change a code generator because some features cannot be
> implemented in COFF.
>
> On Mon, Feb 24, 2020 at 5:41 AM valerij zaporogeci via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>>
>> Hi. Is it possible to have a clang/llvm build that both would support
>> MIPS architecture and PE/COFF format for object files and executables?
>> without the need to change the code base, of course. just with proper
>> configuration. So that one can use PE DLL import/export for modules
>> instead of ELF shared objects. Initially I have been thinking on
>> creating an ELF->PE translator, but it quickly became obvious, that
>> it's not practical - because it's the compiler, that needs to
>> understand declspec(dllimport/dllexport).
>> I am not a compiler guy, so making changes in such huge projects as
>> gcc or clang are out of my scope. I am working on firmware/osdev hobby
>> projects for a mips32r2 board (among ARM ones) and would be very happy
>> to use such a familiar, useful and handy PE/COFF format for
>> executables.
>
More information about the cfe-dev
mailing list