summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-10-07 19:37:57 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-10-07 19:37:57 +0000
commit64d491e488f1aabd862bc787b9cab6c64fc9d04b (patch)
tree98151293e678afb03de363a685a406bb18545077 /llvm/test
parentf95786324c233dcfa28da5fea929e62bc50b4083 (diff)
downloadbcm5719-llvm-64d491e488f1aabd862bc787b9cab6c64fc9d04b.tar.gz
bcm5719-llvm-64d491e488f1aabd862bc787b9cab6c64fc9d04b.zip
MC: add support for -aligncomm GNU extension
The GNU linker supports an -aligncomm directive that allows for power-of-2 alignment of common data. Add support to emit this directive. llvm-svn: 219229
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/MC/COFF/comm-align.s50
1 files changed, 50 insertions, 0 deletions
diff --git a/llvm/test/MC/COFF/comm-align.s b/llvm/test/MC/COFF/comm-align.s
new file mode 100644
index 00000000000..e658c5685d3
--- /dev/null
+++ b/llvm/test/MC/COFF/comm-align.s
@@ -0,0 +1,50 @@
+# RUN: llvm-mc -triple i686-windows-gnu -filetype obj -o - %s \
+# RUN: | llvm-readobj -coff-directives -symbols | FileCheck %s
+
+# NOTE: this test checks multiple things:
+# - that -aligncomm is not emitted for 1-byte alignment
+# - that -aligncomm is emitted for the various alignments (greater than 1)
+# - that the alignment is represented as a log_2 of the alignment
+# - that the section switching occurs correctly
+# - that functions after the switch also are emitted into the correct section
+
+ .text
+
+ .def _a
+ .scl 3
+ .type 32
+ .endef
+_a:
+ ret
+
+ .data
+
+ .comm _s_1,4,0 # @s_1
+ .comm _s_2,4,1 # @s_2
+ .comm _s_4,4,2 # @s_3
+ .comm _s_8,4,3 # @s_4
+
+ .text
+
+ .def _b
+ .scl 3
+ .type 32
+ .endef
+_b:
+ ret
+
+# CHECK-NOT: -aligncomm:"_s_1",0
+
+# CHECK: Symbols [
+# CHECK: Symbol {
+# CHECK: Name: _a
+# CHECK: Section: .text (1)
+# CHECK: }
+# CHECK: Symbol {
+# CHECK: Name: _b
+# CHECK: Section: .text (1)
+# CHECK: }
+# CHECK: ]
+
+# CHECK: Directive(s): -aligncomm:"_s_2",1 -aligncomm:"_s_4",2 -aligncomm:"_s_8",3
+
OpenPOWER on IntegriCloud