-
Notifications
You must be signed in to change notification settings - Fork 159
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
Reintroduce targetrustm hooks without the maze of macro definitions in target headers #1543
Conversation
87291ba
to
7496485
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks a lot
7496485
to
fda7054
Compare
Added darwin-specific target hooks (it's picked up by both x86 and PPC). Mostly now it's just a matter of adding other OS and CPU support code in the exact same way. |
@ibuclaw do you want to merge this in this state or keep working on it? I see the PR is still marked as draft, but it's in a good spot and I don't mind merging it now |
@CohenArthur depends on how small you want to keep this. :-) I can keep incrementally adding targets here until a suitable baseline set of implementations are present, or carry on adding one target, one PR at a time. Of what's being tested by the GH runners, the only rust target info that's missing would be Linux support. |
fda7054
to
5c21da9
Compare
Removed unnecessary include from i386-rust.cc, I guess this is fine for now, and will just add support for other kinds of targets in future PRs, based on what was previously reverted from the original target support code. |
9f62814
to
5688e41
Compare
Split out the implementation of the target hook from the actual adding of it, so anyone else who's interested can just look at either commit and see clearly what they have to do in order to in add, say, target cpu info for |
gcc/ChangeLog: * Makefile.in (tm_rust_file_list, tm_rust_include_list, TM_RUST_H, RUST_TARGET_DEF, RUST_TARGET_H, RUST_TARGET_OBJS): New variables. (tm_rust.h, cs-tm_rust.h, default-rust.o, rust/rust-target-hooks-def.h, s-rust-target-hooks-def-h): New rules. (s-tm-texi): Also check timestamp on rust-target.def. (generated_files): Add TM_RUST_H and rust-target-hooks-def.h. (build/genhooks.o): Also depend on RUST_TARGET_DEF. * config.gcc (tm_rust_file, rust_target_objs, target_has_targetrustm): New variables. * configure: Regenerate. * configure.ac (tm_rust_file_list, tm_rust_include_list, rust_target_objs): Add substitutes. * doc/tm.texi: Regenerate. * doc/tm.texi.in (targetrustm): Document. (target_has_targetrustm): Document. * genhooks.cc: Include rust/rust-target.def. * config/default-rust.cc: New file. gcc/rust/ChangeLog: * rust/rust-target-def.h: New file. * rust/rust-target.def: New file. * rust/rust-target.h: New file.
gcc/ChangeLog: * doc/tm.texi: Regenerate. * doc/tm.texi.in: Add @node for Rust language and ABI, and document TARGET_RUST_CPU_INFO. gcc/rust/ChangeLog: * rust/rust-lang.cc (rust_add_target_info): Remove sorry. * rust/rust-session-manager.cc: Replace include of target.h with include of tm.h and rust-target.h. (Session::init): Call targetrustm.rust_cpu_info. * rust/rust-target.def (rust_cpu_info): New hook. * rust/rust-target.h (rust_add_target_info): Declare.
gcc/ChangeLog: * doc/tm.texi: Regenerate. * doc/tm.texi.in: Document TARGET_RUST_OS_INFO. gcc/rust/ChangeLog: * rust/rust-session-manager.cc (Session::init): Call targetrustm.rust_os_info. * rust/rust-target.def (rust_os_info): New hook.
There are still quite a lot of the previously reverted i386-rust.cc missing, so it's only a partial reimplementation. gcc/ChangeLog: * config/i386/t-i386 (i386-rust.o): New rule. * config/i386/i386-rust.cc: New file. * config/i386/i386-rust.h: New file.
gcc/ChangeLog: * config.gcc (*-*-darwin*): Set rust_target_objs and target_has_targetrustm. * config/t-darwin (darwin-rust.o): New rule. * config/darwin-rust.cc: New file.
5688e41
to
bb5efc6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
Nice work this is really great work! Lets merge this Mark's build farm has a bunch of more esoteric targets that would be really nice to keep green you can see their status in our README near the top.
I think let's merge this. As part of merging gccrs upstream, I think we will likely make this a separate set of patches to make the current review process simpler and then once that's done we can get this reviewed.
bors r+ |
Build succeeded: |
TARGET_RUST_CPU_INFO
target hook.TARGET_RUST_OS_INFO
target hook.TARGET_RUST_CPU_INFO
hook for x86 (only a subset of the original i386-rust.cc was re-added)TARGET_RUST_OS_INFO
hook for darwin (covers both x86 and powerpc).There's quite a bit to unpick from what was removed, but I hope this shows how firstly
rust-target.h
andtm_rust.h
should be kept as empty as possible for thedefault-rust.cc
source file that pulls in these headers; secondly all rust macros and declarations be put in rust-specific headers, then pulled into tm_rust.h as-needed. From every other${target}-rust.cc
file, you can include as much as you like in order to pry out the information you need to get at.I've verified this does work as expected with the
-frust-dump-target_options
switch, e.g with-mavx2
I've also built a few darwin cross compilers with the following results on i686-darwin
and on powerpc64-darwin