diff options
author | Martin Stjernholm <mast@google.com> | 2020-09-29 13:58:10 +0100 |
---|---|---|
committer | Martin Stjernholm <mast@google.com> | 2020-09-29 14:55:40 +0000 |
commit | 407468761d72c1031a871c18c29238135d9f0a88 (patch) | |
tree | d9655da2c6a95806476f3b4bfcfd522feafaad06 /compiler/optimizing/graph_visualizer.cc | |
parent | 9636062c4d4839bbb2fd979ee56b2f38d8615f1e (diff) |
Link libart-disassembler statically into static libart-compiler.
Necessary to avoid runtime dlopen of non-existing
libart(d)-disassembler.so in host dex2oat. This increases the stripped
dex2oat binary size by 4.8% or ~800 KB.
Test: art/tools/buildbot-build.sh --host && \
art/test/testrunner/testrunner.py --optimizing --host --ndebug -t 465
with and without HOST_PREFER_32_BIT=true
Bug: 145934348
Change-Id: I623019132175bd0430d30a421655484bdcb71857
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r-- | compiler/optimizing/graph_visualizer.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index 3f6215a650..f9c63c4486 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -110,13 +110,17 @@ std::ostream& operator<<(std::ostream& os, const StringList& list) { } } +#ifndef ART_STATIC_LIBART_COMPILER using create_disasm_prototype = Disassembler*(InstructionSet, DisassemblerOptions*); +#endif + class HGraphVisualizerDisassembler { public: HGraphVisualizerDisassembler(InstructionSet instruction_set, const uint8_t* base_address, const uint8_t* end_address) : instruction_set_(instruction_set), disassembler_(nullptr) { +#ifndef ART_STATIC_LIBART_COMPILER constexpr const char* libart_disassembler_so_name = kIsDebugBuild ? "libartd-disassembler.so" : "libart-disassembler.so"; libart_disassembler_handle_ = dlopen(libart_disassembler_so_name, RTLD_NOW); @@ -132,10 +136,11 @@ class HGraphVisualizerDisassembler { << libart_disassembler_so_name << ": " << dlerror(); return; } +#endif // Reading the disassembly from 0x0 is easier, so we print relative // addresses. We will only disassemble the code once everything has // been generated, so we can read data in literal pools. - disassembler_ = std::unique_ptr<Disassembler>((*create_disassembler)( + disassembler_ = std::unique_ptr<Disassembler>(create_disassembler( instruction_set, new DisassemblerOptions(/* absolute_addresses= */ false, base_address, @@ -149,9 +154,11 @@ class HGraphVisualizerDisassembler { ~HGraphVisualizerDisassembler() { // We need to call ~Disassembler() before we close the library. disassembler_.reset(); +#ifndef ART_STATIC_LIBART_COMPILER if (libart_disassembler_handle_ != nullptr) { dlclose(libart_disassembler_handle_); } +#endif } void Disassemble(std::ostream& output, size_t start, size_t end) const { @@ -172,7 +179,9 @@ class HGraphVisualizerDisassembler { InstructionSet instruction_set_; std::unique_ptr<Disassembler> disassembler_; +#ifndef ART_STATIC_LIBART_COMPILER void* libart_disassembler_handle_; +#endif }; |