Skip to content

librustc should not depend on librustc_llvm #41473

Closed
@whitequark

Description

@whitequark
Member

I'm adding something to librustc_llvm and changing it rebuilds a lot of rustc libraries. @eddyb said this should not be the case.

Activity

self-assigned this
on Apr 22, 2017
eddyb

eddyb commented on Apr 22, 2017

@eddyb
Member

Indeed, only librustc_trans actually needs LLVM, in fact I'd really love to combine the two, since LLVM is only used for the one backend, even if it happens to be our only official one.

whitequark

whitequark commented on Apr 22, 2017

@whitequark
MemberAuthor

Wouldn't that degrade compile times on rebuild?

eddyb

eddyb commented on Apr 22, 2017

@eddyb
Member

Does librustc_llvm actually take a long time to build? Or is linking LLVM super slow?

EDIT For the latter we should use the -sys convention and no higher-level APIs.

whitequark

whitequark commented on Apr 22, 2017

@whitequark
MemberAuthor

I think it's nontrivial, and statically linking LLVM (I dynamically link, personally) can take a lot of time with the default set of targets (I recall linking it for straight minutes).

eddyb

eddyb commented on Apr 22, 2017

@eddyb
Member

@whitequark Yeah we can still separate that out I think, but move anything that's not imports into what is currently librustc_trans - if we can have the crate empty, even better.

arielb1

arielb1 commented on Apr 22, 2017

@arielb1
Contributor

Currently, librustc_metadata depends on LLVM for its archive reader, so we'll first have to split that out (unless the archive reader does not require configuring LLVM).

eddyb

eddyb commented on Apr 22, 2017

@eddyb
Member

@arielb1 Yeah I think we want to split it so the backend provides file -> metadata blob functionality, and librustc_metadata handles both finding the files and decoding the blob.

arielb1

arielb1 commented on Apr 22, 2017

@arielb1
Contributor

@eddyb

Yeah. That would also be the Right Thing for targets with "unconventional linking".

hanna-kruppe

hanna-kruppe commented on Apr 23, 2017

@hanna-kruppe
Contributor

This impacts me a lot, as essentially all my rustc work for the next few weeks or more consists of modifying LLVM, occasionally librustc_llvm, and rarely librustc_trans. So I'd volunteer to fix it. I could use some details on what this "file -> metadata blob" API should look like, though. Please elaborate here or ping me on IRC.

nagisa

nagisa commented on Apr 23, 2017

@nagisa
Member

@rkruppe maybe something like this?

// in metadata
trait MetadataStore {
    fn get_metadata(&self) -> Result<MetadataBlob, String>;
    ...
}

// in trans or somewhere else
impl MetadataStore for LlvmMetadataStore { ... }

// in driver
session.metadata_store_impl: Box<MetadataStore> = Box::new(LlvmMetadataStore);  // or something like that
added 2 commits that reference this issue on May 15, 2017

Rollup merge of rust-lang#41565 - rkruppe:llvm-sys, r=eddyb

4e61eb7

Rollup merge of rust-lang#41565 - rkruppe:llvm-sys, r=eddyb

3cadd37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @whitequark@eddyb@nagisa@arielb1@hanna-kruppe

      Issue actions

        librustc should not depend on librustc_llvm · Issue #41473 · rust-lang/rust