[PATCH] D16667: ELF: Do not use fatal in LinkerScript.cpp.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 11:22:12 PST 2016

This parser is mostly an independent component of the linker, and you can
swap it entirely later or update incrementally without affecting other
parts. That being said, as you might have implied, implementing error
recovery is not a priority because writing a linker script is much rarer
than writing C or C++. That would be useful though. I originally suggested
implementing this parser using yacc/bison (with some error recovery in
mind), but eventually I was convinced that we just wanted to have something
that is small (so we can write it up quickly), that does not introduce
external dependencies or a discussion whether it should be hand-written or
generated by a parser generator, and that good enough to parse libc.so
(which is a linker script despite its name!), so that we can go on to work
on more important features.

On Thu, Jan 28, 2016 at 10:52 AM, David Blaikie <dblaikie at gmail.com> wrote:

> Totally a casual comment & I could be totally off: Parser error recovery
> can be really helpful to users (eg: Clang's error recovery), though (much
> like using TLS for the general error handling improvements, and my comments
> there) I expect this is a good first step and better error recovery can be
> added over time to improve the user experience here.
> As you've said, it's certainly not a terribly easy thing to do great error
> recovery, and I wouldn't suggest trying to solve everything up-front, for
> sure.
> On Wed, Jan 27, 2016 at 6:44 PM, Rui Ueyama via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>> ruiu created this revision.
>> ruiu added a reviewer: rafael.
>> ruiu added a subscriber: llvm-commits.
>> Propagating errors back to callers is annoying in recursive descendent
>> parser because they are naturally constructed as mutually recursive
>> functions. In this patch, I took a simple approach. The accessors of
>> the token stream behaves as if they are at EOF once we saw any errors.
>> It naturally makes all functions to return.
>> This is the final change to not use fatal in the linker.
>> http://reviews.llvm.org/D16667
>> Files:
>>   ELF/LinkerScript.cpp
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160128/2118590c/attachment.html>

More information about the llvm-commits mailing list