[PATCH] D109587: [RISCV][WIP] Generate target attribute in attribute section of object file when assemble .s file

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 13 21:08:55 PDT 2021


kito-cheng added a comment.

GNU toolchain is always emit arch attribute even user didn't write it in assembly file, and it will implied the info from the `-march` option or default arch setting, it's what you want to do in LLVM part IIUC.

But this implementation has some issue:

- Inline asm will emit `.attribute 5,` (`.attribute Tag_RISCV_arch`) again, that result the output will reject by the GNU assembler since `.attribute Tag_RISCV_arch` required to be appear before any instruction.
- NO new testcase added to demonstrate what you want to do, I would suggest you should add one, assemble a .s file to .o and then dump the attribute to make sure `.attribute Tag_RISCV_arch` has emitted properly.

So I think the goal of this patch is right way, but the implementation need some tweaks, especially the code gen change for inline asm.


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

https://reviews.llvm.org/D109587



More information about the llvm-commits mailing list