Add test for issue about hidden __cxa_begin_cleanup is referenced by DSO

See comment in Android.mk for details

Change-Id: Ie3f837250b7de62c0337c4afdc6275da4200c9e8
diff --git a/tests/build/b8247455-hidden-cxa/jni/Android.mk b/tests/build/b8247455-hidden-cxa/jni/Android.mk
new file mode 100644
index 0000000..e3ffba4
--- /dev/null
+++ b/tests/build/b8247455-hidden-cxa/jni/Android.mk
@@ -0,0 +1,30 @@
+# This test is to demostrate the issue:
+#
+#  hidden symbol '__cxa_begin_cleanup' in ./obj/local/armeabi/libgnustl_static.a(eh_arm.o)
+#    is referenced by DSO ./obj/local/armeabi/libidiv.so
+#  hidden symbol '__cxa_type_match' in ./obj/local/armeabi/libgnustl_static.a(eh_arm.o)
+#    is referenced by DSO ./obj/local/armeabi/libidiv.so
+#
+#  File idiv.cpp contains code potentially causes divide-by-zero exception. libidiv.so
+#  is built with libgnustl_static.a which provides __cxa_begin_cleanup and
+#  __cxa_type_match needed by unwinder in libgcc.a.  Unfortunately both are built
+#  with hidden visibility, and causes warnings as the above when libidiv.so is used
+#  to link other binaries.
+#
+# The fix is to unhide both __cxa_begin_cleanup and __cxa_type_match
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libidiv
+LOCAL_SRC_FILES:= idiv.cpp
+LOCAL_CFLAGS := -Wall -Werror -Wno-unused-parameter
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libthrow
+LOCAL_SRC_FILES:= throw.cpp
+LOCAL_CFLAGS := -Wall -Werror -frtti -fexceptions
+LOCAL_SHARED_LIBRARIES = libidiv
+include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
diff --git a/tests/build/b8247455-hidden-cxa/jni/Application.mk b/tests/build/b8247455-hidden-cxa/jni/Application.mk
new file mode 100644
index 0000000..3563119
--- /dev/null
+++ b/tests/build/b8247455-hidden-cxa/jni/Application.mk
@@ -0,0 +1,2 @@
+APP_ABI := all
+APP_STL := gnustl_static
diff --git a/tests/build/b8247455-hidden-cxa/jni/idiv.cpp b/tests/build/b8247455-hidden-cxa/jni/idiv.cpp
new file mode 100644
index 0000000..b80920d
--- /dev/null
+++ b/tests/build/b8247455-hidden-cxa/jni/idiv.cpp
@@ -0,0 +1,4 @@
+int my_idiv (int a, int b)
+{
+    return a / b;
+}
diff --git a/tests/build/b8247455-hidden-cxa/jni/throw.cpp b/tests/build/b8247455-hidden-cxa/jni/throw.cpp
new file mode 100644
index 0000000..ac61371
--- /dev/null
+++ b/tests/build/b8247455-hidden-cxa/jni/throw.cpp
@@ -0,0 +1,6 @@
+extern int my_idiv(int a, int b);
+int my_thorw()
+{
+    my_idiv(3, 5);
+    throw 20;
+}