llvm-project/lld/lib
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
..
Core Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Driver [LLD] Migrate llvm::make_unique to std::make_unique 2019-08-14 22:28:17 +00:00
ReaderWriter [lld][mach-o] Avoid segfaulting when handling an empty section list. 2019-09-26 17:03:20 +00:00
CMakeLists.txt Move new lld's code to Common subdirectory. 2017-10-02 21:00:41 +00:00