[PATCH] D74023: [RISCV] ELF attribute section for RISC-V

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 22:43:48 PST 2020


HsiangKai added a comment.

In D74023#1888630 <https://reviews.llvm.org/D74023#1888630>, @kito-cheng wrote:

> Could you add following kind of test:
>
> Negative test:
>
> - Feed integer value to string type attribute
> - Feed string value to integer type attribute
>
>   Architecture attribute testing:
> - Different/conflict arch between option and attribute, e.g. `llvm-mc -mattr=+e` but `.attribute arch, "rv32i2p0"`
>   - Expectation is attribute get higher propriety.
> - Arch string without version, e.g. `.attribute arch, "rv32imafdc"`
>   - Expectation is assembler will append it into `.attribute arch, "rv32i2p0_m2p0_a2p0_f2p0_d2p0_c2p0"`
> - Major number is given but minor version ignored, e.g. `.attribute arch, "rv32i2"`
> - Invalid arch string.
>   - Random arch string: `.attribute arch, "foo"`
>   - Arch string not in canonical order `.attribute arch, "rv32i2p0_a2p0_m2p0_"`


I do not restrict input in canonical order. Output arch string will follow canonical order.

> - Default arch attribute, `.attribute arch` not given, imply by `-mattr` option, e.g  `llvm-mc -triple=riscv32 -mattr=+f` result `.attribute arch, "rv32i2p0_f2p0"`
>   - Maybe we should add a option to control this behavior? gas/binutils provide `-m[no-]arch-attr` to control this.

`llvm-mc` has no such hook to emit directives according to options. I think it is not a must-have feature. I will not support it in this patch.
If you use `llc`, you will get correct attribute section according to options. As following code gen test.

> Code gen test:
> 
> - Test attribute can emitted by compiler, like `llvm/test/CodeGen/ARM/build-attributes.ll`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74023





More information about the llvm-commits mailing list