From fbd48b8e223c241322b7bd2fc44eeca19a2f6efc Mon Sep 17 00:00:00 2001 From: John Holdsworth Date: Mon, 10 Jul 2017 00:52:32 +0100 Subject: [PATCH] [stdlib] Temporary fix to getSectionInfo() for Android [stdlib] Temporary fix to getSectionInfo() for Android Update comment Conformance logging on Linux Remove compile warning Revert "Conformance logging on Linux" This reverts commit 3db6c01a017512484a4db3eeefc6afafaec4fad3. --- stdlib/public/runtime/ImageInspectionELF.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/public/runtime/ImageInspectionELF.cpp b/stdlib/public/runtime/ImageInspectionELF.cpp index 54fb1230715b3..f54f8cf1d5212 100644 --- a/stdlib/public/runtime/ImageInspectionELF.cpp +++ b/stdlib/public/runtime/ImageInspectionELF.cpp @@ -68,8 +68,14 @@ static SectionInfo getSectionInfo(const char *imageName, SectionInfo sectionInfo = { 0, nullptr }; void *handle = dlopen(imageName, RTLD_LAZY | RTLD_NOLOAD); if (!handle) { + #ifdef __ANDROID__ + // https://bugs.swift.org/browse/SR-5414 + // The dlopen can fail once on Android so for now, return an empty struct. + return sectionInfo; + #else fatalError(/* flags = */ 0, "dlopen() failed on `%s': %s", imageName, dlerror()); + #endif } void *symbol = dlsym(handle, sectionName); if (symbol) {