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

Introduce an ArchiveBuilderBuilder #99844

Merged
merged 3 commits into from
Jul 31, 2022

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jul 28, 2022

This avoids monomorphizing all linker code for each codegen backend and will allow passing in extra information to the archive builder from the codegen backend. I'm going to use this in #97485 to allow passing in the right function to extract symbols from object files to a generic archive builder to be used by cg_llvm, cg_clif and cg_gcc.

bjorn3 added 3 commits July 28, 2022 08:39
This avoids monomorphizing all linker code for each codegen backend and
will allow passing in extra information to the archive builder from the
codegen backend.
@bjorn3 bjorn3 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 28, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2022

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2022
@nagisa
Copy link
Member

nagisa commented Jul 31, 2022

I'm going to use this in #97485 to allow passing in the right function to extract symbols from object files to a generic archive builder to be used by cg_llvm, cg_clif and cg_gcc.

Do I understand correctly that the ultimate goal is to have just one common implementation of an ArchiveBuilder thus eventually obviating this ArchiveBuilderBuilder factory too?

@bors r+

@bors
Copy link
Contributor

bors commented Jul 31, 2022

📌 Commit 7c6c7e8 has been approved by nagisa

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 31, 2022
let output_path =
Self::create_dll_import_lib(self.sess(), lib_name, dll_imports, tmpdir.as_ref());
archive: &Path,
skip: Box<dyn FnMut(&str) -> bool + 'static>,
Copy link
Member

Choose a reason for hiding this comment

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

Couldn’t this have been &mut dyn? Not that it matters much probably.

Copy link
Member Author

Choose a reason for hiding this comment

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

The LLVM based archive writer used to store the skip function and would only evaluate it once building the actual archive file. This is no longer the case since a couple of days, but I wanted to keep this option open for other archive builders.

@bjorn3
Copy link
Member Author

bjorn3 commented Jul 31, 2022

Do I understand correctly that the ultimate goal is to have just one common implementation of an ArchiveBuilder thus eventually obviating this ArchiveBuilderBuilder factory too?

Just like with MetadataLoader my plan is to have a single canonical implementation for all in-tree backends, but still give the option to use another one for platforms that don't use a variant of ar archives, or that use a variant unsupported by my rust port of LLVM's archive writer. For example IBM's big archive format. Or tar as used by rust-gpu's rustc_codegen_spirv.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 31, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#99186 (Use LocalDefId for closures more)
 - rust-lang#99741 (Use `impl`'s generics when suggesting fix on bad `impl Copy`)
 - rust-lang#99844 (Introduce an ArchiveBuilderBuilder)
 - rust-lang#99921 (triagebot.yml: CC Enselic when rustdoc-json-types changes)
 - rust-lang#99974 (Suggest removing a semicolon and boxing the expressions for if-else)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1d010d4 into rust-lang:master Jul 31, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 31, 2022
@bjorn3 bjorn3 deleted the archive_builder_interface_refactor branch July 31, 2022 15:57
celinval added a commit to celinval/kani-dev that referenced this pull request Aug 8, 2022
celinval added a commit to celinval/kani-dev that referenced this pull request Aug 15, 2022
celinval added a commit to model-checking/kani that referenced this pull request Aug 17, 2022
* Fix compilation errors

Regression is still failing. Related changes:

- rust-lang/rust#99420
- rust-lang/rust#99495
- rust-lang/rust#99844
- rust-lang/rust#99058

* Change test to expect compilation failure

The compiler has reverted their fix to Opaque types due to performance
degradation.

* Fix VTable handling now that it has an Opaque type

 - Add an implementation for vtable_size and vtable_align intrinsics.
 - Change how we handled Foreign types. Even though they are unsized, a
   pointer to foreign types is a thin pointer.

Co-authored-by: Daniel Schwartz-Narbonne <danielsn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants