Skip to content

Support compiling on MIPS #4037

Closed
Closed
@rata

Description

@rata

Description

When re-working the cloned binary trick (#3987), we ended up doing this:

runc/cc_platform.mk

Lines 51 to 53 in 96a61d3

else
$(error Unsupported GOARCH $(GOARCH))
endif

This will make the compilation fail on architectures others than the listed there, like MIPS. Distros like debian are shipping the runc binary for those architectures already.

Steps to reproduce the issue

No response

Describe the results you received and expected

I'd expect runc compiles in the same architectures as before or a clear reasoning explaining to users why we dropped some is provided

I think adding support for other architectures is simple, so it is worth it. I think we need to change this:

runc/cc_platform.mk

Lines 51 to 53 in 96a61d3

else
$(error Unsupported GOARCH $(GOARCH))
endif

to just define the CFLAGS like "-DRUNC_USE_STDLIB" instead of error out.

and then in the file libct/dmz/Makefile provide a target for the arches that support nolibc, identical to the one we have today, and then another that doesn't add the flags to compile with nolibc (ie not add -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib -lgcc).

Then, the _dmz.c file can have something like:

#ifdef RUNC_USE_STDLIB
#include  <unistd.h>
#else 
#include "nolibc/nolibc.h"
#endif

And this should do the trick.

I'm going afk for a few weeks tomorrow, so I'm not opening a PR I won't be able to be active. But it would be great if someone does so :)

cc @AkihiroSuda @cyphar

What version of runc are you using?

runc main

Host OS information

No response

Host kernel information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions