Blob Blame History Raw
From 946b5c2563dbf7d8969781e6b05d9fc531cd65a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=A1s=20Ojeda=20B=C3=A4r?= <n.oje.bar@gmail.com>
Date: Sun, 19 Apr 2020 11:17:00 +0200
Subject: [PATCH 7/7] x86 asm: handle unit names with special characters
 (#9465)

(cherry picked from commit ec6690fb53b6caced797e1a7a083a787ff8bd97c)
---
 asmcomp/amd64/emit.mlp                             |  2 +-
 testsuite/tests/asmcomp/0-!@#%.compilers.reference |  2 ++
 testsuite/tests/asmcomp/0-!@#%.ml                  | 10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 testsuite/tests/asmcomp/0-!@#%.compilers.reference
 create mode 100644 testsuite/tests/asmcomp/0-!@#%.ml

diff --git a/asmcomp/amd64/emit.mlp b/asmcomp/amd64/emit.mlp
index 2e9e3a86d..d9c5eb6e6 100644
--- a/asmcomp/amd64/emit.mlp
+++ b/asmcomp/amd64/emit.mlp
@@ -1146,7 +1146,7 @@ let end_assembly() =
     };
 
   if system = S_linux then begin
-    let frametable = Compilenv.make_symbol (Some "frametable") in
+    let frametable = emit_symbol (Compilenv.make_symbol (Some "frametable")) in
     D.size frametable (ConstSub (ConstThis, ConstLabel frametable))
   end;
 
diff --git a/testsuite/tests/asmcomp/0-!@#%.compilers.reference b/testsuite/tests/asmcomp/0-!@#%.compilers.reference
new file mode 100644
index 000000000..7df9a5456
--- /dev/null
+++ b/testsuite/tests/asmcomp/0-!@#%.compilers.reference
@@ -0,0 +1,2 @@
+File "0-!@#%.ml", line 1:
+Warning 24: bad source file name: "0-!@#%" is not a valid module name.
diff --git a/testsuite/tests/asmcomp/0-!@#%.ml b/testsuite/tests/asmcomp/0-!@#%.ml
new file mode 100644
index 000000000..9f24bc382
--- /dev/null
+++ b/testsuite/tests/asmcomp/0-!@#%.ml
@@ -0,0 +1,10 @@
+(* TEST *)
+
+(* We could not include the following characters the file name:
+
+   - '$' : this character is interpreted specially by [ocamltest] (as it uses
+     [Buffer.add_substitute] on the filenames).
+
+   - '^' : this character causes problems under Windows if not properly
+     quoted. In particular, flexlink needed to be adapted.
+*)
-- 
2.24.1