Skip to content

Commit bd0d048

Browse files
authored
Revert "MC: Support quoted symbol names" (#139296)
Reverts #138817 The BOLT testing is failing after this change.
1 parent 65a6cbd commit bd0d048

File tree

5 files changed

+5
-47
lines changed

5 files changed

+5
-47
lines changed

llvm/lib/MC/MCContext.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -212,27 +212,6 @@ MCDataFragment *MCContext::allocInitialFragment(MCSection &Sec) {
212212
MCSymbol *MCContext::getOrCreateSymbol(const Twine &Name) {
213213
SmallString<128> NameSV;
214214
StringRef NameRef = Name.toStringRef(NameSV);
215-
if (NameRef.contains('\\')) {
216-
NameSV = NameRef;
217-
size_t S = 0;
218-
// Support escaped \\ and \" as in GNU Assembler. GAS issues a warning for
219-
// other characters following \\, which we do not implement due to code
220-
// structure.
221-
for (size_t I = 0, E = NameSV.size(); I < E; ++I) {
222-
char C = NameSV[I];
223-
if (C == '\\') {
224-
switch (NameSV[I + 1]) {
225-
case '"':
226-
case '\\':
227-
C = NameSV[++I];
228-
break;
229-
}
230-
}
231-
NameSV[S++] = C;
232-
}
233-
NameSV.resize(S);
234-
NameRef = NameSV;
235-
}
236215

237216
assert(!NameRef.empty() && "Normal symbols cannot be unnamed!");
238217

llvm/lib/MC/MCSymbol.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ void MCSymbol::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
7474
OS << "\\n";
7575
else if (C == '"')
7676
OS << "\\\"";
77-
else if (C == '\\')
78-
OS << "\\\\";
7977
else
8078
OS << C;
8179
}

llvm/test/MC/AsmParser/quoted.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"a b":
1010
call "a b"
1111

12-
# CHECK: "a b\\":
13-
"a b\\":
14-
1512
#--- err.s
1613
"a\":
1714
# ERR: 1:2: error: unterminated string constant

llvm/test/MC/COFF/safeseh.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
// check that we quote the output of .safeseh
44

5-
.safeseh "\\foo"
6-
// CHECK: .safeseh "\\foo"
5+
.safeseh "\01foo"
6+
// CHECK: .safeseh "\01foo"

llvm/test/MC/ELF/symbol-names.s

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
1-
// RUN: llvm-mc -triple=x86_64 -filetype=obj %s | llvm-objdump -tdr - | FileCheck %s
1+
// RUN: llvm-mc -triple i686-pc-linux -filetype=obj %s -o - | llvm-readobj --symbols - | FileCheck %s
22

33
// MC allows ?'s in symbol names as an extension.
44

5-
// CHECK-LABEL:SYMBOL TABLE:
6-
// CHECK-NEXT: 0000000000000001 l F .text 0000000000000000 a"b\{{$}}
7-
// CHECK-NEXT: 0000000000000006 l .text 0000000000000000 a\{{$}}
8-
// CHECK-NEXT: 0000000000000000 g F .text 0000000000000000 foo?bar
9-
// CHECK-NEXT: 0000000000000000 *UND* 0000000000000000 a"b\q{{$}}
10-
// CHECK-EMPTY:
11-
125
.text
136
.globl foo?bar
147
.type foo?bar, @function
158
foo?bar:
169
ret
1710

18-
// CHECK-LABEL:<a"b\>:
19-
// CHECK-NEXT: callq {{.*}} <a"b\>
20-
// CHECK-LABEL:<a\>:
21-
// CHECK-NEXT: callq {{.*}}
22-
// CHECK-NEXT: R_X86_64_PLT32 a"b\q-0x4
23-
.type "a\"b\\", @function
24-
"a\"b\\":
25-
call "a\"b\\"
26-
"a\\":
27-
/// GAS emits a warning for \q
28-
call "a\"b\q"
11+
// CHECK: Symbol
12+
// CHECK: Name: foo?bar

0 commit comments

Comments
 (0)