diff options
| author | A.J. Gardner <aaron.j.gardner@gmail.com> | 2017-04-07 09:46:34 -0500 |
|---|---|---|
| committer | A.J. Gardner <aaron.j.gardner@gmail.com> | 2017-04-13 00:49:13 -0500 |
| commit | 63a074791e587fa2cbb9d1b2bfdd08e08a001d9f (patch) | |
| tree | 10963a5692ce2e2175439032e042860add73cc3e | |
| parent | 24a89a015e93afb473c267dbddc5c856d62a639c (diff) | |
| download | rust-63a074791e587fa2cbb9d1b2bfdd08e08a001d9f.tar.gz rust-63a074791e587fa2cbb9d1b2bfdd08e08a001d9f.zip | |
Make simple_global_asm even simpler
Windows builder croaked. This change tries to fix that by actually calling the global_asm-defined function so the symbol doesn't get optimized away, if that is in fact what was happening. Additionally, we provide an empty main() for non-x86 arches.
| -rw-r--r-- | src/librustc/ich/impls_hir.rs | 3 | ||||
| -rw-r--r-- | src/librustc_metadata/schema.rs | 1 | ||||
| -rw-r--r-- | src/test/run-pass/simple_global_asm.rs | 8 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 5b8dc96f013..82e03a9fddc 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -881,6 +881,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for hir::Item { hir::ItemFn(..) | hir::ItemMod(..) | hir::ItemForeignMod(..) | + hir::ItemGlobalAsm(..) | hir::ItemTy(..) | hir::ItemEnum(..) | hir::ItemStruct(..) | @@ -925,6 +926,7 @@ impl_stable_hash_for!(enum hir::Item_ { ItemFn(fn_decl, unsafety, constness, abi, generics, body_id), ItemMod(module), ItemForeignMod(foreign_mod), + ItemGlobalAsm(global_asm), ItemTy(ty, generics), ItemEnum(enum_def, generics), ItemStruct(variant_data, generics), @@ -1083,6 +1085,7 @@ impl_stable_hash_for!(enum hir::def::Def { Upvar(def_id, index, expr_id), Label(node_id), Macro(def_id, macro_kind), + GlobalAsm(def_id), Err }); diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index ae20dd1a554..6cd35f1335e 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -298,6 +298,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for EntryKind<'tcx> { EntryKind::ForeignImmStatic | EntryKind::ForeignMutStatic | EntryKind::ForeignMod | + EntryKind::GlobalAsm | EntryKind::Field | EntryKind::Type => { // Nothing else to hash here. diff --git a/src/test/run-pass/simple_global_asm.rs b/src/test/run-pass/simple_global_asm.rs index a5ffe607fdf..ac2cacf3db2 100644 --- a/src/test/run-pass/simple_global_asm.rs +++ b/src/test/run-pass/simple_global_asm.rs @@ -9,19 +9,21 @@ // except according to those terms. #![feature(global_asm)] +#![feature(naked_functions)] #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] global_asm!(r#" .global foo foo: - jmp baz + ret "#); extern { fn foo(); } -#[no_mangle] -pub extern fn baz() {} +#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +fn main() { unsafe { foo(); } } +#[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))] fn main() {} |
