Hi Yixun,

On 2021/8/12 17:55, Yixun Lan wrote:
> HI Xuerui:
>
> This must be a *HUGE* project and gonna put lots of effort in to it!
> So, first, good luck to you with all my best wishes!~
Thanks for your kindness!
>
> On 00:39 Thu 12 Aug     , WANG Xuerui wrote:
>> Hi everyone,
>>
>> I'm your average Gentoo user who obviously thought his sleeping time is more
>> than enough, and just decided to start porting Gentoo to LoongArch. As this
>> is such a niche architecture with no upstreamed support so far, I'm posting
>> this to announce my intent and gather advice on how to best push this.
>>
>> I'll first give some background material to help people gain context, then
>> describe my porting plan. This is going to be a bit long; apologizes for 
>> that.
>>
>>
>> Note: I'm not affiliated with Loongson in any way; I'm just doing this in my
>> spare time (once meant for some quality sleep).
>>
>>
>> ## A bit of introduction on the LoongArch
>>
>> LoongArch, as its name implies, is the brand-new ISA developed by the
>> Loongson Corporation, incompatible with MIPS which was implemented by
>> all previous Loongson processors. Currently only the base ISA specification
>> is publicly available; it has fixed-length 32-bit instructions, vastly more
>> instruction formats (39 distinct formats in the base ISA alone!), and its
>> instruction semantics mostly resemble RISC-V, with a bit of MIPS R6 here and
>> there. It is capable of 64-bit operations, obviously.
>>
>> ISA documentation: https://github.com/loongson/LoongArch-Documentation
>> ELF psABI draft: https://github.com/loongson/LoongArch-Documentation/pull/3
>>
>> The draft ABI is undergoing fierce review, and is subject to change,
>> especially the relocation types. Other parts like the register 
>> convention and
>> data layout is unlikely to change much, though.
>>
>> There is little code upstreamed for basic software (GNU toolchain, QEMU,
>> Linux and the like), but many are open-sourced already. Nevertheless, the
>> code quality is still very much inferior, and much of it is obviously based
>> on respective MIPS support. There is continuous debate inside and outside
>> Loongson on this matter, too.
>>
> Didn't do any investigation, but if I read correctly, also see here [1]
>
> The fundamental pieces of softwares are open-sourced but *NOT* yet upstreamed
> So, I'd say, let's wait till it's actually accepted by upstream,
> before pushing to downsteam (Gentoo here). Sure, you're free to send
> a pull-request for review/comment, but collect peices under your own overlay
> would be a good idea ( in my humble opition ).

Sure; that's basic etiquette. However there are some parts that
definitely need upstreaming, otherwise complexity could explode; for
example, the multilib_env function and tc-ninja_magic_to_arch function.
Without fixing multilib_env we could only use the "default" ABI, and
without adapting tc-ninja_magic_to_arch even linux-headers is unable to
build. If we don't touch the upstream repo, a full fork is needed, and
that's going to be painful.

Additionally, I've already seen adaptations for experimental arches in
repo; so I thought upstreaming these minimal bits would be acceptable.
If that's deemed too early (and I totally understand the reasoning
behind that), doing work in forks is okay from my side.


Reply via email to