llvm-project/lld/lib/ReaderWriter
Matt Davis 4d17cdc704 [lld][mach-o] Avoid segfaulting when handling an empty section list.
Summary:
The following patch avoids segfaulting if the section list is empty when writing a mach-o MH_OBJECT.  I ran into this case from a more complicated example trying to dead_strip while using '-r' in lld.

I'm not sure if having empty sections is a legal mach-o, but it does seem that other llvm-binutils tools can ingest such a boring object with out issue.  Would it be better to emit an error, emit a warning, or do nothing?  It seems that adding a warning diagnostic might be helpful to users, as I did not expect to have a section-less object when the linker was done.

Reviewers: kledzik, ruiu

Subscribers: llvm-commits, jrm

Tags: #lld, #llvm

Differential Revision: https://reviews.llvm.org/D67735

llvm-svn: 372995
2019-09-26 17:03:20 +00:00
..
MachO [lld][mach-o] Avoid segfaulting when handling an empty section list. 2019-09-26 17:03:20 +00:00
YAML Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
CMakeLists.txt lld: Prune unused libdeps. 2017-10-12 00:04:24 +00:00
FileArchive.cpp [LLD] Migrate llvm::make_unique to std::make_unique 2019-08-14 22:28:17 +00:00