Stablize raw-dylib, link_ordinal and -Cdlltool
This commit is contained in:
parent
de96f3d873
commit
1ece1ea48c
62 changed files with 146 additions and 223 deletions
|
@ -24,7 +24,7 @@ codegen_llvm_error_writing_def_file =
|
|||
Error writing .DEF file: {$error}
|
||||
|
||||
codegen_llvm_error_calling_dlltool =
|
||||
Error calling dlltool: {$error}
|
||||
Error calling dlltool '{$dlltool_path}': {$error}
|
||||
|
||||
codegen_llvm_dlltool_fail_import_library =
|
||||
Dlltool could not create import library: {$stdout}
|
||||
|
|
|
@ -198,7 +198,7 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
|
|||
"arm" => ("arm", "--32"),
|
||||
_ => panic!("unsupported arch {}", sess.target.arch),
|
||||
};
|
||||
let result = std::process::Command::new(dlltool)
|
||||
let result = std::process::Command::new(&dlltool)
|
||||
.args([
|
||||
"-d",
|
||||
def_file_path.to_str().unwrap(),
|
||||
|
@ -218,9 +218,13 @@ impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder {
|
|||
|
||||
match result {
|
||||
Err(e) => {
|
||||
sess.emit_fatal(ErrorCallingDllTool { error: e });
|
||||
sess.emit_fatal(ErrorCallingDllTool {
|
||||
dlltool_path: dlltool.to_string_lossy(),
|
||||
error: e,
|
||||
});
|
||||
}
|
||||
Ok(output) if !output.status.success() => {
|
||||
// dlltool returns '0' on failure, so check for error output instead.
|
||||
Ok(output) if !output.stderr.is_empty() => {
|
||||
sess.emit_fatal(DlltoolFailImportLibrary {
|
||||
stdout: String::from_utf8_lossy(&output.stdout),
|
||||
stderr: String::from_utf8_lossy(&output.stderr),
|
||||
|
@ -431,7 +435,7 @@ fn string_to_io_error(s: String) -> io::Error {
|
|||
|
||||
fn find_binutils_dlltool(sess: &Session) -> OsString {
|
||||
assert!(sess.target.options.is_like_windows && !sess.target.options.is_like_msvc);
|
||||
if let Some(dlltool_path) = &sess.opts.unstable_opts.dlltool {
|
||||
if let Some(dlltool_path) = &sess.opts.cg.dlltool {
|
||||
return dlltool_path.clone().into_os_string();
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ pub(crate) struct ErrorWritingDEFFile {
|
|||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(codegen_llvm_error_calling_dlltool)]
|
||||
pub(crate) struct ErrorCallingDllTool {
|
||||
pub(crate) struct ErrorCallingDllTool<'a> {
|
||||
pub dlltool_path: Cow<'a, str>,
|
||||
pub error: std::io::Error,
|
||||
}
|
||||
|
||||
|
|
|
@ -594,15 +594,6 @@ fn should_inherit_track_caller(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
|||
|
||||
fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option<u16> {
|
||||
use rustc_ast::{LitIntType, LitKind, MetaItemLit};
|
||||
if !tcx.features().raw_dylib && tcx.sess.target.arch == "x86" {
|
||||
feature_err(
|
||||
&tcx.sess.parse_sess,
|
||||
sym::raw_dylib,
|
||||
attr.span,
|
||||
"`#[link_ordinal]` is unstable on x86",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
let meta_item_list = attr.meta_item_list();
|
||||
let meta_item_list = meta_item_list.as_deref();
|
||||
let sole_meta_list = match meta_item_list {
|
||||
|
|
|
@ -278,6 +278,8 @@ declare_features! (
|
|||
(accepted, pub_restricted, "1.18.0", Some(32409), None),
|
||||
/// Allows use of the postfix `?` operator in expressions.
|
||||
(accepted, question_mark, "1.13.0", Some(31436), None),
|
||||
/// Allows the use of raw-dylibs (RFC 2627).
|
||||
(accepted, raw_dylib, "CURRENT_RUSTC_VERSION", Some(58713), None),
|
||||
/// Allows keywords to be escaped for use as identifiers.
|
||||
(accepted, raw_identifiers, "1.30.0", Some(48589), None),
|
||||
/// Allows relaxing the coherence rules such that
|
||||
|
|
|
@ -485,8 +485,6 @@ declare_features! (
|
|||
(active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
|
||||
/// Allows macro attributes on expressions, statements and non-inline modules.
|
||||
(active, proc_macro_hygiene, "1.30.0", Some(54727), None),
|
||||
/// Allows the use of raw-dylibs (RFC 2627).
|
||||
(active, raw_dylib, "1.65.0", Some(58713), None),
|
||||
/// Allows `&raw const $place_expr` and `&raw mut $place_expr` expressions.
|
||||
(active, raw_ref_op, "1.41.0", Some(64490), None),
|
||||
/// Allows using the `#[register_tool]` attribute.
|
||||
|
|
|
@ -547,6 +547,7 @@ fn test_codegen_options_tracking_hash() {
|
|||
untracked!(ar, String::from("abc"));
|
||||
untracked!(codegen_units, Some(42));
|
||||
untracked!(default_linker_libraries, true);
|
||||
untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe")));
|
||||
untracked!(extra_filename, String::from("extra-filename"));
|
||||
untracked!(incremental, Some(String::from("abc")));
|
||||
// `link_arg` is omitted because it just forwards to `link_args`.
|
||||
|
@ -651,7 +652,6 @@ fn test_unstable_options_tracking_hash() {
|
|||
untracked!(assert_incr_state, Some(String::from("loaded")));
|
||||
untracked!(deduplicate_diagnostics, false);
|
||||
untracked!(dep_tasks, true);
|
||||
untracked!(dlltool, Some(PathBuf::from("custom_dlltool.exe")));
|
||||
untracked!(dont_buffer_diagnostics, true);
|
||||
untracked!(dump_dep_graph, true);
|
||||
untracked!(dump_drop_tracking_cfg, Some("cfg.dot".to_string()));
|
||||
|
|
|
@ -161,14 +161,6 @@ impl<'tcx> Collector<'tcx> {
|
|||
"raw-dylib" => {
|
||||
if !sess.target.is_like_windows {
|
||||
sess.emit_err(errors::FrameworkOnlyWindows { span });
|
||||
} else if !features.raw_dylib && sess.target.arch == "x86" {
|
||||
feature_err(
|
||||
&sess.parse_sess,
|
||||
sym::raw_dylib,
|
||||
span,
|
||||
"link kind `raw-dylib` is unstable on x86",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
NativeLibKind::RawDylib
|
||||
}
|
||||
|
@ -251,16 +243,6 @@ impl<'tcx> Collector<'tcx> {
|
|||
continue;
|
||||
}
|
||||
};
|
||||
if !features.raw_dylib {
|
||||
let span = item.name_value_literal_span().unwrap();
|
||||
feature_err(
|
||||
&sess.parse_sess,
|
||||
sym::raw_dylib,
|
||||
span,
|
||||
"import name type is unstable",
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
import_name_type = Some((link_import_name_type, item.span()));
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -1235,6 +1235,8 @@ options! {
|
|||
line-tables-only, limited, or full; default: 0)"),
|
||||
default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
|
||||
"allow the linker to link its default libraries (default: no)"),
|
||||
dlltool: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
|
||||
"import library generation tool (ignored except when targeting windows-gnu)"),
|
||||
embed_bitcode: bool = (true, parse_bool, [TRACKED],
|
||||
"emit bitcode in rlibs (default: yes)"),
|
||||
extra_filename: String = (String::new(), parse_string, [UNTRACKED],
|
||||
|
@ -1391,8 +1393,6 @@ options! {
|
|||
(default: no)"),
|
||||
diagnostic_width: Option<usize> = (None, parse_opt_number, [UNTRACKED],
|
||||
"set the current output width for diagnostic truncation"),
|
||||
dlltool: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
|
||||
"import library generation tool (windows-gnu only)"),
|
||||
dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
|
||||
"emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
|
||||
(default: no)"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue