summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Abgrall <jpa@google.com>2014-06-18 11:55:28 -0700
committerJP Abgrall <jpa@google.com>2014-06-24 21:26:23 -0700
commit5e2dc248acc52aec6aea33d2268fdf38d45cf21b (patch)
tree9bb58a8a6f789b327bb0ce41ed04c3bba1fc3a8a
parent136c149632302337df2d225bb85ee3db3d7e1971 (diff)
downloadextras-5e2dc248acc52aec6aea33d2268fdf38d45cf21b.tar.gz
f2fs utils: set correct dependency on dynamic libf2fs
Don't link against it anymore. Just let dlopen() deal with it correctly. The "config" struct will come from the f2fs_ioutils and libf2fs_fmt_host expects to have it global, so let link with -rdynamic and let dlopen() resolve it. Be more aggressive with linux-only builds. Bug: 15717498 Change-Id: I03ebebed1fc652170b44f809df42c1f8595216eb Signed-off-by: JP Abgrall <jpa@google.com>
-rw-r--r--f2fs_utils/Android.mk44
-rw-r--r--f2fs_utils/f2fs_dlutils.c2
2 files changed, 20 insertions, 26 deletions
diff --git a/f2fs_utils/Android.mk b/f2fs_utils/Android.mk
index 8fb607c1..60fe081a 100644
--- a/f2fs_utils/Android.mk
+++ b/f2fs_utils/Android.mk
@@ -2,12 +2,19 @@
LOCAL_PATH:= $(call my-dir)
-libf2fs_ioutils_src_files := \
- f2fs_ioutils.c
+ifeq ($(HOST_OS),linux)
-# ---------------------------------------
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(libf2fs_ioutils_src_files)
+LOCAL_MODULE := libf2fs_utils_host
+LOCAL_SRC_FILES := f2fs_utils.c
+LOCAL_STATIC_LIBRARIES := \
+ libsparse_host \
+ libz
+LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
+include $(BUILD_HOST_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := f2fs_ioutils.c
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
LOCAL_STATIC_LIBRARIES := \
libsparse_host \
@@ -16,7 +23,6 @@ LOCAL_STATIC_LIBRARIES := \
LOCAL_MODULE := libf2fs_ioutils_host
include $(BUILD_HOST_STATIC_LIBRARY)
-# ---------------------------------------
include $(CLEAR_VARS)
LOCAL_SRC_FILES := f2fs_dlutils.c
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
@@ -26,29 +32,17 @@ LOCAL_MODULE := libf2fs_dlutils_host
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
-LOCAL_MODULE := libf2fs_utils_host
-LOCAL_SRC_FILES := f2fs_utils.c
-LOCAL_STATIC_LIBRARIES := \
- libsparse_host \
- libz
-LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
-include $(BUILD_HOST_STATIC_LIBRARY)
-
-#
-# -- All host/targets excluding windows
-#
-
-ifneq ($(HOST_OS),windows)
-
-include $(CLEAR_VARS)
LOCAL_SRC_FILES := make_f2fs_main.c
LOCAL_MODULE := make_f2fs
-LOCAL_STATIC_LIBRARIES += \
- libf2fs_utils_host \
- libf2fs_dlutils_host
# libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn")
-LOCAL_LDLIBS := -ldl
-LOCAL_SHARED_LIBRARIES := libf2fs_fmt_host_dyn
+LOCAL_LDFLAGS := -ldl -rdynamic
+# The following libf2fs_* are from system/extras/f2fs_utils,
+# and do not use code in external/f2fs-tools.
+LOCAL_STATIC_LIBRARIES := libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
+LOCAL_REQUIRED_MODULES := libf2fs_fmt_host_dyn
+LOCAL_STATIC_LIBRARIES += \
+ libsparse_host \
+ libz
include $(BUILD_HOST_EXECUTABLE)
include $(CLEAR_VARS)
diff --git a/f2fs_utils/f2fs_dlutils.c b/f2fs_utils/f2fs_dlutils.c
index 6fddc6ef..40be4161 100644
--- a/f2fs_utils/f2fs_dlutils.c
+++ b/f2fs_utils/f2fs_dlutils.c
@@ -52,7 +52,7 @@ void f2fs_init_configuration(struct f2fs_configuration *config) {
int dlopenf2fs() {
void* f2fs_lib;
- f2fs_lib = dlopen(F2FS_DYN_LIB, RTLD_LAZY);
+ f2fs_lib = dlopen(F2FS_DYN_LIB, RTLD_NOW);
if (!f2fs_lib) {
return -1;
}