summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2014-08-18 15:08:51 -0700
committerDmitriy Ivanov <dimitry@google.com>2014-08-18 15:11:50 -0700
commit9419420919ea846bbad5510850c7aaec95021648 (patch)
treebcda898be5833bed81e141643598f18cd8200fba /tests
parentd8e007695c755bba75b7243077271b6d655d818a (diff)
downloadbionic-9419420919ea846bbad5510850c7aaec95021648.zip
bionic-9419420919ea846bbad5510850c7aaec95021648.tar.gz
bionic-9419420919ea846bbad5510850c7aaec95021648.tar.bz2
Revert "Add support for protected local symbol lookup."
This reverts commit d97e9f546ea195686a78e539315b273393609b9e. Bug: 17107521 Change-Id: I2b81ce2b5a4a2d166133a2626e49d81b6aef3672
Diffstat (limited to 'tests')
-rw-r--r--tests/dlfcn_test.cpp19
-rw-r--r--tests/libs/Android.mk15
-rw-r--r--tests/libs/dlsym_local_symbol.map22
-rw-r--r--tests/libs/dlsym_local_symbol_private.cpp24
-rw-r--r--tests/libs/dlsym_local_symbol_public.cpp47
5 files changed, 0 insertions, 127 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 9bc2557..c2c9286 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -62,25 +62,6 @@ TEST(dlfcn, dlsym_in_self) {
ASSERT_EQ(0, dlclose(self));
}
-#if defined(__arm__)
-// This seems to be working only for arm.
-// Others platforms optimize LOCAL PROTECTED symbols.
-TEST(dlfcn, dlsym_local_symbol) {
- void* handle = dlopen("libtest_local_symbol.so", RTLD_NOW);
- ASSERT_TRUE(handle != NULL);
- dlerror();
- void* sym = dlsym(handle, "private_taxicab_number");
- ASSERT_TRUE(sym == NULL);
- ASSERT_STREQ("undefined symbol: private_taxicab_number", dlerror());
-
- uint32_t (*f)(void);
- f = reinterpret_cast<uint32_t (*)(void)>(dlsym(handle, "dlsym_local_symbol_get_taxicab_number_using_dlsym"));
- ASSERT_TRUE(f != NULL);
- ASSERT_EQ(1729U, f());
- dlclose(handle);
-}
-#endif
-
TEST(dlfcn, dlsym_with_dependencies) {
void* handle = dlopen("libtest_with_dependency.so", RTLD_NOW);
ASSERT_TRUE(handle != NULL);
diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk
index 7ed3e7b..75df539 100644
--- a/tests/libs/Android.mk
+++ b/tests/libs/Android.mk
@@ -115,21 +115,6 @@ build_target := SHARED_LIBRARY
include $(TEST_PATH)/Android.build.mk
# -----------------------------------------------------------------------------
-# Library used to test local symbol lookup
-# -----------------------------------------------------------------------------
-libtest_local_symbol_src_files := \
- dlsym_local_symbol_private.cpp \
- dlsym_local_symbol_public.cpp
-
-module := libtest_local_symbol
-build_target := SHARED_LIBRARY
-libtest_local_symbol_ldflags := -Wl,--version-script=$(LOCAL_PATH)/dlsym_local_symbol.map
-libtest_local_symbol_cppflags := -std=gnu++11
-libtest_local_symbol_shared_libraries_target := libdl
-build_type := target
-include $(TEST_PATH)/Android.build.mk
-
-# -----------------------------------------------------------------------------
# Library used by atexit tests
# -----------------------------------------------------------------------------
diff --git a/tests/libs/dlsym_local_symbol.map b/tests/libs/dlsym_local_symbol.map
deleted file mode 100644
index 58a2299..0000000
--- a/tests/libs/dlsym_local_symbol.map
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-LIBTEST_LOCAL_SYMBOL_1.0 {
- global:
- dlsym_local_symbol_get_taxicab_number;
- dlsym_local_symbol_get_taxicab_number_using_dlsym;
- local:
- *;
-};
diff --git a/tests/libs/dlsym_local_symbol_private.cpp b/tests/libs/dlsym_local_symbol_private.cpp
deleted file mode 100644
index 2587508..0000000
--- a/tests/libs/dlsym_local_symbol_private.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <stdio.h>
-
-// This symbol is declared local in
-// the linker version map: libdlsym_local_symbol.map.
-// It should not be visible from the outside.
-extern "C" const uint32_t __attribute__ ((visibility ("protected"))) private_taxicab_number = 1729;
diff --git a/tests/libs/dlsym_local_symbol_public.cpp b/tests/libs/dlsym_local_symbol_public.cpp
deleted file mode 100644
index d9da32a..0000000
--- a/tests/libs/dlsym_local_symbol_public.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <stdio.h>
-
-extern const uint32_t private_taxicab_number;
-
-extern "C" {
-uint32_t dlsym_local_symbol_get_taxicab_number();
-uint32_t dlsym_local_symbol_get_taxicab_number_using_dlsym();
-}
-
-uint32_t dlsym_local_symbol_get_taxicab_number() {
- return private_taxicab_number;
-}
-
-// Let's make sure that dlsym works correctly for local symbol
-uint32_t dlsym_local_symbol_get_taxicab_number_using_dlsym() {
- dlerror();
- uint32_t* ptr = reinterpret_cast<uint32_t*>(dlsym(RTLD_DEFAULT, "private_taxicab_number"));
- if (ptr == nullptr) {
- const char* dlerr = dlerror();
- if (dlerr != nullptr) {
- fprintf(stderr, "dlsym error: %s\n", dlerr);
- } else {
- fprintf(stderr, "dlsym returned NULL with no dlerror.\n");
- }
- return 0;
- }
-
- return *ptr;
-}