Page MenuHomePhabricator

[Clang] Force rtlib=platform in test to avoid fails with CLANG_DEFAULT_RTLIB

Authored by kristina on Jan 5 2020, 4:24 PM.



Driver test cross-linux.c fails when CLANG_DEFAULT_RTLIB is "compiler-rt"
as the it expects a GCC-style "crtbegin.o" after "crti.o" but instead
receives something akin to this in the frontend invocation:

"crt1.o" "crti.o" "/o/b/llvm-test/v10.0.4010/bin/../lib/clang/10.0.4010/lib/linux/clang_rt.crtbegin-x86_64.o"

In lib/Driver/ToolChain.cpp it's implied that using --rtlib=platform is
acceptable in tests to override the configuration-time default.

// Only use "platform" in tests to override CLANG_DEFAULT_RTLIB
// ...
else if (LibName == "platform")
  return GetDefaultRuntimeLibType();

This patch adds said override to cross-linux.c tests so the expected result
is produced regardless of the compile-time default rtlib, as having tests
fail due to that is fairly confusing. After applying the patch, the test passes
regardless of the CLANG_DEFAULT_RTLIB setting.

nb. Originally ran across this issue in D69758.

Diff Detail

Event Timeline

kristina created this revision.Jan 5 2020, 4:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2020, 4:24 PM

Unit tests: pass. 61250 tests passed, 0 failed and 736 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

This revision was not accepted when it landed; it landed in state Needs Review.Jan 5 2020, 11:30 PM
This revision was automatically updated to reflect the committed changes.