Add visibility attributes in runtime/arch

Bug: 260881207
Test: presubmit
Test: abtd app_compat_drm
Test: abtd app_compat_top_100
Test: abtd app_compat_banking
Change-Id: Iabe9b8cb781e36f4ccf988b659f2ea67784fec70
diff --git a/runtime/arch/arch_test.cc b/runtime/arch/arch_test.cc
index 83fd986..57df3c8 100644
--- a/runtime/arch/arch_test.cc
+++ b/runtime/arch/arch_test.cc
@@ -22,7 +22,7 @@
 #include "entrypoints/quick/callee_save_frame.h"
 #include "quick/quick_method_frame_info.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class ArchTest : public CommonArtTest {};
 
diff --git a/runtime/arch/context-inl.h b/runtime/arch/context-inl.h
index 453432b..fd81ae2 100644
--- a/runtime/arch/context-inl.h
+++ b/runtime/arch/context-inl.h
@@ -41,7 +41,7 @@
 #error unimplemented
 #endif
 
-namespace art {
+namespace art HIDDEN {
 
 using RuntimeContextType = RUNTIME_CONTEXT_TYPE;
 
diff --git a/runtime/arch/context.cc b/runtime/arch/context.cc
index 82d8b6c..b9931c4 100644
--- a/runtime/arch/context.cc
+++ b/runtime/arch/context.cc
@@ -16,7 +16,7 @@
 
 #include "context-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 Context* Context::Create() {
   return new RuntimeContextType;
diff --git a/runtime/arch/context.h b/runtime/arch/context.h
index efeacd6..bfe322e 100644
--- a/runtime/arch/context.h
+++ b/runtime/arch/context.h
@@ -22,7 +22,7 @@
 
 #include "base/macros.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class QuickMethodFrameInfo;
 
@@ -31,7 +31,7 @@
 class Context {
  public:
   // Creates a context for the running architecture
-  static Context* Create();
+  EXPORT static Context* Create();
 
   virtual ~Context() {}
 
diff --git a/runtime/arch/instruction_set_features.cc b/runtime/arch/instruction_set_features.cc
index 17b9dc3..3ab9856 100644
--- a/runtime/arch/instruction_set_features.cc
+++ b/runtime/arch/instruction_set_features.cc
@@ -28,7 +28,7 @@
 #include "x86/instruction_set_features_x86.h"
 #include "x86_64/instruction_set_features_x86_64.h"
 
-namespace art {
+namespace art HIDDEN {
 
 std::unique_ptr<const InstructionSetFeatures> InstructionSetFeatures::FromVariant(
     InstructionSet isa, const std::string& variant, std::string* error_msg) {
diff --git a/runtime/arch/instruction_set_features.h b/runtime/arch/instruction_set_features.h
index 1cb0fbb..b31f30d 100644
--- a/runtime/arch/instruction_set_features.h
+++ b/runtime/arch/instruction_set_features.h
@@ -24,7 +24,7 @@
 #include "arch/instruction_set.h"
 #include "base/macros.h"
 
-namespace art {
+namespace art HIDDEN {
 
 class ArmInstructionSetFeatures;
 class Arm64InstructionSetFeatures;
@@ -36,22 +36,21 @@
 class InstructionSetFeatures {
  public:
   // Process a CPU variant string for the given ISA and create an InstructionSetFeatures.
-  static std::unique_ptr<const InstructionSetFeatures> FromVariant(InstructionSet isa,
-                                                                   const std::string& variant,
-                                                                   std::string* error_msg);
+  EXPORT static std::unique_ptr<const InstructionSetFeatures> FromVariant(
+      InstructionSet isa, const std::string& variant, std::string* error_msg);
 
   // Process a CPU variant string for the given ISA and make sure the features advertised
   // are supported by the hardware. This is needed for Pixel3a which wrongly
   // reports itself as cortex-a75.
-  static std::unique_ptr<const InstructionSetFeatures> FromVariantAndHwcap(
+  EXPORT static std::unique_ptr<const InstructionSetFeatures> FromVariantAndHwcap(
       InstructionSet isa, const std::string& variant, std::string* error_msg);
 
   // Parse a bitmap for the given isa and create an InstructionSetFeatures.
-  static std::unique_ptr<const InstructionSetFeatures> FromBitmap(InstructionSet isa,
-                                                                  uint32_t bitmap);
+  EXPORT static std::unique_ptr<const InstructionSetFeatures> FromBitmap(InstructionSet isa,
+                                                                         uint32_t bitmap);
 
   // Turn C pre-processor #defines into the equivalent instruction set features for kRuntimeISA.
-  static std::unique_ptr<const InstructionSetFeatures> FromCppDefines();
+  EXPORT static std::unique_ptr<const InstructionSetFeatures> FromCppDefines();
 
   // Check if run-time detection of instruction set features is supported.
   //
@@ -83,7 +82,7 @@
 
   // Parse a string of the form "div,-atomic_ldrd_strd" adding and removing these features to
   // create a new InstructionSetFeatures.
-  std::unique_ptr<const InstructionSetFeatures> AddFeaturesFromString(
+  EXPORT std::unique_ptr<const InstructionSetFeatures> AddFeaturesFromString(
       const std::string& feature_list, std::string* error_msg) const WARN_UNUSED;
 
   // Are these features the same as the other given features?
@@ -120,10 +119,10 @@
   const ArmInstructionSetFeatures* AsArmInstructionSetFeatures() const;
 
   // Down cast this Arm64InstructionFeatures.
-  const Arm64InstructionSetFeatures* AsArm64InstructionSetFeatures() const;
+  EXPORT const Arm64InstructionSetFeatures* AsArm64InstructionSetFeatures() const;
 
   // Down cast this Riscv64InstructionFeatures.
-  const Riscv64InstructionSetFeatures* AsRiscv64InstructionSetFeatures() const;
+  EXPORT const Riscv64InstructionSetFeatures* AsRiscv64InstructionSetFeatures() const;
 
   // Down cast this X86InstructionFeatures.
   const X86InstructionSetFeatures* AsX86InstructionSetFeatures() const;
@@ -152,7 +151,7 @@
  private:
   DISALLOW_COPY_AND_ASSIGN(InstructionSetFeatures);
 };
-std::ostream& operator<<(std::ostream& os, const InstructionSetFeatures& rhs);
+EXPORT std::ostream& operator<<(std::ostream& os, const InstructionSetFeatures& rhs);
 
 }  // namespace art
 
diff --git a/runtime/arch/instruction_set_features_test.cc b/runtime/arch/instruction_set_features_test.cc
index 82b8242..fbd2137 100644
--- a/runtime/arch/instruction_set_features_test.cc
+++ b/runtime/arch/instruction_set_features_test.cc
@@ -28,7 +28,7 @@
 #include <android-base/logging.h>
 #include <android-base/stringprintf.h>
 
-namespace art {
+namespace art HIDDEN {
 
 #ifdef ART_TARGET_ANDROID
 
diff --git a/runtime/arch/memcmp16.cc b/runtime/arch/memcmp16.cc
index e714cfc..614a878 100644
--- a/runtime/arch/memcmp16.cc
+++ b/runtime/arch/memcmp16.cc
@@ -29,7 +29,7 @@
   return 0;
 }
 
-namespace art {
+namespace art HIDDEN {
 
 namespace testing {
 
diff --git a/runtime/arch/memcmp16.h b/runtime/arch/memcmp16.h
index 0226c4e..1e857db 100644
--- a/runtime/arch/memcmp16.h
+++ b/runtime/arch/memcmp16.h
@@ -20,6 +20,8 @@
 #include <cstddef>
 #include <cstdint>
 
+#include "base/macros.h"
+
 // memcmp16 support.
 //
 // This can either be optimized assembly code, in which case we expect a function __memcmp16,
@@ -47,10 +49,11 @@
   return 0;
 }
 
+// TODO(260881207): decide whether to hide this symbol.
 extern "C" int32_t memcmp16_generic_static(const uint16_t* s0, const uint16_t* s1, size_t count);
 #endif
 
-namespace art {
+namespace art HIDDEN {
 
 namespace testing {
 
diff --git a/runtime/arch/stub_test.cc b/runtime/arch/stub_test.cc
index 759cd9a..d6d1065 100644
--- a/runtime/arch/stub_test.cc
+++ b/runtime/arch/stub_test.cc
@@ -32,7 +32,7 @@
 #include "mirror/object_array-alloc-inl.h"
 #include "scoped_thread_state_change-inl.h"
 
-namespace art {
+namespace art HIDDEN {
 
 
 class StubTest : public CommonRuntimeTest {