rust-lang / rustc_codegen_gcc

libgccjit AOT codegen for rustc
Apache License 2.0
925 stars 60 forks source link

__atomic_load_8 might not be available on some platforms #339

Open antoyo opened 1 year ago

antoyo commented 1 year ago

https://users.rust-lang.org/t/for-arc-elf32-target-get-undefined-reference-to-debug-lower-hex-when-using-alloc-crate/99234/16

antoyo commented 1 year ago

@jonathanbcarlson: I have the feeling there's nothing to be done on the codegen side. I think you should just set the appropriate max-atomic-width in your target spec JSON file. Can you please try and see if it works for you?

Btw, I also made the cross-compilation case much easier with this PR. You can see the updated instructions and I'll soon write some instructions on how to build a cross-compiler easily with crosstool-ng in this repo.

It might not be easy for now to use a target spec file, but I'll fix this soon.

I hope this helps!

jonathanbcarlson commented 1 year ago

@antoyo, thanks for all the improvements! I'm pretty busy this week but I'll have more time in the coming weeks to try the changes out.

antoyo commented 1 year ago

Good. With this PR it should now be possible to use a target specification file.

antoyo commented 1 year ago

I tried to do a test with a different arch in the target specification file and I'm unable to compile a project. It gives this error:

  = note: /opt/m68k-unknown-linux-gnu/bin/../lib/gcc/m68k-unknown-linux-gnu/13.0.0/../../../../m68k-unknown-linux-gnu/bin/ld: unknown architecture of input file `/tmp/rustcEH8UCo/symbols.o' is incompatible with m68k output

Is this why this wrapper was used for?

I'd like to make the experience as simple as possible. I think now that most patches in this repo aren't necessary anymore. Also, I believe most flags you need to send to gcc can be added with -C llvm-args which sends the args to gcc with context.add_command_line_option().

When you have time, we can take a look at fixing that and whatever else is missing.