Removed the `weak-intrinsics` feature, so that all functions
will have the `weak` linkage attribute.
Also this fixed the bug in
https://github.com/rust-lang/rust/issues/124042.
Before this commit, generated code will be
```rust
pub extern "C" fn <name>(...) -> ... {
// code...
}
pub mod <name> {
#[linkage = "weak"]
#[no_mangle]
pub extern "C" fn <name>(...) -> ... {
super::<name>(...)
}
}
```
The issue is that there is 2 `weak` linkage, the first one is not required.
Along refactoring `weak` attributes, this was fixed.
When enabled, the weak-intrinsics feature will cause all intrinsics
functions to be marked with weak linkage (i.e. `#[linkage = "weak"])
so that they can be replaced at link time by a stronger symbol.
This can be set to use C++ intrinsics from the compiler-rt library,
as it will avoid Rust's implementation replacing the compiler-rt
implementation as long as the compiler-rt symbols are linked as
strong symbols. Typically this requires the compiler-rt library to
be explicitly specified in the link command.
Addresses https://github.com/rust-lang/compiler-builtins/issues/525.
Without weak-intrinsics, from nm:
```
00000000 W __aeabi_memclr8 // Is explicitly weak
00000000 T __udivsi3 // Is not.
```
With weak-intrinsics, from nm:
```
00000000 W __aeabi_memclr8 // Is explicitly weak
00000000 W __udivsi3 // Is weak due to weak-intrinsics
```
This ensures that each intrinsic ends up in a separate module, which in
turn (because rustc treats compiler_builtins specially) will result in
each intrinsic ending up in its own object file. This allows the linker
to only pick up object files for intrinsics that are missing and avoids
duplicate symbol definition errors.
* Use a no-asm feature instead of an asm feature
This works better as core/alloc/std have trouble supporting default
featues in this crate.
Signed-off-by: Joe Richey <joerichey@google.com>
* Have no-asm disable arm assembly intrinsics
Signed-off-by: Joe Richey <joerichey@google.com>
Use the "volatile" option and the "memory" clobber on inline asm that does
things like return directly, to reduce the chances of compilers rearranging
the code.
also, on ARM, inline(always) the actual implementation of the intrinsics so we
end with code like this:
```
00000000 <__aeabi_dadd>:
(implementation here)
```
instead of "trampolines" like this:
```
00000000 <__aeabi_dadd>:
(shuffle registers)
(call __adddf3)
00000000 <__adddf3>:
(implementation here)
```
closes#116