aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuliano Procida <gprocida@google.com>2023-11-16 15:06:07 +0000
committerGiuliano Procida <gprocida@google.com>2023-11-20 12:58:54 +0000
commit02365b6cf06b3725846aa045fc51ba62d1e217c0 (patch)
tree23d9dd272e9110e2b0654a214f4b9d3d71581876
parenta1872f2d23ebe2e70fefa2eb0a2948b4ee6e531a (diff)
downloadstg-02365b6cf06b3725846aa045fc51ba62d1e217c0.tar.gz
remove stg and stgdiff --skip-dwarf option
This was not needed and didn't prevent failures reading ELF files without DWARF anyway. PiperOrigin-RevId: 583032041 Change-Id: I570df02ca607614c9c9d4e9966eb0315ebd0029c
-rw-r--r--doc/stg.md6
-rw-r--r--doc/stgdiff.md6
-rw-r--r--elf_reader.cc7
-rw-r--r--reader_options.h3
-rw-r--r--stg.cc34
-rw-r--r--stgdiff.cc32
6 files changed, 28 insertions, 60 deletions
diff --git a/doc/stg.md b/doc/stg.md
index 30c738b..31f9ab5 100644
--- a/doc/stg.md
+++ b/doc/stg.md
@@ -12,7 +12,6 @@ stg
[-t|--types]
[-F|--files|--file-filter <filter>]
[-S|--symbols|--symbol-filter <filter>]
- [--skip-dwarf]
[-a|--abi|-b|--btf|-e|--elf|-s|--stg] [file] ...
[{-o|--output} {filename|-}] ...
implicit defaults: --abi
@@ -66,11 +65,6 @@ The tool can be passed any number of inputs to combine into a unified ABI.
Captures all named types found in ELF files as interface types, regardless
of whether those types are reachable by any symbol.
-* `--skip-dwarf`
-
- Disable DWARF processing, when reading ELF files. For other formats this
- option does nothing.
-
## Merge
If multiple (or zero) inputs are provided, then ABI roots from all inputs are
diff --git a/doc/stgdiff.md b/doc/stgdiff.md
index e91b0e4..62d6dd2 100644
--- a/doc/stgdiff.md
+++ b/doc/stgdiff.md
@@ -12,7 +12,6 @@ stgdiff
[-a|--abi|-b|--btf|-e|--elf|-s|--stg] file2
[-x|--exact]
[-t|--types]
- [--skip-dwarf]
[{-i|--ignore} <ignore-option>] ...
[{-f|--format} <output-format>] ...
[{-o|--output} {filename|-}] ...
@@ -62,11 +61,6 @@ ignore options: type_declaration_status symbol_type_presence primitive_type_enco
Captures all named types found in ELF files as interface types, regardless
of whether those types are reachable by any symbol.
-* `--skip-dwarf`
-
- Disable DWARF processing, when reading ELF files. For other formats this
- option does nothing.
-
## Comparison
The default behaviour is to compare two ABIs for equivalence.
diff --git a/elf_reader.cc b/elf_reader.cc
index b940c6b..2913007 100644
--- a/elf_reader.cc
+++ b/elf_reader.cc
@@ -225,11 +225,8 @@ class Reader {
// the starting node ID to be the current graph limit.
Unification unification(graph_, graph_.Limit(), metrics_);
- dwarf::Types types;
- if (!options_.Test(ReadOptions::SKIP_DWARF)) {
- types = dwarf::Process(dwarf_, elf_.IsLittleEndianBinary(), file_filter_,
- graph_);
- }
+ const dwarf::Types types = dwarf::Process(
+ dwarf_, elf_.IsLittleEndianBinary(), file_filter_, graph_);
// A less important optimisation is avoiding copying the mapping array as it
// is populated. This is done by reserving space to the new graph limit.
diff --git a/reader_options.h b/reader_options.h
index 56388d2..b7b87f2 100644
--- a/reader_options.h
+++ b/reader_options.h
@@ -26,8 +26,7 @@ namespace stg {
struct ReadOptions {
enum Value {
- SKIP_DWARF = 1 << 0,
- TYPE_ROOTS = 1 << 1,
+ TYPE_ROOTS = 1 << 0,
};
using Bitset = std::underlying_type_t<Value>;
diff --git a/stg.cc b/stg.cc
index fac1717..b8bad6c 100644
--- a/stg.cc
+++ b/stg.cc
@@ -116,9 +116,6 @@ void Write(const Graph& graph, Id root, const char* output, Metrics& metrics) {
} // namespace stg
int main(int argc, char* argv[]) {
- enum LongOptions {
- kSkipDwarf = 256,
- };
// Process arguments.
bool opt_metrics = false;
bool opt_keep_duplicates = false;
@@ -129,20 +126,19 @@ int main(int argc, char* argv[]) {
std::vector<const char*> inputs;
std::vector<const char*> outputs;
static option opts[] = {
- {"metrics", no_argument, nullptr, 'm' },
- {"keep-duplicates", no_argument, nullptr, 'd' },
- {"types", no_argument, nullptr, 't' },
- {"files", required_argument, nullptr, 'F' },
- {"file-filter", required_argument, nullptr, 'F' },
- {"symbols", required_argument, nullptr, 'S' },
- {"symbol-filter", required_argument, nullptr, 'S' },
- {"abi", no_argument, nullptr, 'a' },
- {"btf", no_argument, nullptr, 'b' },
- {"elf", no_argument, nullptr, 'e' },
- {"stg", no_argument, nullptr, 's' },
- {"output", required_argument, nullptr, 'o' },
- {"skip-dwarf", no_argument, nullptr, kSkipDwarf},
- {nullptr, 0, nullptr, 0 },
+ {"metrics", no_argument, nullptr, 'm' },
+ {"keep-duplicates", no_argument, nullptr, 'd' },
+ {"types", no_argument, nullptr, 't' },
+ {"files", required_argument, nullptr, 'F' },
+ {"file-filter", required_argument, nullptr, 'F' },
+ {"symbols", required_argument, nullptr, 'S' },
+ {"symbol-filter", required_argument, nullptr, 'S' },
+ {"abi", no_argument, nullptr, 'a' },
+ {"btf", no_argument, nullptr, 'b' },
+ {"elf", no_argument, nullptr, 'e' },
+ {"stg", no_argument, nullptr, 's' },
+ {"output", required_argument, nullptr, 'o' },
+ {nullptr, 0, nullptr, 0 },
};
auto usage = [&]() {
std::cerr << "usage: " << argv[0] << '\n'
@@ -151,7 +147,6 @@ int main(int argc, char* argv[]) {
<< " [-t|--types]\n"
<< " [-F|--files|--file-filter <filter>]\n"
<< " [-S|--symbols|--symbol-filter <filter>]\n"
- << " [--skip-dwarf]\n"
<< " [-a|--abi|-b|--btf|-e|--elf|-s|--stg] [file] ...\n"
<< " [{-o|--output} {filename|-}] ...\n"
<< "implicit defaults: --abi\n";
@@ -202,9 +197,6 @@ int main(int argc, char* argv[]) {
}
outputs.push_back(argument);
break;
- case kSkipDwarf:
- opt_read_options.Set(stg::ReadOptions::SKIP_DWARF);
- break;
default:
return usage();
}
diff --git a/stgdiff.cc b/stgdiff.cc
index c256e4b..f3606ea 100644
--- a/stgdiff.cc
+++ b/stgdiff.cc
@@ -148,9 +148,6 @@ int Run(const Inputs& inputs, const Outputs& outputs, stg::Ignore ignore,
} // namespace
int main(int argc, char* argv[]) {
- enum LongOptions {
- kSkipDwarf = 256,
- };
// Process arguments.
bool opt_metrics = false;
bool opt_exact = false;
@@ -163,19 +160,18 @@ int main(int argc, char* argv[]) {
Inputs inputs;
Outputs outputs;
static option opts[] = {
- {"metrics", no_argument, nullptr, 'm' },
- {"abi", no_argument, nullptr, 'a' },
- {"btf", no_argument, nullptr, 'b' },
- {"elf", no_argument, nullptr, 'e' },
- {"stg", no_argument, nullptr, 's' },
- {"exact", no_argument, nullptr, 'x' },
- {"types", no_argument, nullptr, 't' },
- {"ignore", required_argument, nullptr, 'i' },
- {"format", required_argument, nullptr, 'f' },
- {"output", required_argument, nullptr, 'o' },
- {"fidelity", required_argument, nullptr, 'F' },
- {"skip-dwarf", no_argument, nullptr, kSkipDwarf},
- {nullptr, 0, nullptr, 0 },
+ {"metrics", no_argument, nullptr, 'm' },
+ {"abi", no_argument, nullptr, 'a' },
+ {"btf", no_argument, nullptr, 'b' },
+ {"elf", no_argument, nullptr, 'e' },
+ {"stg", no_argument, nullptr, 's' },
+ {"exact", no_argument, nullptr, 'x' },
+ {"types", no_argument, nullptr, 't' },
+ {"ignore", required_argument, nullptr, 'i' },
+ {"format", required_argument, nullptr, 'f' },
+ {"output", required_argument, nullptr, 'o' },
+ {"fidelity", required_argument, nullptr, 'F' },
+ {nullptr, 0, nullptr, 0 },
};
auto usage = [&]() {
std::cerr << "usage: " << argv[0] << '\n'
@@ -184,7 +180,6 @@ int main(int argc, char* argv[]) {
<< " [-a|--abi|-b|--btf|-e|--elf|-s|--stg] file2\n"
<< " [-x|--exact]\n"
<< " [-t|--types]\n"
- << " [--skip-dwarf]\n"
<< " [{-i|--ignore} <ignore-option>] ...\n"
<< " [{-f|--format} <output-format>] ...\n"
<< " [{-o|--output} {filename|-}] ...\n"
@@ -257,9 +252,6 @@ int main(int argc, char* argv[]) {
}
opt_fidelity.emplace(argument);
break;
- case kSkipDwarf:
- opt_read_options.Set(stg::ReadOptions::SKIP_DWARF);
- break;
default:
return usage();
}