Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08b3d2e5 authored by Dan Egnor's avatar Dan Egnor
Browse files

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
parent df7ccbc8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ private:

            Extras*     mExtras;
            void*       mReserved0;
    static  String16    sEmptyDescriptor;
};

// ---------------------------------------------------------------------------
+25 −24
Original line number Diff line number Diff line
@@ -12,11 +12,8 @@
# 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:= \
sources := \
    Binder.cpp \
    BpBinder.cpp \
    IInterface.cpp \
@@ -33,13 +30,17 @@ LOCAL_SRC_FILES:= \
    ProcessState.cpp \
    Static.cpp

LOCAL_LDLIBS += -lpthread

LOCAL_SHARED_LIBRARIES := \
	liblog \
	libcutils \
	libutils
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)
+3 −2
Original line number Diff line number Diff line
@@ -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;
}
+10 −0
Original line number Diff line number Diff line
@@ -104,3 +104,13 @@ endif # sim
LOCAL_MODULE:= libutils
include $(BUILD_SHARED_LIBRARY)

ifneq ($(TARGET_SIMULATOR),true)
ifeq ($(TARGET_OS),linux)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += external/zlib external/icu4c/common
LOCAL_LDLIBS := -lrt -ldl -lpthread
LOCAL_MODULE := libutils
LOCAL_SRC_FILES := $(commonSources) BackupData.cpp BackupHelpers.cpp
include $(BUILD_STATIC_LIBRARY)
endif
endif
+5 −4
Original line number Diff line number Diff line
@@ -136,10 +136,11 @@ static inline char* getEmptyString()

void initialize_string8()
{
#ifdef LIBUTILS_NATIVE
	  // Bite me, Darwin!
    // HACK: This dummy dependency forces linking libutils Static.cpp,
    // which is needed to initialize String8/String16 classes.
    // These variables are named for Darwin, but are needed elsewhere too,
    // including static linking on any platform.
    gDarwinIsReallyAnnoying = gDarwinCantLoadAllObjects;
#endif

    SharedBuffer* buf = SharedBuffer::alloc(1);
    char* str = (char*)buf->data();