summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Egnor <egnor@google.com>2010-05-06 00:55:09 -0700
committerDan Egnor <egnor@google.com>2010-05-06 01:03:31 -0700
commit87957f7b91fbf83dbb417e5f0bab9ee54818fdd0 (patch)
treecc7c031ba397cf69e20da749c5877569d04e1a5c
parent380cf5dbf2dec61134f60064c971d262d5208321 (diff)
downloadlibhwbinder-87957f7b91fbf83dbb417e5f0bab9ee54818fdd0.tar.gz
Make static versions of libutils and libbinder.
Fix some small static-initialization-order issues (and a static- initializers-missing issue) that result from doing so. The static libraries don't actually get used for anything real at the moment -- they're used for perf tests of bug 2660235. Bug: 2660235 Change-Id: Iee2f38f79cc93b395e8d0a5a144ed92461f5ada0
-rw-r--r--Android.mk49
-rw-r--r--Binder.cpp5
-rw-r--r--include/hwbinder/Binder.h1
3 files changed, 28 insertions, 27 deletions
diff --git a/Android.mk b/Android.mk
index 2df6775..13dc500 100644
--- a/Android.mk
+++ b/Android.mk
@@ -12,34 +12,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
# we have the common sources, plus some device-specific stuff
-LOCAL_SRC_FILES:= \
- Binder.cpp \
- BpBinder.cpp \
- IInterface.cpp \
- IMemory.cpp \
- IPCThreadState.cpp \
- IPermissionController.cpp \
- IServiceManager.cpp \
- MemoryDealer.cpp \
+sources := \
+ Binder.cpp \
+ BpBinder.cpp \
+ IInterface.cpp \
+ IMemory.cpp \
+ IPCThreadState.cpp \
+ IPermissionController.cpp \
+ IServiceManager.cpp \
+ MemoryDealer.cpp \
MemoryBase.cpp \
MemoryHeapBase.cpp \
MemoryHeapPmem.cpp \
- Parcel.cpp \
- Permission.cpp \
- ProcessState.cpp \
- Static.cpp
-
-LOCAL_LDLIBS += -lpthread
-
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libcutils \
- libutils
+ Parcel.cpp \
+ Permission.cpp \
+ ProcessState.cpp \
+ Static.cpp
-LOCAL_MODULE:= libbinder
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_LDLIBS += -lpthread
+LOCAL_MODULE := libbinder
+LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
+LOCAL_SRC_FILES := $(sources)
include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_LDLIBS += -lpthread
+LOCAL_MODULE := libbinder
+LOCAL_SRC_FILES := $(sources)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/Binder.cpp b/Binder.cpp
index 0dd7622..9945f91 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -69,8 +69,6 @@ public:
// ---------------------------------------------------------------------------
-String16 BBinder::sEmptyDescriptor;
-
BBinder::BBinder()
: mExtras(NULL)
{
@@ -88,6 +86,9 @@ status_t BBinder::pingBinder()
const String16& BBinder::getInterfaceDescriptor() const
{
+ // This is a local static rather than a global static,
+ // to avoid static initializer ordering issues.
+ static String16 sEmptyDescriptor;
LOGW("reached BBinder::getInterfaceDescriptor (this=%p)", this);
return sEmptyDescriptor;
}
diff --git a/include/hwbinder/Binder.h b/include/hwbinder/Binder.h
index 47b2bb9..ba3ac4b 100644
--- a/include/hwbinder/Binder.h
+++ b/include/hwbinder/Binder.h
@@ -71,7 +71,6 @@ private:
Extras* mExtras;
void* mReserved0;
- static String16 sEmptyDescriptor;
};
// ---------------------------------------------------------------------------