This is an archive of the discontinued LLVM Phabricator instance.

[mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.
ClosedPublic

Authored by brad on Mar 31 2017, 4:37 PM.

Details

Reviewers
sdardis
atanasyan
Summary

Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.

We're both in the same boat with binutils 2.17(.50) for the external assembler.
Both projects have been using IAS as its the only option and the only way forward. I'd like to push this combined diff forward.

Diff Detail

Event Timeline

brad created this revision.Mar 31 2017, 4:37 PM
sdardis edited edge metadata.Apr 3 2017, 8:39 AM

A quick question: do either FreeBSD / OpenBSD for mips64 require n32 support? I'm asking this as the integrated assembler currently only supports n64. It will silently produce broken n32 objects (ELF64 instead of ELF32).

emaste added a comment.Apr 3 2017, 9:09 AM

FreeBSD ostensibly supports o32, n32, and n64, so n32 is indeed relevant for us. That said the in-tree toolchain still uses GCC 4.2.1 for MIPS, and the LLVM work is still somewhat forward-looking for us.

brad added a comment.Apr 9 2017, 9:08 AM

We only require N32 for older SGI systems bootblock from the looks of it. Currently we call the external assembler to build this code and it's best to leave that as is for now. All the other code for the OS kernel/userland/programs are all N64 only. At the moment the most important thing is building anything out of the box with Clang/LLVM which is practically zero at the moment without the integrated assembler.

I have added a similar patch to our CHERI clang fork and we have been using IAS to compile FreeBSD&CheriBSD for n64 for a while now.
I believe we have a branch where n32 almost works but for now we could just add -no-integrated-as in that case.

bsdjhb added a subscriber: bsdjhb.Dec 13 2017, 9:37 AM

Simon, FreeBSD does support n32 as others have noted. Do you have any thoughts on what is needed to allow N32 to work with IAS? It seems like there is some support in MipsAsmParser for N32 IIRC, though it seems like the integrated assembler thinks it is compiling as N64 when -mabi=n32 is passed to clang (my attempt to compile FreeBSD N32 with clang currently dies due to encountering 'la' and erroring since it thinks it is using N64 where 'dla' should be used instead.

Simon, FreeBSD does support n32 as others have noted. Do you have any thoughts on what is needed to allow N32 to work with IAS?
It seems like there is some support in MipsAsmParser for N32 IIRC, though it seems like the integrated assembler thinks it is compiling
as N64 when -mabi=n32 is passed to clang (my attempt to compile FreeBSD N32 with clang currently dies due to encountering 'la'
and erroring since it thinks it is using N64 where 'dla' should be used instead.

I'm another Simon, but try to answer :) One of the problems with enabling N32 IAS is that we need to pass information about selected ABI to various places in the backend. There are two patches (D38799, D38800) sent on review and more patches in my working copy. As well as the previous attempts (D20916, D21467) to solve this problem, the patches are pending. I'm going to reactivate the process though.

To be clear, even though FreeBSD does support n32, I think we want this patch for FreeBSD certainly as the forward path for N32 on FreeBSD is to get IAS N32 working rather than other solutions. Also, N64 on FreeBSD needs IAS today, so I'd rather this go in sooner rather than waiting for the N32 IAS issues to be fully resolved.

atanasyan accepted this revision.Jun 21 2018, 8:25 AM

LGTM

By the way, what is a typical EnvironmentType on BSD systems?

This revision is now accepted and ready to land.Jun 21 2018, 8:25 AM
brad updated this revision to Diff 152575.Jun 22 2018, 7:25 PM

Rebased against the trunk.

brad requested review of this revision.Jun 23 2018, 12:40 PM
brad set the repository for this revision to rL LLVM.Jun 23 2018, 1:49 PM
This revision is now accepted and ready to land.Jun 24 2018, 5:18 AM
atanasyan closed this revision.Jun 29 2018, 12:39 AM

Closed by commit rL335434.