/src/test/codegen/global_asm_include.rs

https://gitlab.com/jianglu/rust · Rust · 66 lines · 8 code · 5 blank · 53 comment · 0 complexity · 596a7cdf0589320a4e9fe6ce6a1580dd MD5 · raw file

  1. // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
  2. // file at the top-level directory of this distribution and at
  3. // http://rust-lang.org/COPYRIGHT.
  4. //
  5. // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. // option. This file may not be copied, modified, or distributed
  9. // except according to those terms.
  10. // ignore-aarch64
  11. // ignore-aarch64_be
  12. // ignore-arm
  13. // ignore-armeb
  14. // ignore-avr
  15. // ignore-bpfel
  16. // ignore-bpfeb
  17. // ignore-hexagon
  18. // ignore-mips
  19. // ignore-mips64
  20. // ignore-msp430
  21. // ignore-powerpc64
  22. // ignore-powerpc64le
  23. // ignore-powerpc
  24. // ignore-r600
  25. // ignore-amdgcn
  26. // ignore-sparc
  27. // ignore-sparcv9
  28. // ignore-sparcel
  29. // ignore-s390x
  30. // ignore-tce
  31. // ignore-thumb
  32. // ignore-thumbeb
  33. // ignore-xcore
  34. // ignore-nvptx
  35. // ignore-nvptx64
  36. // ignore-le32
  37. // ignore-le64
  38. // ignore-amdil
  39. // ignore-amdil64
  40. // ignore-hsail
  41. // ignore-hsail64
  42. // ignore-spir
  43. // ignore-spir64
  44. // ignore-kalimba
  45. // ignore-shave
  46. // ignore-wasm32
  47. // ignore-wasm64
  48. // ignore-emscripten
  49. // compile-flags: -C no-prepopulate-passes
  50. #![feature(global_asm)]
  51. #![crate_type = "lib"]
  52. // CHECK-LABEL: foo
  53. // CHECK: module asm
  54. // CHECK: module asm "{{[[:space:]]+}}jmp baz"
  55. global_asm!(include_str!("foo.s"));
  56. extern "C" {
  57. fn foo();
  58. }
  59. // CHECK-LABEL: @baz
  60. #[no_mangle]
  61. pub unsafe extern "C" fn baz() {}