[PATCH] D71101: [lld][RISCV] Use an e_flags of 0 if there are only binary input files.

John Baldwin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 17:01:41 PST 2019


bsdjhb created this revision.
bsdjhb added reviewers: MaskRay, ruiu.
Herald added subscribers: llvm-commits, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71101

Files:
  lld/ELF/Arch/RISCV.cpp
  lld/test/ELF/riscv-binary.s


Index: lld/test/ELF/riscv-binary.s
===================================================================
--- /dev/null
+++ lld/test/ELF/riscv-binary.s
@@ -0,0 +1,8 @@
+# REQUIRES: riscv
+
+# RUN: echo -n "BLOB" > %t.binary
+# RUN: ld.lld -m elf64lriscv -b binary %t.binary -o %t.out
+# RUN: llvm-readobj -h %t.out | FileCheck %s
+
+# CHECK:      Flags [
+# CHECK-NEXT: ]
Index: lld/ELF/Arch/RISCV.cpp
===================================================================
--- lld/ELF/Arch/RISCV.cpp
+++ lld/ELF/Arch/RISCV.cpp
@@ -106,7 +106,8 @@
 }
 
 uint32_t RISCV::calcEFlags() const {
-  assert(!objectFiles.empty());
+  if (objectFiles.empty())
+    return 0;
 
   uint32_t target = getEFlags(objectFiles.front());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71101.232476.patch
Type: text/x-patch
Size: 717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191206/c16df59b/attachment-0001.bin>


More information about the llvm-commits mailing list