Commit Graph

34 Commits

Author SHA1 Message Date
bors
38bd207626 Auto merge of #38482 - est31:i128, r=eddyb
i128 and u128 support

Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs.

Rebased version of  #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue...

[plugin-breaking-change]

cc #35118 (tracking issue)
2016-12-31 18:54:31 +00:00
est31
29e01af6a6 Fix iabs and add some more tests 2016-12-31 18:19:06 +01:00
Alex Crichton
a8535ce9d1 std: Don't build docs for misc facade crates
Retain the same behavior as stable.

Closes #38319
2016-12-30 10:00:33 -08:00
est31
6b359635ec Fix warning when compiling on 64 bit Linux
Code is much simpler now as well.
2016-12-30 15:19:51 +01:00
Simonas Kazlauskas
86ce3a2f7c Further and hopefully final Windows fixes 2016-12-30 15:19:50 +01:00
est31
ee6256b1ff More windows fixes 2016-12-30 15:17:30 +01:00
est31
9842d27e9c Fix build 2016-12-30 15:17:30 +01:00
Simonas Kazlauskas
5a853b0422 The windows special-cases only apply to x64 2016-12-30 15:17:30 +01:00
Simonas Kazlauskas
e0e53773e3 Fix a return type 2016-12-30 15:17:30 +01:00
est31
01dcb7fe6c Tidy 2016-12-30 15:17:29 +01:00
est31
c3e3bc0058 Fix another windows ABI mistake
...this time with the float intrinsics.
2016-12-30 15:17:29 +01:00
est31
d71223a6c5 intrinsics: try to return everything via {u,i}128ret to match LLVM
on suggestion by nagisa.
2016-12-30 15:17:29 +01:00
est31
ca73affe8d Tidy 2016-12-30 15:17:29 +01:00
est31
53ff50a94f Port to wrapping_* and unchecked_* operations
Otherwise, we codegen panic calls which create problems with debug assertions turned on.
2016-12-30 15:17:28 +01:00
est31
3be141f1b4 Remove unimplemented() function 2016-12-30 15:17:28 +01:00
est31
92e6c53a25 libcompiler_builtins: don't codegen dead code call to eh_personality
There was a linker error on 32 bit platforms with optimisations turned off,
complaining that there was an undefined reference to "rust_eh_personality",
when compiling the rustc_const_math as stage1 artifact.

Apparently the compiler_builtins crate includes a call to "rust_eh_personality".
If compiled for 64 bits, this call doesn't appear, which explains why the linker
error only happens on 32 bit platforms, and optimisations will get it removed
on 32 bit as well.

There were two origins of the call:
    1. A for loop where apparently the compiler wasn't sure
       whether next() could panic or not, and therefore generated a landing
       pad for the worst case. The minimal reproducible example is "for _ in 0..sr { }".
    2. A default impl of uabs where the compiler apparently wasn't sure either
       whether iabs() could panic or not. Many thanks to nagisa for
       contributing the fix.

This commit also puts extern "C" to the intrinsics, as this is generally a
good thing to do.
2016-12-30 15:17:28 +01:00
est31
3e2046214c Try to fix some things
* shift so that no panics are generated (otherwise results in linker error)
* no_std as insurance to not get into issues with errors like "cannot satisfy dependencies so `rustc_i128` only shows up once" (pure guessing here, but it doesn't hurt...)
2016-12-30 15:17:28 +01:00
est31
317810d4c4 Always use Rust based intrinsics on Windows
The check inside compiler-rt file int_types.h to #define CRT_HAS_128BIT
looks like:

 #if (defined(__LP64__) || defined(__wasm__)) && \
     !(defined(__mips__) && defined(__clang__))
 #define CRT_HAS_128BIT
 #endif

Windows uses LLP64 instead of LP64, so it doesn't ship with the C based
intrinsics.

Also, add libcompiler_builtins to the list of crates that may have platform
specific checks (like the ones we just added).
2016-12-30 15:17:28 +01:00
est31
13d49f5299 Fix warning on 64 bit 2016-12-30 15:17:28 +01:00
est31
2715367f08 intrinsics : uabs and iabs 2016-12-30 15:17:28 +01:00
est31
dc14a108ae Fix intrinsics and expand tests 2016-12-30 15:17:27 +01:00
est31
32d8d24159 Fix rebase fallout 2016-12-30 15:17:27 +01:00
Simonas Kazlauskas
5fd5d524b7 WIP intrinsics 2016-12-30 15:17:27 +01:00
Jeremy Soller
474eb6223b Do not build emutls on Redox 2016-12-22 22:01:15 -07:00
bors
5de15be5ec Auto merge of #38046 - rkruppe:fix-32bit-rustbuild, r=alexcrichton
Fix rustbuild on 32 bit Linux

This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)
2016-11-28 21:44:44 -06:00
Robin Kruppe
02249e813e Define VISIBILITY_HIDDEN when compiling compiler-rt
This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)
2016-11-28 12:23:57 +01:00
Ulrik Sverdrup
17cb7bdd83 rustbuild: Add bench = false to std shim crates 2016-11-26 00:26:44 +01:00
Alex Crichton
88b46460fa rustc: Flag all builtins functions as hidden
When compiling compiler-rt you typically compile with `-fvisibility=hidden`
which to ensure that all symbols are hidden in shared objects and don't show up
in symbol tables. This is important for these intrinsics being linked in every
crate to ensure that we're not unnecessarily bloating the public ABI of Rust
crates.

This should help allow the compiler-builtins project with Rust-defined builtins
start landing in-tree as well.
2016-11-12 10:46:15 -08:00
Brian Anderson
afa72b5dd6 Don't build any native compiler-builtin components for emscripten 2016-09-30 14:04:09 -07:00
Brian Anderson
3b49c60ab7 Remove stage0 hacks 2016-09-28 23:17:56 +00:00
Jake Goulding
cc8727e675 Report which required build-time environment variable is not set 2016-09-25 12:18:09 -04:00
Alex Crichton
848cfe20a0 Link test to compiler builtins and make unstable
This commit fixes a test which now needs to explicitly link to the
`compiler_builtins` crate as well as makes the `compiler_builtins` crate
unstable.
2016-09-13 12:27:26 -07:00
Alex Crichton
265620225d rustc: Don't pass --whole-archive for compiler-builtins
This flag is intended for rlibs included once, not rlibs that are repeatedly
included.
2016-09-13 08:11:20 -07:00
Jorge Aparicio
3fd5fdd8d3 crate-ify compiler-rt into compiler-builtins
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib

This commit moves the logic that used to build libcompiler-rt.a into a
compiler-builtins crate on top of the core crate and below the std crate.
This new crate still compiles the compiler-rt instrinsics using gcc-rs
but produces an .rlib instead of a static library.

Also, with this commit rustc no longer passes -lcompiler-rt to the
linker. This effectively makes the "no-compiler-rt" field of target
specifications a no-op. Users of `no_std` will have to explicitly add
the compiler-builtins crate to their crate dependency graph *if* they
need the compiler-rt intrinsics. Users of the `std` have to do nothing
extra as the std crate depends on compiler-builtins.

Finally, this a step towards lazy compilation of std with Cargo as the
compiler-rt intrinsics can now be built by Cargo instead of having to
be supplied by the user by some other method.

closes #34400
2016-09-12 21:22:15 -07:00