[PATCH] D41658: [RISCV] Encode RISCV specific ELF e_flags to RISCV Binary by RISCVTargetStreamer

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 00:45:42 PST 2018


asb added a comment.

Hi Shiva. I was just looking at applying this and the STI field is triggering a compiler warning as it's not used: it's initialised in the RISCVTargetELFStreamer constructor, but isn't actually read from anywhere.

The test could be modified slightly - given that we know all defined ELF flags for RISC-V are shared between RV32 and RV64 we can share check line, and we could also check that the RVC flag isn't improperly being when not targeting RVC. How about writing it like this:

  # RUN: llvm-mc -triple=riscv32 -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck -check-prefixes=CHECK-RVI %s
  # RUN: llvm-mc -triple=riscv64 -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck -check-prefixes=CHECK-RVI %s
  # RUN: llvm-mc -triple=riscv32 -mattr=+c -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck -check-prefixes=CHECK-RVIC %s
  # RUN: llvm-mc -triple=riscv64 -mattr=+c -filetype=obj < %s | llvm-readobj -file-headers - | FileCheck -check-prefixes=CHECK-RVIC %s
  
  # CHECK-RVI:       Flags [ (0x0)
  # CHECK-RVI-NEXT:  ]
  
  # CHECK-RVIC:       Flags [ (0x1)
  # CHECK-RVIC-NEXT:    EF_RISCV_RVC (0x1)
  # CHECK-RVIC-NEXT:  ]
  
  nop


Repository:
  rL LLVM

https://reviews.llvm.org/D41658





More information about the llvm-commits mailing list