[PATCH] D138179: MIPS: fix build from IR files, nan2008 and FpAbi

YunQiang Su via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 18:07:55 PST 2022


wzssyqa added a comment.

In D138179#3934543 <https://reviews.llvm.org/D138179#3934543>, @MaskRay wrote:

> Rubber stamp. I try to find some mips folks who can verify, so maybe wait a day or so.
>
>> When we use llc or lld to compiler IR files, the features +nan2008 and +fpxx/+fp64 are not used. Thus wrong format files are produced.
>
> Not sure lld is related. It just consumes the bitcode input when using LTO. Did you mean Clang?

Any program call libllvm to convert IR to asm file or object is effected.
the example is like this:

example 1:

  clang -flto -mnan=2008 -O3 -target mipsel-linux-gnu -c test.c   # the nan2008 attribute does set
  llc test.o  # the nan2008 is not set in the output test.o.s

example 2

  clang -flto -mnan=2008 -O3 -target mipsel-linux-gnu -o a.out test.c
  # the output is not nan2008 object
  #due to clang doesn't pass -mllvm=-mattr=+nan2008 to lld.

For example2:
We can:

1. pass -mllvm=-mattr=+nan2008 to lld, while ld.bfd doesn't support it.
2. make lld/llvm can recognize the `attributes #0 = ` in IR files.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138179/new/

https://reviews.llvm.org/D138179



More information about the cfe-commits mailing list