rust/src/test/run-make
bors 2652ce6771 Auto merge of #42711 - Firstyear:san-on-dylib, r=alexcrichton
Add support for dylibs with Address Sanitizer

Many applications use address sanitizer to assert correct behaviour of their programs. When using Rust with C, it's much more important to assert correct programs with tools like asan/lsan due to the unsafe nature of the access across an ffi boundary. However, previously only rust bin types could use asan. This posed a challenge for existing C applications that link or dlopen .so when the C application is compiled with asan.

This PR enables asan to be linked to the dylib and cdylib crate type. We alter the test to check the proc-macro crate does not work with -Z sanitizer=address. Finally, we add a test that compiles a shared object in rust, then another rust program links it and demonstrates a crash through the call to the library.

This PR is nearly complete, but I do require advice on the change to fix the -lasan that currently exists in the dylib test. This is required because the link statement is not being added correctly to the rustc build when -Z sanitizer=address is added (and I'm not 100% sure why)

Thanks,
2017-07-17 17:02:18 +00:00
..
a-b-a-linker-guard document test, don't use grep 2016-03-25 14:07:20 -04:00
alloc-extern-crates std: Stabilize APIs for the 1.6 release 2015-12-05 15:09:44 -08:00
allow-non-lint-warnings-cmdline Remove empty test files 2015-09-17 12:04:34 -04:00
allow-warnings-cmdline-stability Remove all uses of #[staged_api] 2015-11-25 21:55:26 +03:00
archive-duplicate-names rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
atomic-lock-free fix atomic_lock_free test case 2017-05-22 17:11:39 -04:00
bare-outfile Fix run-make/bare-outfile test 2015-10-03 17:20:45 -04:00
c-dynamic-dylib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
c-dynamic-rlib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
c-link-to-rust-dylib Fix test fallout 2016-01-16 12:35:00 -05:00
c-link-to-rust-staticlib Fix test fallout 2016-01-16 12:35:00 -05:00
c-static-dylib Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
c-static-rlib Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
cdylib run-make on MSVC: Do not generate object files in the source directory 2017-03-04 21:38:26 +03:00
codegen-options-parsing Disable ICF opt of MSVC for non-opt build 2016-12-04 23:55:24 +11:00
compile-stdin Add a test that rustc can compile standard input 2015-10-01 23:28:01 -04:00
compiler-lookup-paths Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
compiler-lookup-paths-2 rustc: Fix a leak in dependency= paths 2015-01-16 08:48:16 -08:00
compiler-rt-works-on-mingw Build compiler-rt/builtins with MSVC 2015-11-04 11:43:41 +08:00
crate-data-smoke rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
crate-name-priority rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
debug-assertions Enable the overflow-related tests for MIR 2016-06-05 14:02:24 +03:00
dep-info rustc: Emit phony targets for inputs in dep-info 2015-10-02 09:33:06 -07:00
dep-info-doesnt-run-much rustc: Exit quickly on only --emit dep-info 2017-03-10 08:18:24 -08:00
dep-info-spaces test: Don't write files into the source tree 2016-10-14 12:48:53 -07:00
duplicate-output-flavors Deduplicate --crate-type arguments 2015-02-09 19:51:21 +02:00
dylib-chain rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
emit Add opt-level=s and opt-level=z tests to the existing tests that confirm proper 2016-04-28 23:08:30 -07:00
error-found-staticlib-instead-crate Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
error-writing-dependencies rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
extern-diff-internal-name rustc: Turn off multiple versions of crate warning 2015-01-06 08:22:59 -08:00
extern-flag-disambiguates Use assert_eq! instead of assert! in tests 2015-06-13 14:55:55 +03:00
extern-flag-fun Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
extern-fn-generic Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
extern-fn-mangle rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
extern-fn-reachable std: Clean out deprecated APIs 2016-03-12 12:31:13 -08:00
extern-fn-struct-passing-abi rustc_trans: do not treat byval as using up registers. 2017-04-19 02:22:59 +03:00
extern-fn-with-packed-struct fix UB in repr(packed) tests 2017-03-08 21:19:31 +01:00
extern-fn-with-union Get tests working on MSVC 32-bit 2016-01-29 16:25:21 -08:00
extern-multiple-copies rustc: Fix extern crate being order dependent 2015-11-20 10:58:38 -08:00
extern-multiple-copies2 rustc: Fix again order-dependence in extern crate 2016-05-20 14:03:47 -07:00
extern-overrides-distribution Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
extra-filename-with-temp-outputs msvc: Get codegen-units working 2015-07-07 20:07:20 -07:00
fpic Don't run test on darwin 2017-03-01 08:08:53 -08:00
include_bytes_deps Added a test for include_bytes! dep info 2015-04-15 10:40:04 -04:00
interdependent-c-libraries Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
intrinsic-unreachable Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
invalid-library rustc: Better error when loading invalid libraries 2014-03-01 23:36:28 -08:00
invalid-staticlib Don't ICE if an archive isn't actually an archive 2015-09-26 01:54:12 -04:00
issue-7349 Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
issue-11908 Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
issue-14500 Preserve public static items across LTO 2015-11-06 05:04:43 -05:00
issue-14698 Emit an error upon failing to create a temp dir instead of panicking 2015-09-16 13:52:02 -04:00
issue-15460 Remove the "linked_from" feature. 2016-12-01 16:56:49 -08:00
issue-18943 Add regression test for #18943 2015-05-02 15:22:27 +02:00
issue-19371 Remove rustc_llvm dependency from librustc 2017-05-15 11:13:30 +02:00
issue-20626 Add regression test for #20626 2015-05-07 00:25:54 +02:00
issue-22131 Add tested item in the rustdoc --test output 2017-02-11 16:36:31 +01:00
issue-24445 Add a reference to the dl library to the Makefile of the test issue-24445. 2017-03-01 12:17:27 +01:00
issue-25581 Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
issue-26006 Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
issue-26092 rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
issue-28595 rustc: Swap link order of native libs/rust deps 2015-09-30 20:17:54 -07:00
issue-28766 Translate zero-sized return types as void 2016-01-15 18:29:29 +01:00
issue-30063 regression test for issue #30063 2015-12-08 05:39:00 +01:00
issue-33329 add include ../tools.mk to the Makefile 2016-07-25 01:23:10 -05:00
issue-37839 rustc: Stabilize the proc_macro feature 2017-01-02 12:13:30 -08:00
issue-37893 rustc: Stabilize the proc_macro feature 2017-01-02 12:13:30 -08:00
issue-38237 rustc: Stabilize the proc_macro feature 2017-01-02 12:13:30 -08:00
issue-40535 Regression test for rust-lang/rust#40535 2017-03-21 16:34:56 -04:00
libs-and-bins Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
libs-through-symlinks fix tests & rustdoc 2015-11-26 18:22:40 +02:00
link-arg add a test 2016-09-19 15:21:32 -05:00
link-cfg rustc: Implement #[link(cfg(..))] and crt-static 2016-11-16 07:00:09 -08:00
link-path-order Annotate more tests with kind="static" 2016-12-05 16:40:43 -08:00
linkage-attr-on-static rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
linker-output-non-utf8 Add a regression test for #29122 (fixed in #29134) 2015-10-23 17:11:33 -04:00
llvm-pass Fix run-make/llvm-pass 2017-05-15 15:09:05 +02:00
llvm-phase report the total number of errors on compilation failure 2017-07-02 16:16:44 +03:00
ls-metadata Move --ls behind -Z ls 2014-04-16 17:45:06 +02:00
lto-no-link-whole-rlib trans: Don't link whole rlibs to executables 2016-02-14 11:45:59 -08:00
lto-readonly-lib rustc: Fix permission denied error in 'ar' when lto is enabled 2014-09-29 15:07:14 +02:00
lto-smoke Move -Z lto to -C lto. 2014-09-21 02:17:31 -04:00
lto-smoke-c Fix test fallout 2016-01-16 12:35:00 -05:00
manual-crate-name rustc: Repurpose the --crate-name CLI flag 2014-07-05 12:46:42 -07:00
manual-link Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
many-crates-but-no-match Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
metadata-flag-frobs-symbols Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
mismatching-target-triples syntax: Implement #![no_core] 2015-08-03 17:23:01 -07:00
missing-crate-dependency Turn on new errors, json mode. Remove duplicate unicode test 2016-08-07 07:46:49 -07:00
mixing-deps Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
mixing-formats Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
mixing-libs Refactoring: Introduce distinct host and target rpath var setters. 2014-05-18 22:56:26 +02:00
multiple-emits Properly adjust filenames when multiple emissions 2017-04-05 19:02:25 +03:00
no-builtins-lto test that a no_builtins crate is passed to the linker 2016-08-15 18:24:14 -05:00
no-duplicate-libs rustc: Implement the #[global_allocator] attribute 2017-07-05 14:37:01 -07:00
no-intermediate-extras Remove workaround of #13793/#10872 2014-08-18 13:45:08 +09:00
obey-crate-type-flag Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
output-type-permutations Fix test fallout 2016-01-16 12:35:00 -05:00
output-with-hyphens rustc: Remove support for hyphens in crate names 2015-03-27 10:19:59 -07:00
prefer-dylib rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
prefer-rlib extern mod => extern crate 2014-02-14 22:55:21 -08:00
pretty-expanded Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
pretty-expanded-hygiene Refactor out ast::ItemKind::MacroDef. 2017-03-10 08:08:32 -08:00
pretty-print-path-suffix hir: lower ImplicitSelf to resolved Self TyQPath's. 2016-12-28 11:21:45 +02:00
pretty-print-to-file rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
print-cfg Test target feature computation 2016-04-09 00:41:23 +02:00
print-target-list rustc: add a --print target-list command 2016-02-12 10:39:19 -05:00
profile Run profiler test only if built with profiler support 2017-06-04 19:05:03 +01:00
prune-link-args test: Fix run-make on windows 2014-04-28 11:45:30 +09:00
relocation-model Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime. 2016-03-25 14:07:19 -04:00
reproducible-build check only that symbol names are deterministic 2016-03-25 14:07:20 -04:00
rlib-chain Use new attribute syntax in python files in src/etc too (#13478) 2014-04-14 21:00:31 +05:30
rustc-macro-dep-files rustc: Stabilize the proc_macro feature 2017-01-02 12:13:30 -08:00
rustdoc-output-path rustdoc: Use create_dir_all to create output directory 2017-06-09 23:03:08 +01:00
sanitizer-address Add support for dylibs with Address Sanitizer. This supports cdylibs and staticlibs on gnu-linux targets. 2017-07-15 08:22:46 +10:00
sanitizer-cdylib-link Add support for dylibs with Address Sanitizer. This supports cdylibs and staticlibs on gnu-linux targets. 2017-07-15 08:22:46 +10:00
sanitizer-dylib-link Add support for dylibs with Address Sanitizer. This supports cdylibs and staticlibs on gnu-linux targets. 2017-07-15 08:22:46 +10:00
sanitizer-invalid-cratetype Add support for dylibs with Address Sanitizer. This supports cdylibs and staticlibs on gnu-linux targets. 2017-07-15 08:22:46 +10:00
sanitizer-invalid-target Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin. 2017-04-25 10:31:01 +08:00
sanitizer-leak Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin. 2017-04-25 10:31:01 +08:00
sanitizer-memory Support AddressSanitizer and ThreadSanitizer on x86_64-apple-darwin. 2017-04-25 10:31:01 +08:00
sanitizer-staticlib-link Add support for dylibs with Address Sanitizer. This supports cdylibs and staticlibs on gnu-linux targets. 2017-07-15 08:22:46 +10:00
save-analysis Remove the in-tree flate crate 2017-06-20 07:11:29 -07:00
save-analysis-fail Remove the in-tree flate crate 2017-06-20 07:11:29 -07:00
sepcomp-cci-copies Rollup merge of #23803 - richo:unused-braces, r=Manishearth 2015-03-28 18:12:06 +05:30
sepcomp-inlining Refactor symbol export list generation. 2016-12-05 11:05:25 -05:00
sepcomp-separate Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
simd-ffi Update #[no_core] users with the "freeze" lang item. 2017-04-21 15:48:35 +03:00
simple-dylib rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
simple-rlib extern mod => extern crate 2014-02-14 22:55:21 -08:00
stable-symbol-names trans: Treat generics like regular functions, not like #[inline] functions during CGU partitioning. 2017-01-09 10:06:58 -05:00
static-dylib-by-default Fix test fallout 2016-01-16 12:35:00 -05:00
static-nobundle Don't link "nobundle" libs which had already been included in upstream crate. 2017-02-03 18:25:45 -08:00
static-unwinding Utilize Result::unwrap_err in more places. 2016-05-09 08:40:57 -04:00
staticlib-blank-lib rustc: Add knowledge of separate lookup paths 2014-12-23 10:08:17 -08:00
suspicious-library rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
symbol-visibility Make symbol-visibility test case work on all platforms. 2016-12-05 11:05:25 -05:00
symbols-are-reasonable Adapt rmake-test to new naming scheme for internal symbols. 2016-10-24 11:07:45 -04:00
symbols-include-type-name Include type name in symbol for methods 2015-12-12 00:01:08 +09:00
symlinked-extern Properly canonicalize crate paths specified via --extern 2014-08-15 14:40:09 +02:00
symlinked-libraries rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
symlinked-rlib Added a test 2016-04-08 17:14:05 -07:00
sysroot-crates-are-unstable Do not check if libclang_rt.?san_*_dynamic.dylib is an unstable crate. 2017-04-25 18:34:21 +08:00
target-cpu-native Add support for target-cpu=native 2015-03-10 01:56:51 +01:00
target-specs Update #[no_core] users with the "freeze" lang item. 2017-04-21 15:48:35 +03:00
target-without-atomics rustc -> $(RUSTC) in rmake test 2016-10-02 15:52:26 -05:00
test-harness Fix pre-cfg_attr notation in comment 2017-01-01 20:34:23 +01:00
type-mismatch-same-crate-name Replace grep -z by tr -d '\r\n' | grep for cross-compatibility 2017-06-29 20:07:51 +08:00
use-extern-for-plugins Add Illumos support 2016-01-31 18:57:26 +03:00
used don't pass -C to nm 2017-04-06 23:53:32 -05:00
version rustc: Start "stabilizing" some flags 2014-12-19 11:38:24 -08:00
volatile-intrinsics Add tests for read_volatile and write_volatile 2016-02-19 23:45:49 +00:00
weird-output-filenames Fix fallout of removing quotes in crate names 2015-03-27 11:43:40 -07:00
windows-spawn Add run-make test for Command::spawn on Windows 2017-06-05 17:57:32 +01:00
windows-subsystem rustc: Stabilize the #![windows_subsystem] attribute 2017-04-01 06:36:48 -07:00
tools.mk Reload nameserver information on lookup failure 2017-05-04 23:59:55 -04:00