Skip to content
  1. Jul 28, 2020
    • Julian Lettner's avatar
      [Darwin] Cleanup code via improved GetMacosAlignedVersion() · 12f27fc4
      Julian Lettner authored
      Checking the OS version via `GetMacosAlignedVersion()` now works in
      simulators [1].  Let's use it to simplify `DyldNeedsEnvVariable()`.
      
      [1] 3fb0de82
      
      Reviewed By: delcypher
      
      Differential Revision: https://reviews.llvm.org/D81197
      12f27fc4
    • Julian Lettner's avatar
      [Darwin] Fix OS version checks inside simulators · 3fb0de82
      Julian Lettner authored
      compiler-rt checks OS versions by querying the Darwin kernel version.
      This is not necessarily correct inside the simulators if the simulator
      runtime is not aligned with the host macOS.  Let's instead check the
      `SIMULATOR_RUNTIME_VERSION` env var.
      
      rdar://63031937
      
      Reviewed By: delcypher
      
      Differential Revision: https://reviews.llvm.org/D83977
      3fb0de82
    • Arthur Eubanks's avatar
      [CompilerRT] Don't pass global compile test flags in non-standalone build · 8b2fcc42
      Arthur Eubanks authored
      In a build with -DLLVM_ENABLE_LTO=Thin:
      
      $ ninja TSanitizer-x86_64-Test-Nolibc
      [1/1] Generating Sanitizer-x86_64-Test-Nolibc
      FAILED: projects/compiler-rt/lib/sanitizer_common/tests/Sanitizer-x86_64-Test-Nolibc
      sanitizer_nolibc_test_main.x86_64.o: file not recognized: file format not recognized
      
      because -flto=thin is getting passed to the clang_compile step.
      
      For non-standalone builds, global compilation flags shouldn't be passed to compiler-rt tests, only the flags the test specifies.
      
      Reviewed By: vitalybuka
      
      Differential Revision: https://reviews.llvm.org/D84466
      8b2fcc42
    • Rainer Orth's avatar
      [compiler-rt][cmake] Don't pass --version-script to Illumos ld · 443e734f
      Rainer Orth authored
      Neither the Illumos `ld` nor the Solaris 11.3 one support the `--version-script` and
      `z gnu-linker-script-compat` options, which breaks the `compiler-rt` build.
      
      This patch checks for both options instead of hardcoding their use.
      
      Tested on `amd-pc-solaris2.11` (all of Solaris 11.4, 11.3, and Illumos).
      
      Differential Revision: https://reviews.llvm.org/D84559
      443e734f
    • Hans Wennborg's avatar
      Avoid use of std::make_unique in compiler-rt/lib/scudo/standalone/tests/combined_test.cpp · 7e8d5a90
      Hans Wennborg authored
      make_unique is a C++14 feature, and this prevents us from building on
      Ubuntu Trusty. While we do use a C++14 compatible toolchain for building
      in general, we fall back to the system toolchain for building the
      compiler-rt tests.
      
      The reason is that those tests get cross-compiled for e.g. 32-bit and
      64-bit x86, and while the toolchain provides libstdc++ in those
      flavours, the resulting compiler-rt test binaries don't get RPATH set
      and so won't start if they're linked with that toolchain.
      
      We've tried linking the test binaries against libstdc++ statically, by
      passing COMPILER_RT_TEST_COMPILER_CFLAGS=-static-libstdc++. That mostly
      works, but some test targets append -lstdc++ to the compiler invocation.
      
      So, after spending way too much time on this, let's just avoid C++14
      here for now.
      7e8d5a90
  2. Jul 27, 2020
  3. Jul 26, 2020
  4. Jul 24, 2020
  5. Jul 23, 2020
    • Petr Hosek's avatar
      [CMake] Simplify CMake handling for zlib · 1d09ecf3
      Petr Hosek authored
      Rather than handling zlib handling manually, use find_package from CMake
      to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
      HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
      set to YES, which requires the distributor to explicitly select whether
      zlib is enabled or not. This simplifies the CMake handling and usage in
      the rest of the tooling.
      
      This is a reland of abb00753 with all followup changes and fixes that
      should address issues that were reported in PR44780.
      
      Differential Revision: https://reviews.llvm.org/D79219
      1d09ecf3
    • Matt Morehouse's avatar
      Reland "[DFSan] Handle fast16labels for all API functions." · c6f21424
      Matt Morehouse authored
      Support fast16labels in `dfsan_has_label`, and print an error for all
      other API functions.  For `dfsan_dump_labels` we return silently rather
      than crashing since it is also called from the atexit handler where it
      is undefined behavior to call exit() again.
      
      Reviewed By: kcc
      
      Differential Revision: https://reviews.llvm.org/D84215
      c6f21424
    • Peter Collingbourne's avatar
    • Mitch Phillips's avatar
      [libFuzzer] Expose fuzzer::FuzzerDriver() · 22a376e7
      Mitch Phillips authored
      Summary:
      Allows other-language libFuzzer derivatives to invoke the driver.
      
      Patch By: Ian Eldred Pudney <ipudney@google.com>
      
      Reviewers: morehouse, kcc
      
      Reviewed By: morehouse
      
      Subscribers: #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D84425
      22a376e7
    • Matt Morehouse's avatar
      Revert "[DFSan] Handle fast16labels for all API functions." · df441c90
      Matt Morehouse authored
      This reverts commit 19d9c039 due to
      buildbot failure.
      df441c90
    • Dokyung Song's avatar
      [libFuzzer] Disable interceptor tests on non-Linux platforms. · 769dab20
      Dokyung Song authored
      Summary: libFuzzer's interceptor support added in 831ae45e currently only works on Linux. This patch disables the test cases added as part of that commit on non-Linux platforms.
      
      Reviewers: morehouse, hctim
      
      Subscribers: #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D84434
      769dab20
    • Gui Andrade's avatar
      0edc1350
    • Dokyung Song's avatar
      Recommit "[libFuzzer] Link libFuzzer's own interceptors when other compiler... · 831ae45e
      Dokyung Song authored
      Recommit "[libFuzzer] Link libFuzzer's own interceptors when other compiler runtimes are not linked."
      
      Summary: libFuzzer intercepts certain library functions such as memcmp/strcmp by defining weak hooks. Weak hooks, however, are called only when other runtimes such as ASan is linked. This patch defines libFuzzer's own interceptors, which is linked into the libFuzzer executable when other runtimes are not linked, i.e., when -fsanitize=fuzzer is given, but not others.
      
      The patch once landed but was reverted in 8ef9e2bf due to an assertion failure caused by calling an intercepted function, strncmp, while initializing the interceptors in fuzzerInit(). This issue is now fixed by calling libFuzzer's own implementation of library functions (i.e., internal_*) when the fuzzer has not been initialized yet, instead of recursively calling fuzzerInit() again.
      
      Reviewers: kcc, morehouse, hctim
      
      Subscribers: #sanitizers, krytarowski, mgorny, cfe-commits
      
      Tags: #clang, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D83494
      831ae45e
    • Matt Morehouse's avatar
      84980b13
    • Rainer Orth's avatar
      [compiler-rt][sanitizers] Fix Solaris madvise declaration · 55c0f12a
      Rainer Orth authored
      A last-minute silent change in  D84046 <https://reviews.llvm.org/D84046> broke the Solaris buildbots (Solaris/sparcv9 <http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/6772>, Solaris/amd64 <http://lab.llvm.org:8014/builders/clang-solaris11-amd64/builds/5434>):
      
        [2/3679] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o
        FAILED: projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o
        /opt/llvm-buildbot/bin/c++  -DHAVE_RPC_XDR_H=1 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/sanitizer_common -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common -Iinclude -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/include/llvm/Support/Solaris -I/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3     -m32 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -Wframe-larger-than=570 -UNDEBUG -std=c++14 -MD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.sparc.dir/sanitizer_posix_libcdep.cpp.o -c /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
        /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:50:16: error: conflicting declaration of C function ‘int madvise(caddr_t, std::size_t, int)’
         extern "C" int madvise(caddr_t, size_t, int);
                        ^~~~~~~
        In file included from /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp:32:0:
        /usr/include/sys/mman.h:232:12: note: previous declaration ‘int madvise(void*, std::size_t, int)’
         extern int madvise(void *, size_t, int);
                    ^~~~~~~
      
      This patch undoes that change.
      
      Tested on `amd64-pc-solaris2.11` (Solaris 11.4 and OpenIndiana).
      
      Differential Revision: https://reviews.llvm.org/D84388
      55c0f12a
    • Fangrui Song's avatar
      [PGO] Don't call calloc(0, sizeof(ValueProfNode *)) · 99ad956f
      Fangrui Song authored
      A malloc implementation may return a pointer to some allocated space.  It is
      undefined for libclang_rt.profile- to access the object - which actually happens
      in instrumentTargetValueImpl, where ValueCounters[CounterIndex] may access a
      ValueProfNode (from another allocated object) and crashes when the code accesses
      the object referenced by CurVNode->Next.
      99ad956f
    • Logan Smith's avatar
      Reapply "Try enabling -Wsuggest-override again, using add_compile_options... · 77e0e9e1
      Logan Smith authored
      Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
      
      add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.
      
      Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
      77e0e9e1
    • Matt Morehouse's avatar
      [DFSan] Handle fast16labels for all API functions. · 19d9c039
      Matt Morehouse authored
      Summary:
      Support fast16labels in `dfsan_has_label`, and print an error for all
      other API functions.
      
      Reviewers: kcc, vitalybuka, pcc
      
      Reviewed By: kcc
      
      Subscribers: jfb, llvm-commits, #sanitizers
      
      Tags: #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D84215
      19d9c039
    • Fangrui Song's avatar
      Revert D81682 "[PGO] Extend the value profile buckets for mem op sizes." · 27650ec5
      Fangrui Song authored
      This reverts commit 4a539faf.
      
      There is a __llvm_profile_instrument_range related crash in PGO-instrumented clang:
      
      ```
      (gdb) bt
      llvm::ConstantRange const&, llvm::APInt const&, unsigned int, bool) ()
      llvm::ScalarEvolution::getRangeForAffineAR(llvm::SCEV const*, llvm::SCEV
      const*, llvm::SCEV const*, unsigned int) ()
      ```
      
      (The body of __llvm_profile_instrument_range is inlined, so we can only find__llvm_profile_instrument_target in the trace)
      
      ```
       23│    0x000055555dba0961 <+65>:    nopw   %cs:0x0(%rax,%rax,1)
       24│    0x000055555dba096b <+75>:    nopl   0x0(%rax,%rax,1)
       25│    0x000055555dba0970 <+80>:    mov    %rsi,%rbx
       26│    0x000055555dba0973 <+83>:    mov    0x8(%rsi),%rsi  # %rsi=-1 -> SIGSEGV
       27│    0x000055555dba0977 <+87>:    cmp    %r15,(%rbx)
       28│    0x000055555dba097a <+90>:    je     0x55555dba0a76 <__llvm_profile_instrument_target+342>
      ```
      27650ec5
    • Logan Smith's avatar
      Revert "Try enabling -Wsuggest-override again, using add_compile_options... · 97a0f80c
      Logan Smith authored
      Revert "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
      
      This reverts commit 388c9fb1.
      97a0f80c
  6. Jul 22, 2020
Loading