https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78077
--- Comment #6 from Jack Howarth <howarth.at.gcc at gmail dot com> ---
(In reply to Iain Sandoe from comment #5)
> (In reply to Jack Howarth from comment #4)
> > The Apple developers think this is gcc bug producing malformatted input to
> > the linker. From macho_relocatable_file.cpp, we are triggering the linker
> > check...
> >
> > #ifndef NDEBUG
> > // scan for FDEs claming the same function
> > for(uint32_t i=1; i < cfiStartsArrayCount; ++i) {
> > assert( cfiStartsArray[i] != cfiStartsArray[i-1] );
> > }
> > #endif
>
> If it's a 0-length FDE caused by a 0-length function, then this is a repeat
> of 57438. If so please mark it accordingly (I expect to post a fix for
> 57438 soon, and I can send you a preview if that helps).
>
> If this is something different, then please can we have a reduced test-case.
> Thanks
A reduced test case is unlikely but I can confirm that this appears to be due
to PR57438 since passing -D__builtin_unreachable=__builtin_trap by using...
../configure --enable-link-time-optimization --without-ns CC=/sw/bin/gcc-fsf-6
CXX=/sw/bin/g++-fsf-6 CPPFLAGS="-D__builtin_unreachable=__builtin_trap
-I/sw/include" LDFLAGS="-L/sw/lib"
produces a successful build at -O2 with LTO under stock gcc 6.2.0 and Xcode 8.1
GM's linker.