From afd1cd959e75eb8f62fcfc6b1c1124537a09b2f9 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 12 Jan 2018 18:31:30 +0100 Subject: [PATCH] Work around an NDK / Android bug. The NDK r16 sometimes generates binaries with the DF_1_PIE, which the runtime linker on Android N complains about. The next NDK revision should work around this but, in the meantime, strip its error out. https://github.com/android-ndk/ndk/issues/602 https://android-review.googlesource.com/c/platform/bionic/+/259790 https://android-review.googlesource.com/c/toolchain/binutils/+/571550 Change-Id: I99306d42f11179d5d19bd3f107a7386cc5c690db Reviewed-on: https://boringssl-review.googlesource.com/24884 Commit-Queue: Steven Valdez Reviewed-by: Steven Valdez CQ-Verified: CQ bot account: commit-bot@chromium.org --- ssl/test/runner/runner.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ssl/test/runner/runner.go b/ssl/test/runner/runner.go index 5f5e8c79..1f2a20a4 100644 --- a/ssl/test/runner/runner.go +++ b/ssl/test/runner/runner.go @@ -909,6 +909,17 @@ func lldbOf(path string, args ...string) *exec.Cmd { return exec.Command("xterm", xtermArgs...) } +func removeFirstLineIfSuffix(s, suffix string) string { + idx := strings.IndexByte(s, '\n') + if idx < 0 { + return s + } + if strings.HasSuffix(s[:idx], suffix) { + return s[idx+1:] + } + return s +} + var ( errMoreMallocs = errors.New("child process did not exhaust all allocation calls") errUnimplemented = errors.New("child process does not implement needed flags") @@ -1206,6 +1217,18 @@ func runTest(test *testCase, shimPath string, mallocNumToFail int64) error { stdout := strings.Replace(string(stdoutBuf.Bytes()), "\r\n", "\n", -1) stderr := strings.Replace(string(stderrBuf.Bytes()), "\r\n", "\n", -1) + // Work around an NDK / Android bug. The NDK r16 sometimes generates + // binaries with the DF_1_PIE, which the runtime linker on Android N + // complains about. The next NDK revision should work around this but, + // in the meantime, strip its error out. + // + // https://github.com/android-ndk/ndk/issues/602 + // https://android-review.googlesource.com/c/platform/bionic/+/259790 + // https://android-review.googlesource.com/c/toolchain/binutils/+/571550 + // + // Remove this after switching to the r17 NDK. + stderr = removeFirstLineIfSuffix(stderr, ": unsupported flags DT_FLAGS_1=0x8000001") + // Separate the errors from the shim and those from tools like // AddressSanitizer. var extraStderr string