diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2014-10-22 21:55:07 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2014-10-22 21:55:07 +0800 |
commit | a1b196f95e256e08fd0308669b942352477d57c1 (patch) | |
tree | 444bb8e8f3199429e01d444c324515a819a08be9 /tests | |
parent | c0daa7771eeaa9608c623794d90b8e81463ef857 (diff) | |
download | extras-a1b196f95e256e08fd0308669b942352477d57c1.tar.gz |
bionic libc test: clean up test for dlopen_null
The test for dlopen function with null specified have been
re-implemented by dlfcn.dladdr test in bionic/tests/dlfcn_test.cpp.
so here deleted it for cleaning up
Change-Id: I99c3d1d2252b41c7484310fa20a1298d80ad565c
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bionic/libc/Android.mk | 19 | ||||
-rw-r--r-- | tests/bionic/libc/common/test_dlopen_null.c | 37 |
2 files changed, 0 insertions, 56 deletions
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk index 647c1417..255fde58 100644 --- a/tests/bionic/libc/Android.mk +++ b/tests/bionic/libc/Android.mk @@ -97,25 +97,6 @@ LOCAL_MODULE_TAGS := tests LOCAL_LDFLAGS := -static include $(BUILD_HOST_EXECUTABLE) -# The 'test_dlopen_null' tests requires specific linker flags -# -# The -Wl,--export-dynamic ensures that dynamic symbols are -# exported from the executable. -# -# -Wl,-u,foo is used to ensure that symbol "foo" is not -# garbage-collected by the gold linker, since the function -# appears to be unused. -# -sources := common/test_dlopen_null.c \ - -EXTRA_LDLIBS := -ldl -Wl,--export-dynamic -Wl,-u,foo -EXTRA_CFLAGS := -DHOST -$(call host-test, $(sources)) - -EXTRA_LDLIBS := -ldl -Wl,--export-dynamic -Wl,-u,foo -$(call device-test, $(sources)) - - # Second, the Bionic-specific tests sources := \ diff --git a/tests/bionic/libc/common/test_dlopen_null.c b/tests/bionic/libc/common/test_dlopen_null.c deleted file mode 100644 index 42b23dd3..00000000 --- a/tests/bionic/libc/common/test_dlopen_null.c +++ /dev/null @@ -1,37 +0,0 @@ -#include <dlfcn.h> -#include <stddef.h> -#include <stdio.h> - -extern int foo(void) -{ - return 42; -} - -int (*func_ptr)(void) = foo; - -int main(void) -{ - void* lib = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); - void* symbol; - -#if 0 - /* The Gold linker will garbage-collect unused global functions - * even if --Wl,--export-dynamic is used. So use a dummy global - * variable reference here to prevent this. - */ - if (foo() != 42) - return 3; -#endif - - if (lib == NULL) { - fprintf(stderr, "Could not open self-executable with dlopen(NULL) !!: %s\n", dlerror()); - return 1; - } - symbol = dlsym(lib, "foo"); - if (symbol == NULL) { - fprintf(stderr, "Could not lookup symbol inside executable !!: %s\n", dlerror()); - return 2; - } - dlclose(lib); - return 0; -} |