Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin #41352

Merged
merged 4 commits into from
Apr 26, 2017

Commits on Apr 25, 2017

  1. Pass --format-version 1 to cargo metadata.

    Suppress warning introduced by rust-lang/cargo#3841.
    kennytm committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    93d57d6 View commit details
    Browse the repository at this point in the history
  2. Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin.

    ASan and TSan are supported on macOS, and this commit enables their
    support.
    
    The sanitizers are always built as *.dylib on Apple platforms, so they
    cannot be statically linked into the corresponding `rustc_?san.rlib`. The
    dylibs are directly copied to `lib/rustlib/x86_64-apple-darwin/lib/`
    instead.
    
    Note, although Xcode also ships with their own copies of ASan/TSan dylibs,
    we cannot use them due to version mismatch.
    
    There is a caveat: the sanitizer libraries are linked as @rpath, so the
    user needs to additionally pass `-C rpath`:
    
        rustc -Z sanitizer=address -C rpath file.rs
                                   ^~~~~~~~
    
    Otherwise there will be a runtime error:
    
        dyld: Library not loaded: @rpath/libclang_rt.asan_osx_dynamic.dylib
          Referenced from: /path/to/executable
          Reason: image not found
        Abort trap: 6
    
    The next commit includes a temporary change in compiler to force the linker
    to emit a usable @rpath.
    kennytm committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    00dff0a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    86747a9 View commit details
    Browse the repository at this point in the history
  4. Do not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate.

    These are not even crates...
    kennytm committed Apr 25, 2017
    Configuration menu
    Copy the full SHA
    164fd69 View commit details
    Browse the repository at this point in the history