]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/patches/patch-r281775-llvm-r229911-uleb128-commas.diff
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / patches / patch-r281775-llvm-r229911-uleb128-commas.diff
1 Pull in r229911 from upstream llvm trunk (by Benjamin Kramer):
2
3   MC: Allow multiple comma-separated expressions on the .uleb128 directive.
4
5   For compatiblity with GNU as. Binutils documents this as
6   '.uleb128 expressions'. Subtle, isn't it?
7
8 Introduced here: http://svnweb.freebsd.org/changeset/base/281775
9
10 Index: lib/MC/MCParser/AsmParser.cpp
11 ===================================================================
12 --- lib/MC/MCParser/AsmParser.cpp
13 +++ lib/MC/MCParser/AsmParser.cpp
14 @@ -3636,22 +3636,28 @@ bool AsmParser::parseDirectiveSpace(StringRef IDVa
15  }
16  
17  /// parseDirectiveLEB128
18 -/// ::= (.sleb128 | .uleb128) expression
19 +/// ::= (.sleb128 | .uleb128) [ expression (, expression)* ]
20  bool AsmParser::parseDirectiveLEB128(bool Signed) {
21    checkForValidSection();
22    const MCExpr *Value;
23  
24 -  if (parseExpression(Value))
25 -    return true;
26 +  for (;;) {
27 +    if (parseExpression(Value))
28 +      return true;
29  
30 -  if (getLexer().isNot(AsmToken::EndOfStatement))
31 -    return TokError("unexpected token in directive");
32 +    if (Signed)
33 +      getStreamer().EmitSLEB128Value(Value);
34 +    else
35 +      getStreamer().EmitULEB128Value(Value);
36  
37 -  if (Signed)
38 -    getStreamer().EmitSLEB128Value(Value);
39 -  else
40 -    getStreamer().EmitULEB128Value(Value);
41 +    if (getLexer().is(AsmToken::EndOfStatement))
42 +      break;
43  
44 +    if (getLexer().isNot(AsmToken::Comma))
45 +      return TokError("unexpected token in directive");
46 +    Lex();
47 +  }
48 +
49    return false;
50  }
51  
52 Index: test/MC/ELF/uleb.s
53 ===================================================================
54 --- test/MC/ELF/uleb.s
55 +++ test/MC/ELF/uleb.s
56 @@ -11,16 +11,17 @@ foo:
57         .uleb128        128
58         .uleb128        16383
59         .uleb128        16384
60 +        .uleb128       23, 42
61  
62  // ELF_32:   Name: .text
63  // ELF_32:   SectionData (
64 -// ELF_32:     0000: 00017F80 01FF7F80 8001
65 +// ELF_32:     0000: 00017F80 01FF7F80 8001172A
66  // ELF_32:   )
67  // ELF_64:   Name: .text
68  // ELF_64:   SectionData (
69 -// ELF_64:     0000: 00017F80 01FF7F80 8001
70 +// ELF_64:     0000: 00017F80 01FF7F80 8001172A
71  // ELF_64:   )
72  // MACHO_32: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
73 -// MACHO_32: ('_section_data', '00017f80 01ff7f80 8001')
74 +// MACHO_32: ('_section_data', '00017f80 01ff7f80 8001172a')
75  // MACHO_64: ('section_name', '__text\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
76 -// MACHO_64: ('_section_data', '00017f80 01ff7f80 8001')
77 +// MACHO_64: ('_section_data', '00017f80 01ff7f80 8001172a')