PING^2 [PATCH] gold: Call gold_fatal on bad ELF inputs

Cary Coutant ccoutant@gmail.com
Sat Dec 19 21:12:59 GMT 2020


> > > Abort on bad ELF inputs instead of SEGV later.
> > >
> > > elfcpp/
> > >
> > >         PR gold/26747
> > >         PR gold/26748
> > >         * elfcpp_file.h (Elf_file<size, big_endian, File>::construct):
> > >         Call file->fatal instead of file->error.
> > >
> > > gold/
> > >
> > >         PR gold/26747
> > >         PR gold/26748
> > >         * incremental.cc (Incremental_binary::fatal): New.
> > >         * incremental.h (Incremental_binary::fatal): Likewise.
> > >         * nacl.cc (Sniff_file::fatal): Likewise.
> > >         * nacl.h (Sniff_file::fatal): Likewise.
> > >         * object.cc (Object::fatal): Likewise.
> > >         * object.h (Object::fatal): Likewise.

I'd prefer to be more robust in the face of bad input than just
terminating with a fatal error (which admittedly is more robust than
segfaulting). Ideally, we can abandon the file if we have to but
continue with the link. I'll work on a proper fix. I did start down
this path a bit over a year ago when Nick proposed a patch for PR
23765 [1], but I had to deal with other priorities for a while. Sorry.

-cary

[1] https://sourceware.org/pipermail/binutils/2019-September/107966.html


More information about the Binutils mailing list