From f52348211e4c6e998bcb9ae18234ceb9cf161a49 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Mon, 2 Jan 2017 21:32:04 -0500 Subject: [PATCH] print public/extern symbols. --- dumpobj.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dumpobj.cpp b/dumpobj.cpp index 0a50192..6a94f03 100644 --- a/dumpobj.cpp +++ b/dumpobj.cpp @@ -431,10 +431,25 @@ bool dump_obj(const char *name, int fd) d.set_code(true); + bool newline = false; + + for (const auto &s : symbols) { + if (s.type != S_UND) continue; + emit("", "extern", s.name); + newline = true; + } + for (const auto &s : symbols) { if (s.type == S_UND) continue; sections[s.section].symbols.push_back(s); + + if (s.flags & SF_GBL) { + emit("", "public", s.name); + newline = true; + } } + if (newline) printf("\n"); + for (auto §ion : sections) { std::sort(section.symbols.begin(), section.symbols.end(), [](const symbol &a, const symbol &b){ return a.offset > b.offset;