about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2021-04-11 20:51:28 +0100
committerAmanieu d'Antras <amanieu@gmail.com>2021-05-13 22:31:57 +0100
commit5918ee431717a276ea1a9c65d7c0009679a0643b (patch)
treeb9657afac0da6cacb582b6409db50281e8149f9a /src
parent952c5732c2d25a875f90e5cd5dd29a1a21c1d4a2 (diff)
Add support for const operands and options to global_asm!
On x86, the default syntax is also switched to Intel to match asm!
Diffstat (limited to 'src')
-rw-r--r--src/doc/unstable-book/src/library-features/global-asm.md20
-rw-r--r--src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs2
-rw-r--r--src/test/ui/macros/global-asm.rs4
-rw-r--r--src/test/ui/macros/global-asm.stderr6
4 files changed, 16 insertions, 16 deletions
diff --git a/src/doc/unstable-book/src/library-features/global-asm.md b/src/doc/unstable-book/src/library-features/global-asm.md
index ce1155a977c..e241f5788b9 100644
--- a/src/doc/unstable-book/src/library-features/global-asm.md
+++ b/src/doc/unstable-book/src/library-features/global-asm.md
@@ -38,11 +38,11 @@ And a more complicated usage looks like this:
 # mod x86 {
 
 pub mod sally {
-    global_asm!(r#"
-        .global foo
-      foo:
-        jmp baz
-    "#);
+    global_asm!(
+        ".global foo",
+        "foo:",
+        "jmp baz",
+    );
 
     #[no_mangle]
     pub unsafe extern "C" fn baz() {}
@@ -56,11 +56,11 @@ extern "C" {
 }
 
 pub mod harry {
-    global_asm!(r#"
-        .global bar
-      bar:
-        jmp quux
-    "#);
+    global_asm!(
+        ".global bar",
+        "bar:",
+        "jmp quux",
+    );
 
     #[no_mangle]
     pub unsafe extern "C" fn quux() {}
diff --git a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
index 8e91a8d842c..791dec2ed69 100644
--- a/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
+++ b/src/test/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs
@@ -8,7 +8,7 @@ rust_plus_one_global_asm:
     movl (%rdi), %eax
     inc %eax
     retq
-"# );
+"#, options(att_syntax));
 
 extern {
     fn cc_plus_one_c(arg : &u32) -> u32;
diff --git a/src/test/ui/macros/global-asm.rs b/src/test/ui/macros/global-asm.rs
index 8402afa5085..b8903e07cfd 100644
--- a/src/test/ui/macros/global-asm.rs
+++ b/src/test/ui/macros/global-asm.rs
@@ -1,7 +1,7 @@
 #![feature(global_asm)]
 
 fn main() {
-    global_asm!();  //~ ERROR requires a string literal as an argument
+    global_asm!();  //~ ERROR requires at least a template string argument
     global_asm!(struct); //~ ERROR expected expression
-    global_asm!(123); //~ ERROR inline assembly must be a string literal
+    global_asm!(123); //~ ERROR asm template must be a string literal
 }
diff --git a/src/test/ui/macros/global-asm.stderr b/src/test/ui/macros/global-asm.stderr
index c43bf83fe19..a8621a0c518 100644
--- a/src/test/ui/macros/global-asm.stderr
+++ b/src/test/ui/macros/global-asm.stderr
@@ -1,8 +1,8 @@
-error: macro requires a string literal as an argument
+error: requires at least a template string argument
   --> $DIR/global-asm.rs:4:5
    |
 LL |     global_asm!();
-   |     ^^^^^^^^^^^^^^ string literal required
+   |     ^^^^^^^^^^^^^^
 
 error: expected expression, found keyword `struct`
   --> $DIR/global-asm.rs:5:17
@@ -10,7 +10,7 @@ error: expected expression, found keyword `struct`
 LL |     global_asm!(struct);
    |                 ^^^^^^ expected expression
 
-error: inline assembly must be a string literal
+error: asm template must be a string literal
   --> $DIR/global-asm.rs:6:17
    |
 LL |     global_asm!(123);