From 0f57cc9750282ce0284fe69b06f161dea2bfc8cb Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 17 Jul 2016 16:03:47 +0200 Subject: parser/lexer: o Support special '/DISCARD/' as NAME. o Add 'SORT' as a token. It is equivalent with SORT_BY_NAME. The new rule sort_by_name coverts both. Ld: o Don't die on unknown sections, they can be referenced before declared. Doesn't matter for this app anyway. --- elfinfo.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'elfinfo.cpp') diff --git a/elfinfo.cpp b/elfinfo.cpp index 6ddbceb..985a2de 100644 --- a/elfinfo.cpp +++ b/elfinfo.cpp @@ -192,10 +192,17 @@ int main(int argc, char **argv) { LdScript file = loader.load(ld_filename); memoryAreas.insert(memoryAreas.end(), file.memoryAreas.begin(), file.memoryAreas.end()); + } catch (LdParseException &e) { + for (auto &m: e.messages) { + fprintf(stderr, m.c_str()); + } + errx(EX_DATAERR, "Could not parse ld script"); } catch (std::exception &e) { - errx(EX_DATAERR, "Unhandled exception when parsing LD script. The parser is new and fragile, so please file a bug and send me your LD script: %s", e.what()); + errx(EX_DATAERR, "Unhandled exception when parsing LD script. " + "The parser is new and fragile, so please file a bug and send me your LD script: %s", e.what()); } catch (...) { - errx(EX_DATAERR, "Unhandled exception when parsing LD script. The parser is new and fragile, so please file a bug and send me your LD script."); + errx(EX_DATAERR, "Unhandled exception when parsing LD script. " + "The parser is new and fragile, so please file a bug and send me your LD script."); } } -- cgit v1.2.3