summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/native_libs.rs
AgeCommit message (Collapse)AuthorLines
2022-09-16Rollup merge of #101738 - dpaoliello:linkname, r=petrochenkovDylan DPC-4/+3
Fix `#[link kind="raw-dylib"]` to respect `#[link_name]` Issue Details: When using `#[link kind="raw-dylib"]` (#58713), the Rust compiler ignored any `#[link_name]` attributes when generating the import library and so the resulting binary would fail to link due to missing symbols. Fix Details: Use the name from `#[link_name]` if present when generating the `raw-dylib` import library, otherwise default back to the actual symbol name.
2022-09-12Fix raw-dylib with link_nameDaniel Paoliello-4/+3
2022-09-12change rlib format to discern native dependenciesDaniil Belov-8/+73
2022-09-09Stabilze raw-dylib for non-x86Daniel Paoliello-2/+2
2022-08-31port 5 new diagnostics that appeared in masterNathan Stocks-20/+16
2022-08-31respond to review feedback: mainly eliminate as many conversions as possible...Nathan Stocks-12/+6
- ... when creating diagnostics in rustc_metadata - use the error_code! macro - pass macro output to diag.code() - use fluent from within manual implementation of SessionDiagnostic - emit the untested errors in case they occur in the wild - stop panicking in the probably-not-dead code, add fixme to write test
2022-08-31port of locator.rs to SessionDiagnostics, fix some of the errorsNathan Stocks-1/+0
revealed by tests, manually add a panic to test for dead code
2022-08-31port native_libs.rs to SessionDiagnosticsNathan Stocks-128/+54
2022-08-26Implementation of import_name_typeDaniel Paoliello-5/+74
2022-08-09Add error if link_ordinal used without raw-dylibDaniel Paoliello-1/+25
2022-07-26Fix vectorcallDaniel Paoliello-1/+3
2022-06-09Stabilize the `bundle` native library modifierVadim Petrochenkov-19/+0
2022-05-23rustc: Fix ICE in native library error reportingVadim Petrochenkov-4/+5
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-2/+2
2022-05-15rustc: Stricter checking for #[link] attributesVadim Petrochenkov-240/+274
2022-05-06use def_span and def_kind queries instead of calling tcx.hir() methodsMiguel Guarniz-1/+1
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08remove ItemLikeVisitor impls in incremental, interface, metadata and ↵Miguel Guarniz-11/+9
symbol_mangling crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-04-08remove some uses of visit_all_item_likes in incremental, metadata and ↵Miguel Guarniz-1/+4
interface crates Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-03-30Stabilize native library modifier syntax and the `whole-archive` modifier ↵Vadim Petrochenkov-2/+40
specifically
2022-03-16rustc_error: make ErrorReported impossible to constructmark-20/+30
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-07Clarify `Layout` interning.Nicholas Nethercote-1/+1
`Layout` is another type that is sometimes interned, sometimes not, and we always use references to refer to it so we can't take any advantage of the uniqueness properties for hashing or equality checks. This commit renames `Layout` as `LayoutS`, and then introduces a new `Layout` that is a newtype around an `Interned<LayoutS>`. It also interns more layouts than before. Previously layouts within layouts (via the `variants` field) were never interned, but now they are. Hence the lifetime on the new `Layout` type. Unlike other interned types, these ones are in `rustc_target` instead of `rustc_middle`. This reflects the existing structure of the code, which does layout-specific stuff in `rustc_target` while `TyAndLayout` is generic over the `Ty`, allowing the type-specific stuff to occur in `rustc_middle`. The commit also adds a `HashStable` impl for `Interned`, which was needed. It hashes the contents, unlike the `Hash` impl which hashes the pointer.
2022-03-01Improve allowness of the unexpected_cfgs lintLoïc BRANSTETT-1/+2
2022-02-23rustc_errors: let `DiagnosticBuilder::emit` return a "guarantee of emission".Eduard-Mihai Burtescu-1/+3
2022-02-19Adopt let else in more placesest31-17/+10
2022-02-02Add more *-unwind ABI variantsAmanieu d'Antras-3/+5
The following *-unwind ABIs are now supported: - "C-unwind" - "cdecl-unwind" - "stdcall-unwind" - "fastcall-unwind" - "vectorcall-unwind" - "thiscall-unwind" - "aapcs-unwind" - "win64-unwind" - "sysv64-unwind" - "system-unwind"
2022-01-18Rollup merge of #90782 - ricobbe:binutils-dlltool, r=michaelwoeristerMatthias Krüger-5/+0
Implement raw-dylib support for windows-gnu Add support for `#[link(kind = "raw-dylib")]` on windows-gnu targets. Work around binutils's linker's inability to read import libraries produced by LLVM by calling out to the binutils `dlltool` utility to create an import library from a temporary .DEF file; this approach is effectively a slightly refined version of `@mati865's` earlier attempt at this strategy in PR #88801. (In particular, this attempt at this strategy adds support for `#[link_ordinal(...)]` as well.) In support of #58713.
2022-01-12Call out to binutils' dlltool for raw-dylib on windows-gnu platforms.Richard Cobbe-5/+0
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-1/+1
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
2021-12-14Remove `in_band_lifetimes` from `rustc_metadata`Sylvan Bowdler-2/+2
2021-12-09Remove redundant [..]sest31-1/+1
2021-11-07more clippy fixesMatthias Krüger-1/+1
2021-10-08Rollup merge of #89649 - matthiaskrgr:clippycompl, r=jyn514Guillaume Gomez-1/+1
clippy::complexity fixes
2021-10-08clippy::complexity fixesMatthias Krüger-1/+1
2021-10-07Rollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoeristerJubilee-1/+7
Implement `#[link_ordinal(n)]` Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name. As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL. Part of #58713.
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-1/+1
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-1/+1
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-2/+2
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-1/+1
2021-09-20Implement #[link_ordinal] attribute in the context of #[link(kind = ↵Richard Cobbe-1/+7
"raw-dylib")].
2021-09-20Do not store visibility in *ItemRef.Camille GILLOT-2/+2
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-2/+1
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-08 Fix feature gate checking of static-nobundle and native_link_modifiers12101111-11/+9
2021-07-09Add support for raw-dylib with stdcall, fastcall functions on ↵Richard Cobbe-15/+57
i686-pc-windows-msvc.
2021-06-04Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe-11/+61
"raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
2021-05-05Implement RFC 2951: Native link modifiersLuqman Aden-22/+100
This commit implements both the native linking modifiers infrastructure as well as an initial attempt at the individual modifiers from the RFC. It also introduces a feature flag for the general syntax along with individual feature flags for each modifier.
2021-03-09Remove hir::Item::attrs.Camille GILLOT-1/+2
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-1/+1
Items are guaranteed to be HIR owner.
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-1/+1
2021-01-02reduce borrowing and (de)referencing around match patterns ↵Matthias Krüger-4/+4
(clippy::match_ref_pats)