Commit Graph

198 Commits

Author SHA1 Message Date
Amanieu d'Antras
18623bffad
Merge pull request #464 from m-ou-se/floatconv2 2022-05-26 20:53:14 +02:00
Mara Bos
425c78ee7a Faster int<->float conversions. 2022-05-20 16:25:18 +02:00
Keith Smiley
7d79662fd1 Remove apple_versioning.c inclusion
According to the README this file isn't used by rust, but it's currently
included which leads to these linker warnings in some cases:

```
ld: warning: linker symbol '$ld$hide$os10.5$___udivti3' hides a non-existent symbol '___udivti3'
ld: warning: linker symbol '$ld$hide$os10.4$___umoddi3' hides a non-existent symbol '___umoddi3'
ld: warning: linker symbol '$ld$hide$os10.5$___umoddi3' hides a non-existent symbol '___umoddi3'
ld: warning: linker symbol '$ld$hide$os10.4$___umodti3' hides a non-existent symbol '___umodti3'
ld: warning: linker symbol '$ld$hide$os10.5$___umodti3' hides a non-existent symbol '___umodti3'
```

This file exclusively contains macros which hides old symbols on Apple
OS versions where they don't exist.

fc10370ef7/compiler-rt/lib/builtins/apple_versioning.c
2022-05-02 16:06:42 -07:00
Peter Collingbourne
c491ca7ec5 Build emutls.c on Android.
Android uses emulated TLS so we need a runtime support function
from this source file.
2022-03-24 11:25:47 -07:00
Vladimir Michael Eatwell
50c5587f82 [watch_os] Fix formatting 2022-03-08 10:19:34 +00:00
Vladimir Michael Eatwell
002fc52f00 [watch_os] add watchOS 2022-03-08 10:05:44 +00:00
Daniel Sommermann
554fa533ab Stop emitting duplicate symbols for armv7-linux-androideabi
The change in 186517b3266a7bb2b2310927f7342ea7f41790c3 was intended to
affect only `arm-linux-androideabi` but also affected
`armv7-linux-androideabi` which is not a pre-ARMv6 architecture.
Fixes #449
2022-01-27 12:02:40 -08:00
Ayrton
9124cdc7ec Remove truncdfsf2.c from sources in build.rs and add test for __truncdfsf2vfp
Also fixed the calling convention for truncdfsf2 on ARM
2021-12-12 21:12:42 -05:00
Amanieu d'Antras
4abfecabef Import the asm! macro from core::arch
It is going to be removed from the prelude due to the decision in
https://github.com/rust-lang/rust/issues/87228
2021-12-09 23:57:26 +00:00
Amanieu d'Antras
c750277268 Ensure AArch64 LSE object files have distinct names in an archive
This is needed by libtool which rejects archives that contain object
files with the same name multiple times.

Fixes #443
2021-11-28 13:02:09 +00:00
Alessandro Decina
d96a0a0877 Turn on the mem-unaligned feature for bpf targets
Fixes the following LLVM segfault:

 Error: e: 05:02:06 [ERROR] fatal error: "Cannot select: 0x55e970a357d0: i64,ch = AtomicLoad<(load unordered (s64) from %ir.45)> 0x55e970410be8, 0x55e970a358a0\n  0x55e970a358a0: i64,ch = CopyFromReg 0x55e970410be8, Register:i64 %19\n    0x55e970a35490: i64 = Register %19\nIn function: memcpy"
          PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
          Stack dump:
          0.	Running pass 'Function Pass Manager' on module 'unroll-loop'.
          1.	Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@memcpy'
2021-11-21 07:07:14 +00:00
Alex Crichton
b7fb6c594a Adjust some build directives for wasm64
This is still an experimental target but this should get the wasm64
target to behave more like wasm32.
2021-10-28 10:29:37 -07:00
Gary Guo
709bd6e11c Add different misaligned path for archs with unaligned support 2021-08-21 03:48:56 +01:00
Wesley Wiser
ba100707db Don't try to build out-of-line aarch64 atomics with the msvc toolchain
The msvc toolchain does not support building `.s` files, clang only
supports generating out-of-line atomics on Linux and gcc does not
support aarch64 for Windows at all. Therefore, we don't need to compile
`lse.s` on `aarch64-pc-windows-msvc`.
2021-07-28 13:57:03 -04:00
Rich Kadel
6ff8257858 Support long double intrinsics in any aarch64 linux
Expands the support added in #377 from just musl to any linux.

Also checks for and avoids adding duplicate sources.

Fixes #428
2021-07-14 11:17:27 -07:00
Amanieu d'Antras
77d9a28bbb Fix build on targets with fewer than 3 components in their name 2021-06-03 22:59:34 +01:00
Tilmann Meyer
31e3ae708c
Include Linux atomic emulation on androideabi
The old androideabi uses armv5 and thus also needs the atomic emulation
and because Android is basically Linux it can use the same
implementation.
2021-05-31 16:32:46 +02:00
Amanieu d'Antras
1630c86e07 Don't embed lse_*.a inside another static library 2021-05-13 21:35:34 +01:00
Josh Triplett
79c1e33364 Make the name of the intermediate library more closely match the intrinsic 2021-04-30 12:15:32 -07:00
Josh Triplett
df8e6f179a Require lse.S (now available in current LLVM) 2021-04-30 12:15:32 -07:00
Josh Triplett
b9da06f662 Fix typo in instruction name: s/cwp/swp/ 2021-04-30 12:15:32 -07:00
George Burgess IV
5edaec6c97 add support for building outlined aarch64 intrinsics
llvm/llvm-project@a4ac434c47 saw the
addition of out-of-line aarch64 atomic intrinsics. LLVM will sometimes
emit these, so we need to ensure they're included in Rust's compiler-rt.
2021-04-30 12:15:32 -07:00
messense
6cd2f3ae40 Add compiler-rt fallbacks on mips64-musl 2021-04-03 11:20:09 +08:00
Thomas Vigouroux
29791313f5 add compiler-rt fallbacks on aarch64-musl 2020-08-24 13:28:32 +02:00
Amanieu d'Antras
b6ee34a330
Merge pull request #341 from vfreex/add-mips-compiler-rt-fallback
add mips/mips64 compiler-rt fallbacks so that libgcc is not required
2020-08-23 23:27:05 +01:00
Eric Huss
a2840567da
Add more targets to automatically select mem feature. (#357) 2020-05-22 16:12:06 -05:00
Andre Richter
569b87d602
aarch64: Exclude FP intrinsics on +nofp or +nosimd (#344)
`AArch64` GCCs exit with an error condition when they encounter any kind of
floating point code if the `nofp` and/or `nosimd` compiler flags have been set.

Therefore, evaluate if those flags are present and set a boolean that causes any
compiler-rt intrinsics that contain floating point source to be excluded for
this target.

This patch prepares https://github.com/rust-lang/rust/pull/68334
2020-02-28 13:01:22 -06:00
Yuxiang Zhu
d370d2728b add mips/mips64 compiler-rt fallbacks so that libgcc is not required
This adds compiler-rt fallbacks for mips and mips64 arches.

Solves linking issues like https://github.com/rust-lang/rust/issues/57820.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
2020-02-13 03:33:56 +08:00
Lokathor
e796054f9e Update build.rs 2019-09-06 18:02:11 -06:00
Lokathor
e079f2d70d Update build.rs 2019-09-06 15:20:05 -06:00
Joel Galenson
a80233948f Update comment to mention where the __FILE__ macro is used. 2019-08-19 15:12:07 -07:00
Joel Galenson
cefd832d89 Support deterministic builds by remapping the __FILE__ prefix if the compiler supports it. 2019-08-19 09:30:45 -07:00
Alex Crichton
b84b7143e8 Remove compiler-rt submodule from this repository
This commit removes the `compiler-rt` submodule from this repository.
The goal here is to align the `compiler-rt` used for compiling C
intrinsics with the upstream rust-lang/rust's usage of `llvm-project`.
Currently we have both an `llvm-project` repository as well as
`compiler-rt`, but they can naturally get out of sync and it's just one
more submodule to manage.

The thinking here is that the feature `c` for this crate, when
activated, will require the user to configure where the source code for
`compiler-rt` is present. This places the onus on the builder of
`compiler-builtins` to check-out and arrange for the appropriate
`compiler-rt` source code to be placed somewhere. For rust-lang/rust
this is already done with the `llvm-project` submodule, and we can
arrange for it to happen on this crate's CI anyway.

For users of this crate this is a bit of a bummer, but `c` is disabled
by default anyway and it seems unlikely that `c` is explicitly opted in
to all that much. (given the purpose of this crate)

This should allow us to archive the `compiler-rt` repository and simply
use `llvm-project` in the rust-lang/rust repository.
2019-05-16 07:50:20 -07:00
Alex Crichton
f567dbb36b Remove the need for #[cfg] in #[use_c_shim_if]
This commit tweaks the implementation of the synthetic
`#[use_c_shim_if]` attribute, renaming it to
`#[maybe_use_optimized_c_shim]` in the process. This no longer requires
specifying a `#[cfg]` clause indicating when the optimized intrinsic
should be used, but rather this is inferred and printed from the build
script.

The build script will now print out appropriate `#[cfg]` directives for
rustc to indicate what intrinsics it's compiling. This should remove the
need for us to keep the build script and the source in sync, but rather
the build script can simply take care of everything.
2019-05-15 12:59:31 -07:00
Alex Crichton
b2cfc3a4f1 Run rustfmt over everything 2019-05-14 14:40:38 -07:00
Alex Crichton
9886a163b3 Don't compile C code on riscv targets
This fixes a longstanding bug in compiler-builtins where C code was
compiled for the riscv targets but when distributed in rust-lang/rust
all the C code was actually compiled for x86_64 since there is no
configured C compiler for riscv. This was exposed by #286 by accident
but the underlying cause was somewhat unrelated.

For now we forcibly disable C code for riscv targets, and when the C
compiler story is sorted out in rust-lang/rust and with `cc-rs` we can
reenable. For now just use all the Rust definitions.

cc rust-lang/rust#60747
2019-05-14 14:29:29 -07:00
Alex Crichton
98f4618c9a Revert "Use the Rust implementation of udivsi3 on ARM"
This reverts commit 681aaa914dea7cae8252c33023604ce6c91808bd.
2019-05-02 12:49:19 -07:00
Alex Crichton
5a29b6d057
Merge pull request #276 from hug-dev/armv8m-support
Fix compilation errors for Armv8-M Baseline and Mainline with FPU
2019-03-14 09:15:10 -05:00
Hugues de Valon
ae7b057cdb Fix compilation for thumbv8m.main-none-eabihf
Some files were not assembling for the Armv8-M Mainline architecture
profile with FPU extension. Reason being the same as for Armv7-M: the
conversion intrinsics including double precision floating
point variables do not work with single precision FPUs.
Also removes from exclusion files that are assembling without errors for
Armv7-M and Armv8-M Mainline.
2019-03-14 12:58:29 +00:00
Hugues de Valon
e7c41f4a84 Fix Armv8-M Baseline compilation
Armv8-M Baseline, ie thumbv8m.base-none-eabi, is a superset of the
Armv6-M architecture profile. As it shares almost the same instruction
set, this commit copies the configuration for thumbv6m-none-eabi to
enable it.
2019-03-14 12:58:23 +00:00
Alex Crichton
8d0fdce9ca Don't compile memory intrinsics on wasi 2019-03-13 08:23:25 -07:00
MikaelUrankar
55f0ab112a FreeBSD arm needs clear_cache.c 2019-02-02 19:52:41 +01:00
Alex Crichton
d73e6e61cd
Merge pull request #270 from denzp/master
Don't build compiler-rt for NVPTX
2019-01-07 11:11:19 -06:00
Denys Zariaiev
deb1cb51d1 Don't build compiler-rt for NVPTX 2019-01-07 17:16:09 +01:00
Yu Ding
c5dc23d75d Fix SGX target_env collision
Signed-off-by: Yu Ding <dingelish@gmail.com>
2019-01-03 12:53:08 -08:00
Alex Crichton
08db8f31d3 Add metadata for where compiler-rt is located
Compiler crates will need to use this!
2018-11-21 12:57:39 -08:00
Jethro Beekman
3880e404a8 Add SGX target 2018-11-21 14:07:57 +05:30
Alex Crichton
dbdcd66e35 Revert "Conversion from a wider to a narrower IEEE-754 floating-point type"
This reverts commit baab4fd89cdd945e46fed31166e5dcad7224ed87.
2018-10-30 10:51:11 -07:00
Paolo Teti
45a42b5b89 Conversion from a wider to a narrower IEEE-754 floating-point type
Adds generic conversion from a wider to a narrower IEEE-754
floating-point type.

Implement `__truncdfsf2` and `__truncdfsf2vfp` and associated test-cases.
2018-09-17 19:53:04 +02:00
Alex Crichton
84523d81a1
Merge pull request #259 from paoloteti/cc-rs
Remove superfluous cc flags
2018-09-09 10:44:02 -07:00
Paolo Teti
296f04fe63 Remove unused variable target_arch_arm
Previous commit makes this variable unused
2018-09-08 19:04:09 +02:00
Paolo Teti
66d52cf01d Remove superfluous cc flags
Latest `cc-rs` already manage all arm/thumb flags, so We can
safely remove this piece of code.
2018-09-08 17:41:26 +02:00
Alex Crichton
447bb5391f
Merge pull request #256 from jordanrh1/windows-arm
Support windows/arm target
2018-09-07 10:08:01 -07:00
Jordan Rhee
71c5701c58 Remove unnecessary check 2018-09-07 08:27:38 -07:00
Jordan Rhee
19a7eedbf3 Try undoing unnecessary change 2018-09-06 09:27:24 -07:00
Jordan Rhee
6310b74d85 Support windows/arm target 2018-09-06 09:27:24 -07:00
Alex Crichton
38d5777d98 Fix some use_c_shim_if directives
This was an accidental regression introduced in #252 by removing compilation of
C files without adjusting the `#[use_c_shim_if]` directives. This restores the
compilation of the assembly files and updates the `#[use_c_shim_if]` directives.
2018-09-04 10:21:06 -07:00
Yu Ding
0e67871a43 Follow up on PR #252 2018-08-06 23:03:37 -07:00
Yu Ding
e3ac57b234 Fix symbol collision caused by floatdisf
[PR #234](https://github.com/rust-lang-nursery/compiler-builtins/pull/234) added floatdisf implementation in rust and removed floatdisf.c from build.rs. However the removal is in-complete. In x86_64+!msvc environment, the symbol floatdisf would be generated twice. Bugs found in Redox OS issue [#1195](https://gitlab.redox-os.org/redox-os/redox/issues/1195) and Mesalink travis [log](https://travis-ci.org/mesalock-linux/mesalink/jobs/412928048) at line 738. This patch fixes it by removing floatdisf.c from this environment.

Signed-off-by: Yu Ding <dingelish@gmail.com>
2018-08-06 20:54:48 -07:00
Alex Crichton
33086672fa Don't build multc3 on AArch64 MSVC
Apparently it doesn't compile due to an odd compiler error! This intrinsic has
to do with complex arithmetic anyway and we shouldn't need it.
2018-07-16 16:37:57 -07:00
Sébastien Marie
b1b06f583a openbsd: doesn't use static as it could result duplicated symbols 2018-07-16 06:17:38 +02:00
Sébastien Marie
c207fd3869 use system library on openbsd
compiler_rt is provided by default on OpenBSD, so use it instead of
rebuilding it from source.
2018-05-12 09:40:51 +02:00
Alex Crichton
6249080093
Merge pull request #234 from ketsuban/master
Add __floatdisf and __floatundisf intrinsics
2018-04-05 10:06:16 -05:00
Thomas Winwood
ed6d12ecea
Remove reference to C impl of float[un]disf 2018-04-05 15:03:44 +01:00
Paolo Teti
ad3a5b6826 Remove ledf2vfp.S and lesf2vfp.S from build list 2018-02-25 19:49:31 +01:00
Paolo Teti
63b78c86d9 Fix thumbv6m build (feature=c)
1. Avoid undefined references as:
   undefined reference to `__modsi3'
   undefined reference to `__umodsi3'

2. We can't remove assembly implementations that are not in the list
2018-02-16 17:34:01 +01:00
Paolo Teti
b2aea631fe Collection of VFP intrinsics
Nothing really exciting here. LLVM on hard-float target use native instructions
for all listed VFP intrinsics and so resulting implementation is really trivial.

Implemented intrinsics:

 __gesf2vfp
 __gedf2vfp
 __gtsf2vfp
 __gtdf2vfp
 __ltsf2vfp
 __ltdf2vfp
 __nesf2vfp
 __nedf2vfp
 __eqsf2vfp
 __eqdf2vfp
 __extendsfdf2vfp
2018-02-11 23:46:56 +01:00
Paolo Teti
4e1ff92946 Set -mfloat-abi=hard not only for thumb targets 2018-02-11 21:23:59 +01:00
Paolo Teti
0af69177f9 Add generic conversion from a narrower to a wider FP type
Add `extend` module to implement conversion from a narrower to a wider
floating-point type.

This implementation is only intended to support *widening* operations.
Module to convert a *narrower* floating-point will be added in the future.
2018-02-08 18:20:45 +01:00
Paolo Teti
97e6b3712a Add support for sub*f3vfp and add*f3vfp
As done before for mul and div let's use extern "C" to generate `"aapcs"`
or `"aapcs-vfp"` depending on target configuration.
2018-02-04 18:34:31 +01:00
Alex Crichton
41290fe728 Simplify how testing is done
All tests are moved to a separate crate in this repository to enable features by
default. Additionally the test generation is moved to a seprate build script and
simplified to reduce the amount of boilerplate needed per test.

Overall this should still be testing everything, just in a different location!
2018-01-31 11:32:20 -08:00
Paolo Teti
4c7de1e315 Fix build errors on arm*-linux-gnueabi
I removed std::mem, but We need it.
2018-01-30 23:10:56 +01:00
Paolo Teti
cc3ea0ab93 Add test cases for Mul[s/d]f3vfp and Div[s/d]f3vfp
for ARM targets only
2018-01-30 20:15:37 +01:00
Paolo Teti
9a4e458b48 Add support for mul[s/d]f3vfp and div[s/d]f3vfp
Here using `"C"` the compiler will use `"aapcs"` or `"aapcs-vfp"`
depending on target configuration.

Of course this translates in a call to `__aeabi_fdiv` / `__aeabi_fmul`
on non-HF targets.

On `eabi` targets with +vfpv2/vfpv3 LLVM generate:

   vmov	s0, r1
   vmov	s2, r0
   vdiv.f32	s0, s2, s0
   vmov	r0, s0
   bx	lr

On `eabihf` targets with +vfpv3-d16/d32/f32 +fp-only-sp LLVM generate:

  vdiv.f32	s0, s0, s1
  bx	lr

That's exactly what We need for [div/mul][s/d]f3vfp.S
2018-01-29 20:49:55 +01:00
Alex Crichton
b751493472 Fix some typos/bugs with float comparison intrinsics
* I believe `__gtdf2` erroneously used `f32` instead of `f64`
* Most of these needed `#[arm_aeabi_alias]` to ensure they're correctly called
  through the alias
* Some existing aliases were corrected with the right names
2018-01-24 17:01:04 -08:00
Paolo Teti
c68621f444 Fix build issue and comments
Fix an unclosed if block
2018-01-19 19:27:25 +01:00
Paolo Teti
2754f64c18 Skip aeabi_cdcmp and aeabi_cfcmp on big-endian targets
First of all aeabi_cdcmp and aeabi_cfcmp are never called LLVM.
Second are little-endian only, so build fail on big-endian targets.
Temporally workaround: exclude these files for big-endian targets.
2018-01-19 09:19:05 +01:00
whitequark
746c4717e1 comparesf2: do not build the assembly versions of intrinsics on ARM. 2018-01-12 21:33:24 +00:00
whitequark
566e7ede90 comparesf2/comparedf2: fix a signedness bug and add tests. 2017-12-29 07:58:34 +00:00
whitequark
a0777758df comparesf2/comparedf2: do not build the C versions of intrinsics. 2017-12-29 06:16:35 +00:00
Marco A L Barbosa
90bd768b20 Use kernel user helpers for armv4t
Rename armv5te cfg to kernel_user_helpers and enable it for armv4t
2017-12-26 13:02:05 -02:00
bors
be3b817149 Auto merge of #212 - tamird:fomit-frame-pointer-not-supported-arm, r=alexcrichton
Avoid warning spew

...when the compiler doesn't support '-fomit-frame-pointer' on the
target architecture.
2017-11-28 17:31:37 +00:00
Tamir Duberstein
fe9bd52cc1
Avoid warning spew
...when the compiler doesn't support '-fomit-frame-pointer' on the
target architecture.
2017-11-27 17:41:54 -05:00
Jan Teske
dd0be67665 Remove mulsf3.c and muldf3.c from compiler-rt.
mulsf3 and muldf3 have Rust implementations since 8970485. Remove the
C implementations to avoid conflicts.
2017-11-26 21:53:57 +01:00
Scott McMurray
f468c28f74 Another attempt at making MIPS happy
(I really don't understand how arithmetic makes it segfault...)
2017-11-25 07:00:26 -08:00
Scott McMurray
ba376a3912 Autogenerate the add/sub tests 2017-11-25 06:25:19 -08:00
Alex Crichton
7115a910c8 Remove divsf3.c from compiler-rt
We implement this now!
2017-11-19 09:08:27 -08:00
Oliver Geller
99ea83e095 Implement divsf3 and divdf3 2017-11-13 20:22:27 -05:00
Oliver Geller
5923e278c3 Implement mulsf3 and muldf3 2017-11-08 17:36:34 -05:00
Alex Crichton
4fc3de624a Prepare this crate for more wasm32 compatibility
This commit prepares the build script for a wasm32 target that doesn't use
Emcripten, notably forcing the `mem` feature to get activated and forcibly
ignoring the `c` feature, even if activated, for the wasm32 target.
2017-11-01 19:29:41 -07:00
Amanieu d'Antras
c95fefa9f6 Add atomic support for pre-ARMv6 on Linux 2017-10-05 12:44:12 +01:00
Alex Crichton
46dab7688f Update to the cc dependency 2017-09-22 21:30:12 -07:00
Alex Crichton
0a260ce265 Disable empty intrinsics on i686-apple-darwin
These all currently just produce empty object files
2017-09-17 15:25:34 -07:00
Matt Ickstadt
1f98921e44 Implement x86 chkstk in "rust" 2017-09-15 18:04:59 -05:00
Tamir Duberstein
0b2a017b94
Update rustbuild commentary
Also use `cfg!(feature = "rustbuild")` instead of the environment
variable to ease grep-ability.
2017-09-12 20:54:32 -04:00
est31
465ba28996 Update the gcc crate to 0.3.53 and disable compilation warnings
They are inside the compiler-rt submodule, about which we don't have
direct control over.
2017-09-07 07:49:34 +02:00
Alex Crichton
2fa53c4b67 Don't mangle probes all the time 2017-07-07 20:35:14 -07:00
Alex Crichton
a32ae6d6b6 Fix a typo in the build script 2017-07-03 15:28:03 -07:00
Alex Crichton
ebcf7fac6a Compile ffsdi2 with rustbuild feature
This is not used by LLVM/Rust, but is apparently used by gcc/C which jemalloc
can require at least.
2017-07-03 15:00:51 -07:00
Alex Crichton
e48cd1180b Use the Rust implementation of udivsi3 on ARM
Although compiler-rt presumably has a more optimized implementation written in
assembly, it appears buggy for whatever reason, causing #173.

For now let's see if integration into rust-lang/rust will work with the
Rust-defined implementation!
2017-07-03 09:48:11 -07:00