Skip to content

compiletest: add a proper supports-crate-type: xxx directive  #132309

Closed
@jieyouxu

Description

@jieyouxu

Apparently needs-dynamic-linking is not equivalent to checking if dylib or cdylib crate types are supported.

  • In compiletest, needs-dynamic-linking performs a check based on target cfg's dynamic_linking field + --print=cfg --target $TARGET.
  • However, target cfg has an additional field only_cdylib which, if dynamic_linking is true, indicates that only cdylib crate type is supported and not dylib.
    /// Whether dynamic linking is available on this target. Defaults to false.
    pub dynamic_linking: bool,
    /// Whether dynamic linking can export TLS globals. Defaults to true.
    pub dll_tls_export: bool,
    /// If dynamic linking is available, whether only cdylibs are supported.
    pub only_cdylib: bool,
    • This is the case for wasm base, dynamic linking is supported but not dylib crate type, only cdylib is supported.
      // we allow dynamic linking, but only cdylibs. Basically we allow a
      // final library artifact that exports some symbols (a wasm module) but
      // we don't allow intermediate `dylib` crate types
      dynamic_linking: true,
      only_cdylib: true,

Originally posted by @jieyouxu in #130860 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compiletestArea: The compiletest test runnerC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions