svn commit: r356333 - head/contrib/llvm-project/lld/ELF/Arch
Dimitry Andric
dim at FreeBSD.org
Fri Jan 3 20:29:55 UTC 2020
Author: dim
Date: Fri Jan 3 20:29:54 2020
New Revision: 356333
URL: https://svnweb.freebsd.org/changeset/base/356333
Log:
Merge commit 189b7393d from llvm git (by John Baldwin):
[lld][RISCV] Use an e_flags of 0 if there are only binary input files.
Summary:
If none of the input files are ELF object files (for example, when
generating an object file from a single binary input file via "-b
binary"), use a fallback value for the ELF header flags instead of
crashing with an assertion failure.
Reviewers: MaskRay, ruiu, espindola
Reviewed By: MaskRay, ruiu
Subscribers: kevans, grimar, emaste, arichardson, asb, rbar,
johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217,
zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o,
rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton,
pzheng, sameer.abuasal, apazos, luismarques, llvm-commits, jrtc27
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71101
This is a prerequisite for building and linking hard- and soft-float
riscv worlds with clang and lld.
Requested by: jhb
MFC after: 1 week
X-MFC-With: r353358
Modified:
head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp
Modified: head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp
==============================================================================
--- head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp Fri Jan 3 20:28:06 2020 (r356332)
+++ head/contrib/llvm-project/lld/ELF/Arch/RISCV.cpp Fri Jan 3 20:29:54 2020 (r356333)
@@ -105,7 +105,10 @@ static uint32_t getEFlags(InputFile *f) {
}
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());
More information about the svn-src-all
mailing list