summaryrefslogtreecommitdiff
path: root/test/MC/ARM/eh-directive-section.s
diff options
context:
space:
mode:
authorLogan Chien <tzuhsiang.chien@gmail.com>2013-05-10 16:17:24 +0000
committerLogan Chien <tzuhsiang.chien@gmail.com>2013-05-10 16:17:24 +0000
commitc24a374331fc97dd215937c8f0a9bf5271f39657 (patch)
tree8b45dc88291c6b9a7da543364389118c4e278a8b /test/MC/ARM/eh-directive-section.s
parent2e2c12b9961647987692389bc3cc25eae9220d26 (diff)
downloadllvm-c24a374331fc97dd215937c8f0a9bf5271f39657.tar.gz
llvm-c24a374331fc97dd215937c8f0a9bf5271f39657.tar.bz2
llvm-c24a374331fc97dd215937c8f0a9bf5271f39657.tar.xz
Implement AsmParser for ARM unwind directives.
This commit implements the AsmParser for fnstart, fnend, cantunwind, personality, handlerdata, pad, setfp, save, and vsave directives. This commit fixes some minor issue in the ARMELFStreamer: * The switch back to corresponding section after the .fnend directive. * Emit the unwind opcode while processing .fnend directive if there is no .handlerdata directive. * Emit the unwind opcode to .ARM.extab while processing .handlerdata even if .personality directive does not exist. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181603 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/ARM/eh-directive-section.s')
-rw-r--r--test/MC/ARM/eh-directive-section.s164
1 files changed, 164 insertions, 0 deletions
diff --git a/test/MC/ARM/eh-directive-section.s b/test/MC/ARM/eh-directive-section.s
new file mode 100644
index 0000000000..5f5d1252f8
--- /dev/null
+++ b/test/MC/ARM/eh-directive-section.s
@@ -0,0 +1,164 @@
+@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
+@ RUN: | llvm-readobj -s -sd -sr -t | FileCheck %s
+
+@ Check the combination of .section, .fnstart, and .fnend directives.
+
+@ For the functions in .text section, the exception handling index (EXIDX)
+@ should be generated in .ARM.exidx, and the exception handling table (EXTAB)
+@ should be generated in .ARM.extab.
+
+@ For the functions in custom section specified by .section directives,
+@ the EXIDX should be generated in ".ARM.exidx[[SECTION_NAME]]", and the EXTAB
+@ should be generated in ".ARM.extab[[SECTION_NAME]]".
+
+ .syntax unified
+
+@-------------------------------------------------------------------------------
+@ .TEST1 section
+@-------------------------------------------------------------------------------
+ .section .TEST1
+ .globl func1
+ .align 2
+ .type func1,%function
+ .fnstart
+func1:
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+
+@-------------------------------------------------------------------------------
+@ TEST2 section (without the dot in the beginning)
+@-------------------------------------------------------------------------------
+ .section TEST2
+ .globl func2
+ .align 2
+ .type func2,%function
+ .fnstart
+func2:
+ bx lr
+ .personality __gxx_personality_v0
+ .handlerdata
+ .fnend
+
+
+@-------------------------------------------------------------------------------
+@ Check the .TEST1 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Sections [
+@ CHECK: Section {
+@ CHECK: Index: 4
+@ CHECK: Name: .TEST1
+@ CHECK: SectionData (
+@ CHECK: 0000: 1EFF2FE1 |../.|
+@ CHECK: )
+@ CHECK: }
+
+@-------------------------------------------------------------------------------
+@ Check the .ARM.extab.TEST1 section, the EXTAB of .TEST1 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extab.TEST1
+@ CHECK: Relocations [
+@ CHECK: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK: ]
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0B0B000 |........|
+@ CHECK: )
+@ CHECK: }
+
+
+@-------------------------------------------------------------------------------
+@ Check the.ARM.exidx.TEST1 section, the EXIDX of .TEST1 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Section {
+@ CHECK: Name: .ARM.exidx.TEST1
+
+@-------------------------------------------------------------------------------
+@ This section should linked with .TEST1 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Link: 4
+
+@-------------------------------------------------------------------------------
+@ The first word should be relocated to the code address in .TEST1 section.
+@ The second word should be relocated to the EHTAB entry in .ARM.extab.TEST1
+@ section.
+@-------------------------------------------------------------------------------
+@ CHECK: Relocations [
+@ CHECK: 0x0 R_ARM_PREL31 .TEST1 0x0
+@ CHECK: 0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0
+@ CHECK: ]
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 00000000 |........|
+@ CHECK: )
+@ CHECK: }
+
+
+
+@-------------------------------------------------------------------------------
+@ Check the TEST2 section (without the dot in the beginning)
+@-------------------------------------------------------------------------------
+@ CHECK: Section {
+@ CHECK: Index: 9
+@ CHECK: Name: TEST2
+@ CHECK: SectionData (
+@ CHECK: 0000: 1EFF2FE1 |../.|
+@ CHECK: )
+@ CHECK: }
+
+@-------------------------------------------------------------------------------
+@ Check the .ARM.extabTEST2 section, the EXTAB of TEST2 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Section {
+@ CHECK: Name: .ARM.extabTEST2
+@ CHECK: Relocations [
+@ CHECK: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0
+@ CHECK: ]
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 B0B0B000 |........|
+@ CHECK: )
+@ CHECK: }
+
+
+@-------------------------------------------------------------------------------
+@ Check the .ARM.exidxTEST2 section, the EXIDX of TEST2 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Section {
+@ CHECK: Name: .ARM.exidxTEST2
+
+@-------------------------------------------------------------------------------
+@ This section should linked with TEST2 section.
+@-------------------------------------------------------------------------------
+@ CHECK: Link: 9
+
+@-------------------------------------------------------------------------------
+@ The first word should be relocated to the code address in TEST2 section.
+@ The second word should be relocated to the EHTAB entry in .ARM.extabTEST2
+@ section.
+@-------------------------------------------------------------------------------
+@ CHECK: Relocations [
+@ CHECK: 0x0 R_ARM_PREL31 TEST2 0x0
+@ CHECK: 0x4 R_ARM_PREL31 .ARM.extabTEST2 0x0
+@ CHECK: ]
+@ CHECK: SectionData (
+@ CHECK: 0000: 00000000 00000000 |........|
+@ CHECK: )
+@ CHECK: }
+@ CHECK: ]
+
+
+
+@-------------------------------------------------------------------------------
+@ Check the symbols and the sections they belong to
+@-------------------------------------------------------------------------------
+@ CHECK: Symbols [
+@ CHECK: Symbol {
+@ CHECK: Name: func1
+@ CHECK: Section: .TEST1 (0x4)
+@ CHECK: }
+@ CHECK: Symbol {
+@ CHECK: Name: func2
+@ CHECK: Section: TEST2 (0x9)
+@ CHECK: }
+@ CHECK: ]