Comments (15)
I think the __aeabi aliases should use the AAPCS calling convention
Yes or we'll hit the floatundidf bug when we integrate this into rust-lang/rust.
If the functions that are being aliased don't also use extern "aapcs"
The "aliased" functions must also use extern "aapcs"
This may me realize that we may be invoking the functions in libcompiler-rt.a with the wrong calling convention. We are calling them as if they were extern fn
s when we should be using extern "aapcs" fn
instead. I expect this would cause problems for the arm-gnueabihf target. Have we had problems with that target?
from compiler-builtins.
From the discussion above, I gather:
Lib | eabi | rest |
---|---|---|
gcc_s | aapcs | c |
compiler-rt | aapcs | c |
compiler-rt 4.0 | aapcs | aapcs |
compiler-builtins | c | c |
from compiler-builtins.
Note that for rust currently aapcs == c
. Also, in llvm, there are actually aapcs
and aapcs-vfp
, where the vfp version is hard float and the "normal" version is soft float. Then, for llvm, c
is aapcs
on soft float targets and aapcs-vfp
on hard float targets.
Af far as I can tell, in Rust there is currently no way to specify aapcs
(not vfp
) on armhf targets.
The only thing that changes for llvm 4.0, I think, is that the powi
intrinsic now requires aapcs
(no hf) now as well (it previously did not). This as been reported as a regression to llvm (https://llvm.org/bugs/show_bug.cgi?id=30543).
from compiler-builtins.
@mattico FYI: extern "aapcs" fn
should be fixed in recent nightlies, if you want to give this another try.
from compiler-builtins.
Is there a better way to solve this than using a macro for every extern fn
declaration?
from compiler-builtins.
This may me realize that we may be invoking the functions in libcompiler-rt.a with the wrong calling convention
To clarify: I meant in our unit tests. We have a transmute from usize
to extern fn
.
from compiler-builtins.
Have we had problems with that target?
Yes, this seems very likely to be causing #90 and the issues in #106.
To clarify: I meant in our unit tests. We have a transmute from usize to extern fn.
If I recall correctly, the issues only occurred inside the unit tests not when called normally, which makes sense.
I'll go test this theory right now.
from compiler-builtins.
I tested this by making everything extern "aapcs"
and making sure the compiler-rt submodule included the aapcs changes and it didn't fix anything. I'm probably just missing something since this still seems like the most likely culprit.
https://github.com/mattico/compiler-builtins/tree/aapcs
from compiler-builtins.
I don't think changes like these are correct:
fn __addsf3(f: extern "aapcs" fn(f32, f32) -> f32,
I think the intrinsics in libgcc.a are compiled the "hard" calling convention (not aapcs) so those should be called using extern "C" fn
. I also think that extern "aapcs" fn
doesn't make a difference over extern "C" fn
in functions that don't take or return floating point values.
from compiler-builtins.
Af far as I can tell, in Rust there is currently no way to specify
aapcs
(notvfp
) on armhf targets.
Does extern "aapcs" fn
not work?
This as been reported as a regression to llvm
It's not clear to me whether that is a regression or improvement. I think it's regression but the compiler-rt guy thinks that's how it should be.
from compiler-builtins.
Af far as I can tell, in Rust there is currently no way to specify
aapcs
(notvfp
) on armhf targets.Does
extern "aapcs" fn
not work?
No, from the rust source:
Aapcs => llvm::CCallConv,
from compiler-builtins.
Aapcs => llvm::CCallConv,
Is that a bug? With that extern "aapcs" fn
would be no different than extern "C" fn
then ...
from compiler-builtins.
Is that a bug? With that
extern "aapcs" fn
would be no different thanextern "C" fn
then ...
Well, there's the comment // These API constants ought to be more specific...
just above...
I would assume that this was the easy way of getting the correct aapcs version (soft vs hard float) without having to add that logic to rustc.
from compiler-builtins.
Yes definitely a bug and the reason the @mattico's test failed.
from compiler-builtins.
Bug report here rust-lang/rust#37810
from compiler-builtins.
Related Issues (20)
- `__extenddftf2` is found to be missing at runtime when using the WASI SDK to build Rust crates' C code HOT 2
- Getting C-defined intrinsics into a project that uses the stable compiler doesn't work because of all the `#![feature]` checks HOT 2
- Unable to find long double symbols on `aarch64-apple-darwin` HOT 4
- Adding feature to port `libm` for any target HOT 3
- Unable to use static macOS libraries in Unreal Engine projects HOT 2
- Regression: build failure on i686-pc-windows-gnu due to multiple definition of `_alloca` HOT 15
- Undefined reference to __chkstk, __alloca when building target i686-unknown-uefi
- aarch64 windows build failure HOT 1
- `aarch64-linux` `multf3` symbol has incorrect rounding HOT 1
- Unable to `-Zbuild-std` because std depends on `compiler-builtins` without the `no-f16-f128` features HOT 5
- Rounding error in `__mulsf3` HOT 6
- Inconsistent truncation of -0.0 HOT 6
- powerpc64le truncation failure HOT 1
- Errors building latest version on arm-android HOT 7
- Infinite recursion in sqrt HOT 4
- "was built for iOS 16.4" warning HOT 4
- Infinite recursion in `__extendhfsf2` and `__truncsfhf2` on "no-f16-f128" platforms HOT 6
- Various symbols on win/apple are no longer weak after #598 HOT 13
- Presence of `f16` in signatures causes missing symbols on PPC HOT 2
- Optimizing Compiler builtins causes build failure on VxWorks HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compiler-builtins.