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

James Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 21 10:01:51 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG189b7393d545: [lld][RISCV] Use an e_flags of 0 if there are only binary input files. (authored by bsdjhb, committed by jrtc27).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71101

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


Index: lld/test/ELF/riscv-elf-flags.s
===================================================================
--- /dev/null
+++ lld/test/ELF/riscv-elf-flags.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
@@ -108,7 +108,10 @@
 }
 
 uint32_t RISCV::calcEFlags() const {
-  assert(!objectFiles.empty());
+  // If there are only binary input files (from -b binary), use a
+  // value of 0 for the ELF header flags.
+  if (objectFiles.empty())
+    return 0;
 
   uint32_t target = getEFlags(objectFiles.front());
 


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


More information about the llvm-commits mailing list