about summary refs log tree commit diff
path: root/src/rt/rust_test_helpers.c
AgeCommit message (Collapse)AuthorLines
2018-02-24Remove directory `src/rt`Vadim Petrochenkov-286/+0
2017-01-27Use __SIZEOF_INT128__ to test __int128 presenceSimonas Kazlauskas-1/+1
Previously we tested whether a handful of preprocessor variables indicating certain 64 bit platforms, but this does not work for other 64 bit targets which have support for __int128 in C compiler. Use the __SIZEOF__INT128__ preprocessor variable instead. This variable gets set to 16 by gcc and clang for every target where __int128 is supported.
2017-01-16Fix UB in test helpersSimonas Kazlauskas-4/+1
Macro expansion producing defined has undefined behavior in C/C++.
2017-01-04Add test for i128 ffi usageest31-0/+19
2016-09-03Address comments and add requested testsVadim Petrochenkov-0/+21
2016-04-04Handle integer-extending for C ABIJames Miller-0/+4
We need to supply sext/zext attributes to LLVM to ensure that arguments are extended to the appropriate width in the correct way. Most platforms extend integers less than 32 bits, though not all.
2016-02-05Abort on stack overflow instead of re-raising SIGSEGVBrian Campbell-0/+5
We use guard pages that cause the process to abort to protect against undefined behavior in the event of stack overflow. We have a handler that catches segfaults, prints out an error message if the segfault was due to a stack overflow, then unregisters itself and returns to allow the signal to be re-raised and kill the process. This caused some confusion, as it was unexpected that safe code would be able to cause a segfault, while it's easy to overflow the stack in safe code. To avoid this confusion, when we detect a segfault in the guard page, abort instead of the previous behavior of re-raising the SIGSEGV. To test this, we need to adapt the tests for segfault to actually check the exit status. Doing so revealed that the existing test for segfault behavior was actually invalid; LLVM optimizes the explicit null pointer reference down to an illegal instruction, so the program aborts with SIGILL instead of SIGSEGV and the test didn't actually trigger the signal handler at all. Use a C helper function to get a null pointer that LLVM can't optimize away, so we get our segfault instead. This is a [breaking-change] if anyone is relying on the exact signal raised to kill a process on stack overflow. Closes #31273
2016-01-19[MIR] Implement extern call supportSimonas Kazlauskas-0/+16
2015-10-14Add test case for #28676.Peter Marheine-0/+4
2015-05-19rt: Clean up to build with cl.exeAlex Crichton-0/+3
* Detect the #define _MSC_VER in addition to __WIN32__ * Don't include valgrind.h for windows * Remove unused `rust_valgrind_stack_{un,}register` functions * Add stub definition for `rust_running_on_valgrind` for windows * Conditionally define `rust_dbg_extern_empty_struct` as empty structures are not allowed by cl.exe apparently.
2015-05-12Very hacky MSVC hacks.Ricky Taylor-3/+1
Conflicts: mk/platform.mk src/librustc/session/config.rs src/librustc_back/target/aarch64_apple_ios.rs src/librustc_back/target/aarch64_linux_android.rs src/librustc_back/target/arm_linux_androideabi.rs src/librustc_back/target/arm_unknown_linux_gnueabi.rs src/librustc_back/target/arm_unknown_linux_gnueabihf.rs src/librustc_back/target/armv7_apple_ios.rs src/librustc_back/target/armv7s_apple_ios.rs src/librustc_back/target/i386_apple_ios.rs src/librustc_back/target/i686_apple_darwin.rs src/librustc_back/target/i686_pc_windows_gnu.rs src/librustc_back/target/i686_unknown_dragonfly.rs src/librustc_back/target/i686_unknown_linux_gnu.rs src/librustc_back/target/mips_unknown_linux_gnu.rs src/librustc_back/target/mipsel_unknown_linux_gnu.rs src/librustc_back/target/mod.rs src/librustc_back/target/powerpc_unknown_linux_gnu.rs src/librustc_back/target/x86_64_apple_darwin.rs src/librustc_back/target/x86_64_apple_ios.rs src/librustc_back/target/x86_64_pc_windows_gnu.rs src/librustc_back/target/x86_64_unknown_dragonfly.rs src/librustc_back/target/x86_64_unknown_freebsd.rs src/librustc_back/target/x86_64_unknown_linux_gnu.rs src/librustc_back/target/x86_64_unknown_openbsd.rs src/librustc_llvm/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/trans/base.rs src/libstd/os.rs src/rustllvm/RustWrapper.cpp
2014-06-21Add missing attributes to indirect calls for foreign functionsBjörn Steinbrink-0/+18
When calling a foreign function, some arguments and/or return value attributes are required to conform to the foreign ABI. Currently those attributes are only added to the declaration of foreign functions. With direct calls, this is no problem, because LLVM can see that those attributes apply to the call. But with an indirect call, LLVM cannot do that and the attribute is missing. To fix that, we have to add those attribute to the calls to foreign functions as well. This also allows to remove the special handling of the SRet attribute, which is ABI-dependent and will be set via the `attr` field of the return type's `ArgType`.
2014-03-19rustc: Fix x86 ffi for empty struct argumentsklutzy-0/+23
2013-12-24Remove rust_globals.hBrian Anderson-1/+2
2013-11-18Move runtime files to C instead of C++Alex Crichton-0/+177
Explicitly have the only C++ portion of the runtime be one file with exception handling. All other runtime files must now live in C and be fully defined in C.