File: D92052.patch

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-20
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,436 kB
  • sloc: cpp: 5,593,990; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (77 lines) | stat: -rw-r--r-- 2,622 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Index: llvm/lib/MC/MCParser/ELFAsmParser.cpp
===================================================================
--- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp
@@ -652,10 +652,13 @@
       !(SectionName == ".eh_frame" && Type == ELF::SHT_PROGBITS))
     Error(loc, "changed section type for " + SectionName + ", expected: 0x" +
                    utohexstr(Section->getType()));
-  if (Section->getFlags() != Flags)
+  // Check that flags are used consistently. However, the GNU assembler permits
+  // to leave out in subsequent uses of the same sections; for compatibility,
+  // do likewise.
+  if ((Flags || Size || !TypeName.empty()) && Section->getFlags() != Flags)
     Error(loc, "changed section flags for " + SectionName + ", expected: 0x" +
                    utohexstr(Section->getFlags()));
-  if (Section->getEntrySize() != Size)
+  if ((Flags || Size || !TypeName.empty()) && Section->getEntrySize() != Size)
     Error(loc, "changed section entsize for " + SectionName +
                    ", expected: " + Twine(Section->getEntrySize()));
 
Index: llvm/test/MC/ELF/section-entsize-changed.s
===================================================================
--- a/llvm/test/MC/ELF/section-entsize-changed.s
+++ b/llvm/test/MC/ELF/section-entsize-changed.s
@@ -10,3 +10,26 @@
 .pushsection .foo,"aM",@progbits,4
 
 .pushsection .foo,"aM",@progbits,1
+
+
+bar:
+.section .bar,"ax",@progbits
+
+.section .bar
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section flags for .bar, expected: 0x6
+.section .bar,"awx",@progbits
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section flags for .bar, expected: 0x6
+.pushsection .bar,"a",@progbits
+
+.pushsection .bar
+
+foobar:
+.section .foobar,"ax",@progbits; .byte 1
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section flags for .foobar, expected: 0x6
+.section .foobar,"",@progbits; .byte 2
+
+# CHECK: {{.*}}.s:[[# @LINE+1]]:1: error: changed section flags for .foobar, expected: 0x6
+.section .foobar,"a",@progbits; .byte 3
Index: llvm/test/MC/ELF/section-omitted-attributes.s
===================================================================
--- /dev/null
+++ llvm/test/MC/ELF/section-omitted-attributes.s
@@ -0,0 +1,21 @@
+# RUN: llvm-mc -triple=x86_64 %s -o - | FileCheck %s
+
+// CHECK: .section        .foo,"aM",@progbits,1
+// CHECK: .section        .bar,"aM",@progbits,4
+
+foo:
+.section .foo,"aM",@progbits,1
+
+.section .foo
+
+.pushsection .foo
+
+.pushsection .foo
+
+.section .bar,"aM",@progbits,4
+
+.section .bar
+
+.pushsection .bar,"aM",@progbits,4
+
+.pushsection .bar