Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for rustc_codegen_gcc #6

Merged
merged 2 commits into from
Jul 11, 2021

Conversation

dkm
Copy link
Member

@dkm dkm commented Jun 28, 2021

rustc can use different backend and this new script builds all the needed parts
to have GCC as the code generator.

It needs (at the moment) a patched version of GCC and builds it with libjit support.
Some glue code (in Rust) is added in the mix to finally be able to use the rustc
compiler with this dynamic backend.

Fixes compiler-explorer/compiler-explorer#2683

@dkm dkm marked this pull request as draft June 28, 2021 20:27
@dkm dkm force-pushed the pr/rustc_codegen_gcc branch 2 times, most recently from cfa2172 to a61568c Compare July 7, 2021 19:59
rustc can use different backend and this new script builds all the needed parts
to have GCC as the code generator.

It needs (at the moment) a patched version of GCC and builds it with libjit support.
Some glue code (in Rust) is added in the mix to finally be able to use the rustc
compiler with this dynamic backend.

Fixes compiler-explorer/compiler-explorer#2683
@dkm
Copy link
Member Author

dkm commented Jul 7, 2021

I think this is ready now.
It's been shellcheck'ed and tested several times using the docker image...
It simply depends on https://github.com/antoyo/rustc_codegen_gcc/pull/46 being merged by @antoyo

@dkm dkm marked this pull request as ready for review July 7, 2021 20:12
# where the libgccjit.so will be installed
echo "$PREFIX/lib" > gcc_path

./build_sysroot/prepare_sysroot_src.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's now a script called prepare_build.sh that does this, but I guess you don't use it because of the way you install rustup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the script (https://github.com/antoyo/rustc_codegen_gcc/blob/master/prepare_build.sh ) adds some rustup components and calls prepare_sysroot_src.sh. As I also want to remove the components before packaging, I like to have the install/removal in the same script... But I can change this if you think it's better to use your script (maybe because you'll modify it?).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I'll change it, so you can keep it that way.

Copy link
Member

@apmorton apmorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it didn't fully click that this is a nightly build until looking at the infra changes.

This script must implement the unchanged build skipping mechanism before I am comfortable adding it as a scheduled nightly build.

You can see this implemented here: https://github.com/compiler-explorer/misc-builder/blob/main/build/build-tinycc.sh#L36

The gist is:

  • check the git revision of any cloned repos at the top of script before any other work
  • build up an arbitrary string using some combination of the git revisions
  • compare string to given previous build revision ($3 iirc) and bail with appropriate output if the same.

@dkm
Copy link
Member Author

dkm commented Jul 11, 2021

Sorry, it didn't fully click that this is a nightly build until looking at the infra changes.

This script must implement the unchanged build skipping mechanism before I am comfortable adding it as a scheduled nightly build.

You can see this implemented here: https://github.com/compiler-explorer/misc-builder/blob/main/build/build-tinycc.sh#L36

The gist is:

* check the git revision of any cloned repos at the top of script before any other work

* build up an arbitrary string using some combination of the git revisions

* compare string to given previous build revision ($3 iirc) and bail with appropriate output if the same.

ha, sorry, missed that part. I should fix the mrustc builder also ! Will do that !

@dkm
Copy link
Member Author

dkm commented Jul 11, 2021

Implemented the revision check/skip. Also refactored a bit how url/branch are used.
Currently testing it, I'll add a comment if it fails (don't see why it would...)
Will squash when review is ok :)

Copy link
Member

@mattgodbolt mattgodbolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me! Thanks for taking the time!

@mattgodbolt
Copy link
Member

@apmorton I'm approving and you can blame me if it's not really ready :) (sorry to merge with your change request still pending, but wanted to get things moving)

@mattgodbolt mattgodbolt merged commit e8ad43a into compiler-explorer:main Jul 11, 2021
@dkm
Copy link
Member Author

dkm commented Jul 12, 2021 via email

@dkm dkm deleted the pr/rustc_codegen_gcc branch July 12, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REQUEST] rustc_codegen_gcc as alternative Rust compiler
4 participants