Make remaining compiler/ symbols hidden.

And mark required symbols with EXPORT.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --jit
Change-Id: I1b4e3c1ef9006924456dc36ec906bf74b62adab4
diff --git a/compiler/cfi_test.h b/compiler/cfi_test.h
index 9755ef1..e65bee8 100644
--- a/compiler/cfi_test.h
+++ b/compiler/cfi_test.h
@@ -23,6 +23,7 @@
 
 #include "arch/instruction_set.h"
 #include "base/enums.h"
+#include "base/macros.h"
 #include "debug/dwarf/dwarf_test.h"
 #include "disassembler.h"
 #include "dwarf/dwarf_constants.h"
@@ -30,7 +31,7 @@
 #include "gtest/gtest.h"
 #include "thread.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class CFITest : public dwarf::DwarfTest {
  public:
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 24872d3..442b96e 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -42,7 +42,7 @@
 #include "thread-current-inl.h"
 #include "utils/atomic_dex_ref_map-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class CommonCompilerTestImpl::CodeAndMetadata {
  public:
diff --git a/compiler/common_compiler_test.h b/compiler/common_compiler_test.h
index 1175522..f3cd132 100644
--- a/compiler/common_compiler_test.h
+++ b/compiler/common_compiler_test.h
@@ -24,11 +24,12 @@
 
 #include "arch/instruction_set.h"
 #include "arch/instruction_set_features.h"
+#include "base/macros.h"
 #include "common_runtime_test.h"
 #include "compiler.h"
 #include "oat_file.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace mirror {
 class ClassLoader;
 }  // namespace mirror
@@ -40,7 +41,8 @@
 
 template<class T> class Handle;
 
-class CommonCompilerTestImpl {
+// Export all symbols in `CommonCompilerTestImpl` for dex2oat tests.
+class EXPORT CommonCompilerTestImpl {
  public:
   static std::unique_ptr<CompilerOptions> CreateCompilerOptions(InstructionSet instruction_set,
                                                                 const std::string& variant);
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index 727b9dd..e2587c1 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -25,7 +25,7 @@
 #include "oat.h"
 #include "optimizing/optimizing_compiler.h"
 
-namespace art {
+namespace art HIDDEN {
 
 Compiler* Compiler::Create(const CompilerOptions& compiler_options,
                            CompiledCodeStorage* storage,
diff --git a/compiler/compiler.h b/compiler/compiler.h
index 6115d02..ce785bb 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -17,12 +17,13 @@
 #ifndef ART_COMPILER_COMPILER_H_
 #define ART_COMPILER_COMPILER_H_
 
+#include "base/macros.h"
 #include "base/mutex.h"
 #include "base/os.h"
 #include "compilation_kind.h"
 #include "dex/invoke_type.h"
 
-namespace art {
+namespace art HIDDEN {
 
 namespace dex {
 struct CodeItem;
@@ -52,9 +53,9 @@
     kOptimizing
   };
 
-  static Compiler* Create(const CompilerOptions& compiler_options,
-                          CompiledCodeStorage* storage,
-                          Kind kind);
+  EXPORT static Compiler* Create(const CompilerOptions& compiler_options,
+                                 CompiledCodeStorage* storage,
+                                 Kind kind);
 
   virtual bool CanCompileMethod(uint32_t method_idx, const DexFile& dex_file) const = 0;
 
diff --git a/compiler/compiler_reflection_test.cc b/compiler/compiler_reflection_test.cc
index 3b7b8b7..f3c07db 100644
--- a/compiler/compiler_reflection_test.cc
+++ b/compiler/compiler_reflection_test.cc
@@ -16,6 +16,7 @@
 
 #include "reflection.h"
 
+#include "base/macros.h"
 #include "class_linker.h"
 #include "common_compiler_test.h"
 #include "handle_scope-inl.h"
@@ -23,7 +24,7 @@
 #include "mirror/class.h"
 #include "mirror/class_loader.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class CompilerReflectionTest : public CommonCompilerTest {};
 
diff --git a/compiler/dex/inline_method_analyser.cc b/compiler/dex/inline_method_analyser.cc
index 3201965..381db3d 100644
--- a/compiler/dex/inline_method_analyser.cc
+++ b/compiler/dex/inline_method_analyser.cc
@@ -33,7 +33,7 @@
  * only to allow the debugger to check whether a method has been inlined.
  */
 
-namespace art {
+namespace art HIDDEN {
 
 namespace {  // anonymous namespace
 
diff --git a/compiler/dex/inline_method_analyser.h b/compiler/dex/inline_method_analyser.h
index e1d652a..99d07c6 100644
--- a/compiler/dex/inline_method_analyser.h
+++ b/compiler/dex/inline_method_analyser.h
@@ -28,7 +28,7 @@
  * only to allow the debugger to check whether a method has been inlined.
  */
 
-namespace art {
+namespace art HIDDEN {
 
 class CodeItemDataAccessor;
 
diff --git a/compiler/driver/compiled_code_storage.h b/compiler/driver/compiled_code_storage.h
index dfabeb4..cef7398 100644
--- a/compiler/driver/compiled_code_storage.h
+++ b/compiler/driver/compiled_code_storage.h
@@ -20,8 +20,9 @@
 #include <string>
 
 #include "base/array_ref.h"
+#include "base/macros.h"
 
-namespace art {
+namespace art HIDDEN {
 
 namespace linker {
 class LinkerPatch;
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc
index 8c2c8f3..603596f 100644
--- a/compiler/driver/compiler_options.cc
+++ b/compiler/driver/compiler_options.cc
@@ -35,7 +35,7 @@
 #include "scoped_thread_state_change-inl.h"
 #include "simple_compiler_options_map.h"
 
-namespace art {
+namespace art HIDDEN {
 
 CompilerOptions::CompilerOptions()
     : compiler_filter_(CompilerFilter::kDefaultCompilerFilter),
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h
index 1afa2c5..1cc9f2d 100644
--- a/compiler/driver/compiler_options.h
+++ b/compiler/driver/compiler_options.h
@@ -30,7 +30,7 @@
 #include "base/utils.h"
 #include "optimizing/register_allocator.h"
 
-namespace art {
+namespace art HIDDEN {
 
 namespace jit {
 class JitCompiler;
@@ -83,8 +83,8 @@
     kAppImage,                // Creating app image.
   };
 
-  CompilerOptions();
-  ~CompilerOptions();
+  EXPORT CompilerOptions();
+  EXPORT ~CompilerOptions();
 
   CompilerFilter::Filter GetCompilerFilter() const {
     return compiler_filter_;
@@ -298,11 +298,11 @@
     return image_classes_;
   }
 
-  bool IsImageClass(const char* descriptor) const;
+  EXPORT bool IsImageClass(const char* descriptor) const;
 
   // Returns whether the given `pretty_descriptor` is in the list of preloaded
   // classes. `pretty_descriptor` should be the result of calling `PrettyDescriptor`.
-  bool IsPreloadedClass(const char* pretty_descriptor) const;
+  EXPORT bool IsPreloadedClass(const char* pretty_descriptor) const;
 
   bool ParseCompilerOptions(const std::vector<std::string>& options,
                             bool ignore_unrecognized,
@@ -389,11 +389,11 @@
   // initialized at compile-time, or won't be initialized by the zygote, add
   // initialization checks at entry. This will avoid the need of trampolines
   // which at runtime we will need to dirty after initialization.
-  bool ShouldCompileWithClinitCheck(ArtMethod* method) const;
+  EXPORT bool ShouldCompileWithClinitCheck(ArtMethod* method) const;
 
  private:
-  bool ParseDumpInitFailures(const std::string& option, std::string* error_msg);
-  bool ParseRegisterAllocationStrategy(const std::string& option, std::string* error_msg);
+  EXPORT bool ParseDumpInitFailures(const std::string& option, std::string* error_msg);
+  EXPORT bool ParseRegisterAllocationStrategy(const std::string& option, std::string* error_msg);
 
   CompilerFilter::Filter compiler_filter_;
   size_t huge_method_threshold_;
diff --git a/compiler/driver/compiler_options_map-inl.h b/compiler/driver/compiler_options_map-inl.h
index fcbc0f2..6733a81 100644
--- a/compiler/driver/compiler_options_map-inl.h
+++ b/compiler/driver/compiler_options_map-inl.h
@@ -29,7 +29,7 @@
 #include "cmdline_parser.h"
 #include "compiler_options.h"
 
-namespace art {
+namespace art HIDDEN {
 
 template <>
 struct CmdlineType<CompilerFilter::Filter> : CmdlineTypeParser<CompilerFilter::Filter> {
diff --git a/compiler/driver/compiler_options_map.h b/compiler/driver/compiler_options_map.h
index 7e2f846..b2dd57d 100644
--- a/compiler/driver/compiler_options_map.h
+++ b/compiler/driver/compiler_options_map.h
@@ -21,10 +21,11 @@
 #include <vector>
 
 #include "base/compiler_filter.h"
+#include "base/macros.h"
 #include "base/variant_map.h"
 #include "cmdline_types.h"
 
-namespace art {
+namespace art HIDDEN {
 
 enum class ProfileMethodsCheck : uint8_t;
 
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index 0d0f074..ccebfa9 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -25,7 +25,7 @@
 #include "mirror/dex_cache.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 DexCompilationUnit::DexCompilationUnit(Handle<mirror::ClassLoader> class_loader,
                                        ClassLinker* class_linker,
diff --git a/compiler/driver/dex_compilation_unit.h b/compiler/driver/dex_compilation_unit.h
index def90fa..d595c0a 100644
--- a/compiler/driver/dex_compilation_unit.h
+++ b/compiler/driver/dex_compilation_unit.h
@@ -20,11 +20,12 @@
 #include <stdint.h>
 
 #include "base/arena_object.h"
+#include "base/macros.h"
 #include "dex/code_item_accessors.h"
 #include "dex/dex_file.h"
 #include "handle.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace mirror {
 class Class;
 class ClassLoader;
diff --git a/compiler/driver/simple_compiler_options_map.h b/compiler/driver/simple_compiler_options_map.h
index e7a51a4..6663c0c 100644
--- a/compiler/driver/simple_compiler_options_map.h
+++ b/compiler/driver/simple_compiler_options_map.h
@@ -23,9 +23,10 @@
 #include <memory>
 
 #include "compiler_options_map-inl.h"
+#include "base/macros.h"
 #include "base/variant_map.h"
 
-namespace art {
+namespace art HIDDEN {
 
 template <typename TValue>
 struct SimpleParseArgumentMapKey : VariantMapKey<TValue> {
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index 6604522..82c4998 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -24,6 +24,7 @@
 #include "base/callee_save_type.h"
 #include "base/enums.h"
 #include "base/leb128.h"
+#include "base/macros.h"
 #include "base/malloc_arena_pool.h"
 #include "class_linker.h"
 #include "common_runtime_test.h"
@@ -44,7 +45,7 @@
 #include "scoped_thread_state_change-inl.h"
 #include "thread.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class ExceptionTest : public CommonRuntimeTest {
  protected:
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index f12a3ad..d2f5aa6 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -34,7 +34,7 @@
 #include "jit/jit_code_cache.h"
 #include "jit/jit_logger.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace jit {
 
 JitCompiler* JitCompiler::Create() {
@@ -125,7 +125,7 @@
   }
 }
 
-extern "C" JitCompilerInterface* jit_load() {
+EXPORT extern "C" JitCompilerInterface* jit_load() {
   VLOG(jit) << "Create jit compiler";
   auto* const jit_compiler = JitCompiler::Create();
   CHECK(jit_compiler != nullptr);
diff --git a/compiler/jit/jit_compiler.h b/compiler/jit/jit_compiler.h
index 8cd6b5a..5a919fb 100644
--- a/compiler/jit/jit_compiler.h
+++ b/compiler/jit/jit_compiler.h
@@ -17,12 +17,13 @@
 #ifndef ART_COMPILER_JIT_JIT_COMPILER_H_
 #define ART_COMPILER_JIT_JIT_COMPILER_H_
 
+#include "base/macros.h"
 #include "base/mutex.h"
 #include "compilation_kind.h"
 
 #include "jit/jit.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class ArtMethod;
 class Compiler;
diff --git a/compiler/jit/jit_logger.cc b/compiler/jit/jit_logger.cc
index 6b9453f..3284526 100644
--- a/compiler/jit/jit_logger.cc
+++ b/compiler/jit/jit_logger.cc
@@ -24,7 +24,7 @@
 #include "jit/jit_code_cache.h"
 #include "oat_file-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace jit {
 
 #ifdef ART_TARGET_ANDROID
diff --git a/compiler/jit/jit_logger.h b/compiler/jit/jit_logger.h
index 61a4dcf..9d1f307 100644
--- a/compiler/jit/jit_logger.h
+++ b/compiler/jit/jit_logger.h
@@ -19,10 +19,11 @@
 
 #include <memory>
 
+#include "base/macros.h"
 #include "base/mutex.h"
 #include "base/os.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class ArtMethod;
 
diff --git a/compiler/linker/linker_patch.h b/compiler/linker/linker_patch.h
index 7da1e82..8ed7fce 100644
--- a/compiler/linker/linker_patch.h
+++ b/compiler/linker/linker_patch.h
@@ -23,9 +23,10 @@
 #include <android-base/logging.h>
 
 #include "base/bit_utils.h"
+#include "base/macros.h"
 #include "dex/method_reference.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class DexFile;
 
@@ -328,7 +329,7 @@
   friend bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs);
   friend bool operator<(const LinkerPatch& lhs, const LinkerPatch& rhs);
 };
-std::ostream& operator<<(std::ostream& os, LinkerPatch::Type type);
+EXPORT std::ostream& operator<<(std::ostream& os, LinkerPatch::Type type);
 
 inline bool operator==(const LinkerPatch& lhs, const LinkerPatch& rhs) {
   return lhs.literal_offset_ == rhs.literal_offset_ &&
diff --git a/compiler/linker/linker_patch_test.cc b/compiler/linker/linker_patch_test.cc
index 997418c..1c46da1 100644
--- a/compiler/linker/linker_patch_test.cc
+++ b/compiler/linker/linker_patch_test.cc
@@ -16,9 +16,10 @@
 
 #include <gtest/gtest.h>
 
+#include "base/macros.h"
 #include "linker_patch.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace linker {
 
 TEST(LinkerPatch, LinkerPatchOperators) {
diff --git a/compiler/linker/output_stream_test.cc b/compiler/linker/output_stream_test.cc
index 31a8516..22b174f 100644
--- a/compiler/linker/output_stream_test.cc
+++ b/compiler/linker/output_stream_test.cc
@@ -23,7 +23,7 @@
 #include "stream/file_output_stream.h"
 #include "stream/vector_output_stream.h"
 
-namespace art {
+namespace art HIDDEN {
 namespace linker {
 
 class OutputStreamTest : public CommonArtTest {
diff --git a/compiler/trampolines/trampoline_compiler.cc b/compiler/trampolines/trampoline_compiler.cc
index 0aaeaa5..5e7ac83 100644
--- a/compiler/trampolines/trampoline_compiler.cc
+++ b/compiler/trampolines/trampoline_compiler.cc
@@ -38,7 +38,7 @@
 
 #define __ assembler.
 
-namespace art {
+namespace art HIDDEN {
 
 #ifdef ART_ENABLE_CODEGEN_arm
 namespace arm {
diff --git a/compiler/trampolines/trampoline_compiler.h b/compiler/trampolines/trampoline_compiler.h
index f0086b5..32e35ae 100644
--- a/compiler/trampolines/trampoline_compiler.h
+++ b/compiler/trampolines/trampoline_compiler.h
@@ -22,9 +22,10 @@
 #include <vector>
 
 #include "arch/instruction_set.h"
+#include "base/macros.h"
 #include "offsets.h"
 
-namespace art {
+namespace art HIDDEN {
 
 enum EntryPointCallingConvention {
   // ABI of invocations to a method's interpreter entry point.
@@ -36,12 +37,10 @@
 };
 
 // Create code that will invoke the function held in thread local storage.
-std::unique_ptr<const std::vector<uint8_t>> CreateTrampoline32(InstructionSet isa,
-                                                               EntryPointCallingConvention abi,
-                                                               ThreadOffset32 entry_point_offset);
-std::unique_ptr<const std::vector<uint8_t>> CreateTrampoline64(InstructionSet isa,
-                                                               EntryPointCallingConvention abi,
-                                                               ThreadOffset64 entry_point_offset);
+EXPORT std::unique_ptr<const std::vector<uint8_t>> CreateTrampoline32(
+    InstructionSet isa, EntryPointCallingConvention abi, ThreadOffset32 entry_point_offset);
+EXPORT std::unique_ptr<const std::vector<uint8_t>> CreateTrampoline64(
+    InstructionSet isa, EntryPointCallingConvention abi, ThreadOffset64 entry_point_offset);
 
 }  // namespace art