Home | History | Annotate | Download | only in ARM
      1 @ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
      2 @ RUN:   | llvm-readobj -s -sd -sr | FileCheck %s
      3 
      4 @ Check the .fnstart directive and the .fnend directive.
      5 
      6 @ The .fnstart directive and .fnend directive should create an entry in
      7 @ exception handling table.  For example, if the function is defined in .text
      8 @ section, then there should be an entry in .ARM.exidx section.
      9 
     10 	.syntax	unified
     11 
     12 	.text
     13 	.globl	func1
     14 	.align	2
     15 	.type	func1,%function
     16 	.fnstart
     17 func1:
     18 	bx	lr
     19 	.fnend
     20 
     21 
     22 
     23 @-------------------------------------------------------------------------------
     24 @ Check the .text section.
     25 @-------------------------------------------------------------------------------
     26 @ CHECK: Sections [
     27 @ CHECK:   Section {
     28 
     29 @-------------------------------------------------------------------------------
     30 @ Check the index of .text section.  This will be used in .ARM.exidx.
     31 @-------------------------------------------------------------------------------
     32 @ CHECK:     Index: 1
     33 @ CHECK:     Name: .text
     34 @ CHECK:     Type: SHT_PROGBITS (0x1)
     35 @ CHECK:     Flags [ (0x6)
     36 @ CHECK:       SHF_ALLOC (0x2)
     37 @ CHECK:       SHF_EXECINSTR (0x4)
     38 @ CHECK:     ]
     39 @ CHECK:     SectionData (
     40 @ CHECK:       0000: 1EFF2FE1                             |../.|
     41 @ CHECK:     )
     42 @ CHECK:   }
     43 
     44 
     45 @-------------------------------------------------------------------------------
     46 @ Check the name of the EXIDX section.  For the function in the .text section,
     47 @ this should be .ARM.exidx.  It is incorrect to see .ARM.exidx.text here.
     48 @-------------------------------------------------------------------------------
     49 @ CHECK:   Section {
     50 @ CHECK:     Name: .ARM.exidx
     51 @ CHECK:     Type: SHT_ARM_EXIDX (0x70000001)
     52 @ CHECK:     Flags [ (0x82)
     53 @ CHECK:       SHF_ALLOC (0x2)
     54 @ CHECK:       SHF_LINK_ORDER (0x80)
     55 @ CHECK:     ]
     56 
     57 @-------------------------------------------------------------------------------
     58 @ Check the linked section of the EXIDX section.  This should be the index
     59 @ of the .text section.
     60 @-------------------------------------------------------------------------------
     61 @ CHECK:     Link: 1
     62 
     63 @-------------------------------------------------------------------------------
     64 @ The first word should be the offset to .text.  The second word should be
     65 @ 0xB0B0B080, which means compact model 0 is used (0x80) and the rest of the
     66 @ word is filled with FINISH opcode (0xB0).
     67 @-------------------------------------------------------------------------------
     68 @ CHECK:     SectionData (
     69 @ CHECK:       0000: 00000000 B0B0B080                    |........|
     70 @ CHECK:     )
     71 @ CHECK:   }
     72 @ CHECK: ]
     73 
     74 @-------------------------------------------------------------------------------
     75 @ The first word should be relocated to the code address in .text section.
     76 @ Besides, since this function is using compact model 0, thus we have to
     77 @ add an relocation to __aeabi_unwind_cpp_pr0.
     78 @-------------------------------------------------------------------------------
     79 @ CHECK:     Relocations [
     80 @ CHECK:       0x0 R_ARM_PREL31 .text 0x0
     81 @ CHECK:       0x0 R_ARM_NONE __aeabi_unwind_cpp_pr0 0x0
     82 @ CHECK:     ]
     83