Merge "linker: add test for zero shstrndx"

This commit is contained in:
Treehugger Robot 2016-08-15 18:48:02 +00:00 committed by Gerrit Code Review
commit 21482db6e1
7 changed files with 19 additions and 8 deletions

View file

@ -16,13 +16,13 @@
include $(CLEAR_VARS)
LOCAL_MULTILIB := both
LOCAL_MODULE := $(module)
LOCAL_MODULE := $(bionic_tests_module)
LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES_arm := prebuilt-elf-files/arm/$(module)
LOCAL_SRC_FILES_arm64 := prebuilt-elf-files/arm64/$(module)
LOCAL_SRC_FILES_x86 := prebuilt-elf-files/x86/$(module)
LOCAL_SRC_FILES_x86_64 := prebuilt-elf-files/x86_64/$(module)
LOCAL_SRC_FILES_arm := prebuilt-elf-files/arm/$(bionic_tests_module)
LOCAL_SRC_FILES_arm64 := prebuilt-elf-files/arm64/$(bionic_tests_module)
LOCAL_SRC_FILES_x86 := prebuilt-elf-files/x86/$(bionic_tests_module)
LOCAL_SRC_FILES_x86_64 := prebuilt-elf-files/x86_64/$(bionic_tests_module)
include $(BUILD_PREBUILT)

View file

@ -20,13 +20,16 @@ LOCAL_PATH := $(call my-dir)
# https://github.com/google/kati/issues/83 is currently blocking it.
# Move prebuilt test elf-files to $(TARGET_OUT_NATIVE_TESTS)
module := libtest_invalid-rw_load_segment.so
bionic_tests_module := libtest_invalid-rw_load_segment.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
module := libtest_invalid-unaligned_shdr_offset.so
bionic_tests_module := libtest_invalid-unaligned_shdr_offset.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
module := libtest_invalid-zero_shentsize.so
bionic_tests_module := libtest_invalid-zero_shentsize.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
bionic_tests_module := libtest_invalid-zero_shstrndx.so
include $(LOCAL_PATH)/Android.build.prebuilt.mk
ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))

View file

@ -1178,4 +1178,12 @@ TEST(dlfcn, dlopen_invalid_zero_shentsize) {
ASSERT_SUBSTR(expected_dlerror.c_str(), dlerror());
}
TEST(dlfcn, dlopen_invalid_zero_shstrndx) {
std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shstrndx.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has invalid e_shstrndx";
ASSERT_STREQ(expected_dlerror.c_str(), dlerror());
}
#endif