SuccessChanges

Summary

  1. [update_cc_test_checks.py] Add test for D84511 (details)
  2. Fix qsort() interceptor for FreeBSD (details)
  3. [lit] Remove ANSI control characters from xunit output (details)
  4. [compiler-rt] Fix build of Sanitizer-Test_Nolibc after D80648 (details)
  5. [DWARFYAML][debug_info] Pull out dwarf::FormParams from DWARFYAML::Unit. (details)
Commit e150d2cab8688a2b3b7d395bfbbc152b08df9033 by Alexander.Richardson
[update_cc_test_checks.py] Add test for D84511

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D85115
The file was modifiedclang/test/utils/update_cc_test_checks/basic-cplusplus.test (diff)
The file was modifiedclang/test/utils/update_cc_test_checks/lit.local.cfg (diff)
Commit 8803ebcf3b562172687321318c423f39f22b2e5b by Alexander.Richardson
Fix qsort() interceptor for FreeBSD

When the FreeBSD qsort() implementation recurses, it does so using an
interposable function call, so we end up calling the interceptor again
and set the saved comparator to wrapped_qsort_compar. This results in an
infinite loop and a eventually a stack overflow since wrapped_qsort_compar
ends up calling itself. This means that ASAN is completely broken on
FreeBSD for programs that call qsort(). I found this while running
check-all on a FreeBSD system a ASAN-instrumented LLVM.

Fix this by checking whether we are recursing inside qsort before writing
to qsort_compar. The same bug exists in the qsort_r interceptor, so use the
same approach there. I did not test the latter since the qsort_r function
signature does not match and therefore it's not intercepted on FreeBSD/macOS.

Fixes https://llvm.org/PR46832

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D84509
The file was addedcompiler-rt/test/sanitizer_common/TestCases/Posix/recursion-in-qsort.cpp
The file was modifiedcompiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc (diff)
Commit 3b3cdcc7a557a7dbd53e9e8cc311247d6df46c5c by Alexander.Richardson
[lit] Remove ANSI control characters from xunit output

Failing test output sometimes contains control characters like \x1b (e.g.
if there was some -fcolor-diagnostics output) which are not allowed inside
XML files. This causes problems with CI systems: for example, the Jenkins
JUnit XML will throw an exception when ecountering those characters and
similar problems also occur with GitLab CI.

Reviewed By: yln, jdenny

Differential Revision: https://reviews.llvm.org/D84233
The file was modifiedllvm/utils/lit/lit/reports.py (diff)
The file was addedllvm/utils/lit/tests/Inputs/shtest-format/external_shell/fail_with_control_chars.txt
The file was addedllvm/utils/lit/tests/Inputs/shtest-format/external_shell/write-control-chars.py
The file was modifiedllvm/utils/lit/tests/shtest-format.py (diff)
Commit 6148cca70888ead020a808279043fd013ca72a2a by Alexander.Richardson
[compiler-rt] Fix build of Sanitizer-Test_Nolibc after D80648

Running ninja check-sanitizer fails for after that patch (commit
058f5f6fd813d1ee1480497394d6fd44e65ec62b) with the following error:

libRTSanitizerCommon.test.nolibc.x86_64.a(sanitizer_posix.cpp.o): In
function `__sanitizer::GetNamedMappingFd(char const*, unsigned long,
int*)':
..../llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp:358:
undefined reference to `fcntl'
clang-12: error: linker command failed with exit code 1 (use -v to see
invocation)

This patch works around the problem by only calling fcntl if O_CLOEXEC
is not defined.

Reviewed By: plopresti

Differential Revision: https://reviews.llvm.org/D85114
The file was modifiedcompiler-rt/lib/sanitizer_common/sanitizer_posix.cpp (diff)
Commit 4357986b411dd164932c66ebfe4a9cf96a7d74cd by Xing
[DWARFYAML][debug_info] Pull out dwarf::FormParams from DWARFYAML::Unit.

Unit.Format, Unit.Version and Unit.AddrSize are replaced with
dwarf::FormParams in D84496 to get rid of unnecessary functions
getOffsetSize() and getRefSize(). However, that change makes it
difficult to make AddrSize optional (Optional<uint8_t>). This change
pulls out dwarf::FormParams from DWARFYAML::Unit and use it as a helper
struct in DWARFYAML::emitDebugInfo().

Reviewed By: jhenderson, MaskRay

Differential Revision: https://reviews.llvm.org/D85296
The file was modifiedllvm/lib/ObjectYAML/DWARFYAML.cpp (diff)
The file was modifiedllvm/tools/obj2yaml/dwarf2yaml.cpp (diff)
The file was modifiedllvm/include/llvm/ObjectYAML/DWARFYAML.h (diff)
The file was modifiedllvm/lib/ObjectYAML/DWARFEmitter.cpp (diff)