Giter Site home page Giter Site logo

Comments (15)

japaric avatar japaric commented on September 26, 2024 1

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 fns 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.

mattico avatar mattico commented on September 26, 2024 1

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.

TimNN avatar TimNN commented on September 26, 2024 1

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.

japaric avatar japaric commented on September 26, 2024 1

@mattico FYI: extern "aapcs" fn should be fixed in recent nightlies, if you want to give this another try.

from compiler-builtins.

mattico avatar mattico commented on September 26, 2024

Is there a better way to solve this than using a macro for every extern fn declaration?

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

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.

mattico avatar mattico commented on September 26, 2024

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.

mattico avatar mattico commented on September 26, 2024

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.

japaric avatar japaric commented on September 26, 2024

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.

parched avatar parched commented on September 26, 2024

Af far as I can tell, in Rust there is currently no way to specify aapcs (not vfp) 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.

TimNN avatar TimNN commented on September 26, 2024

Af far as I can tell, in Rust there is currently no way to specify aapcs (not vfp) on armhf targets.

Does extern "aapcs" fn not work?

No, from the rust source:

Aapcs => llvm::CCallConv,

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

Aapcs => llvm::CCallConv,

Is that a bug? With that extern "aapcs" fn would be no different than extern "C" fn then ...

from compiler-builtins.

TimNN avatar TimNN commented on September 26, 2024

Is that a bug? With that extern "aapcs" fn would be no different than extern "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.

parched avatar parched commented on September 26, 2024

Yes definitely a bug and the reason the @mattico's test failed.

from compiler-builtins.

parched avatar parched commented on September 26, 2024

Bug report here rust-lang/rust#37810

from compiler-builtins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.