1@ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \ 2@ RUN: | llvm-readobj -s -sd -sr -t > %t 3@ RUN: FileCheck %s < %t 4@ RUN: FileCheck --check-prefix=RELOC %s < %t 5 6@ Check the combination of .section, .fnstart, and .fnend directives. 7 8@ For the functions in .text section, the exception handling index (EXIDX) 9@ should be generated in .ARM.exidx, and the exception handling table (EXTAB) 10@ should be generated in .ARM.extab. 11 12@ For the functions in custom section specified by .section directives, 13@ the EXIDX should be generated in ".ARM.exidx[[SECTION_NAME]]", and the EXTAB 14@ should be generated in ".ARM.extab[[SECTION_NAME]]". 15 16 .syntax unified 17 18@------------------------------------------------------------------------------- 19@ .TEST1 section 20@------------------------------------------------------------------------------- 21 .section .TEST1 22 .globl func1 23 .align 2 24 .type func1,%function 25 .fnstart 26func1: 27 bx lr 28 .personality __gxx_personality_v0 29 .handlerdata 30 .fnend 31 32 33@------------------------------------------------------------------------------- 34@ TEST2 section (without the dot in the beginning) 35@------------------------------------------------------------------------------- 36 .section TEST2 37 .globl func2 38 .align 2 39 .type func2,%function 40 .fnstart 41func2: 42 bx lr 43 .personality __gxx_personality_v0 44 .handlerdata 45 .fnend 46 47 48@------------------------------------------------------------------------------- 49@ Check the .TEST1 section. 50@------------------------------------------------------------------------------- 51@ CHECK: Sections [ 52@ CHECK: Section { 53@ CHECK: Index: 3 54@ CHECK-NEXT: Name: .TEST1 55@ CHECK: SectionData ( 56@ CHECK: 0000: 1EFF2FE1 |../.| 57@ CHECK: ) 58@ CHECK: } 59 60@------------------------------------------------------------------------------- 61@ Check the .ARM.extab.TEST1 section, the EXTAB of .TEST1 section. 62@------------------------------------------------------------------------------- 63@ CHECK: Section { 64@ CHECK: Name: .ARM.extab.TEST1 65@ CHECK: SectionData ( 66@ CHECK: 0000: 00000000 B0B0B000 |........| 67@ CHECK: ) 68@ CHECK: } 69 70@ RELOC: Section { 71@ RELOC: Name: .rel.ARM.extab.TEST1 72@ RELOC: Relocations [ 73@ RELOC: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0 74@ RELOC: ] 75@ RELOC: } 76 77 78@------------------------------------------------------------------------------- 79@ Check the.ARM.exidx.TEST1 section, the EXIDX of .TEST1 section. 80@------------------------------------------------------------------------------- 81@ CHECK: Section { 82@ CHECK: Name: .ARM.exidx.TEST1 83 84@------------------------------------------------------------------------------- 85@ This section should linked with .TEST1 section. 86@------------------------------------------------------------------------------- 87@ CHECK: Link: 3 88 89@------------------------------------------------------------------------------- 90@ The first word should be relocated to the code address in .TEST1 section. 91@ The second word should be relocated to the EHTAB entry in .ARM.extab.TEST1 92@ section. 93@------------------------------------------------------------------------------- 94@ CHECK: SectionData ( 95@ CHECK: 0000: 00000000 00000000 |........| 96@ CHECK: ) 97@ CHECK: } 98 99@ RELOC: Section { 100@ RELOC: Name: .rel.ARM.exidx.TEST1 101@ RELOC: Relocations [ 102@ RELOC: 0x0 R_ARM_PREL31 .TEST1 0x0 103@ RELOC: 0x4 R_ARM_PREL31 .ARM.extab.TEST1 0x0 104@ RELOC: ] 105@ RELOC: } 106 107 108@------------------------------------------------------------------------------- 109@ Check the TEST2 section (without the dot in the beginning) 110@------------------------------------------------------------------------------- 111@ CHECK: Section { 112@ CHECK: Index: 8 113@ CHECK-NEXT: Name: TEST2 114@ CHECK: SectionData ( 115@ CHECK: 0000: 1EFF2FE1 |../.| 116@ CHECK: ) 117@ CHECK: } 118 119@------------------------------------------------------------------------------- 120@ Check the .ARM.extabTEST2 section, the EXTAB of TEST2 section. 121@------------------------------------------------------------------------------- 122@ CHECK: Section { 123@ CHECK: Name: .ARM.extabTEST2 124@ CHECK: SectionData ( 125@ CHECK: 0000: 00000000 B0B0B000 |........| 126@ CHECK: ) 127@ CHECK: } 128 129@ RELOC: Section { 130@ RELOC: Name: .rel.ARM.extabTEST2 131@ RELOC: Relocations [ 132@ RELOC: 0x0 R_ARM_PREL31 __gxx_personality_v0 0x0 133@ RELOC: ] 134@ RELOC: } 135 136 137@------------------------------------------------------------------------------- 138@ Check the .ARM.exidxTEST2 section, the EXIDX of TEST2 section. 139@------------------------------------------------------------------------------- 140@ CHECK: Section { 141@ CHECK: Name: .ARM.exidxTEST2 142 143@------------------------------------------------------------------------------- 144@ This section should linked with TEST2 section. 145@------------------------------------------------------------------------------- 146@ CHECK: Link: 8 147 148@------------------------------------------------------------------------------- 149@ The first word should be relocated to the code address in TEST2 section. 150@ The second word should be relocated to the EHTAB entry in .ARM.extabTEST2 151@ section. 152@------------------------------------------------------------------------------- 153@ CHECK: SectionData ( 154@ CHECK: 0000: 00000000 00000000 |........| 155@ CHECK: ) 156@ CHECK: } 157 158@ RELOC: Section { 159@ RELOC: Name: .rel.ARM.exidxTEST2 160@ RELOC: Relocations [ 161@ RELOC: 0x0 R_ARM_PREL31 TEST2 0x0 162@ RELOC: 0x4 R_ARM_PREL31 .ARM.extabTEST2 0x0 163@ RELOC: ] 164@ RELOC: } 165 166 167 168@------------------------------------------------------------------------------- 169@ Check the symbols and the sections they belong to 170@------------------------------------------------------------------------------- 171@ CHECK: Symbols [ 172@ CHECK: Symbol { 173@ CHECK: Name: func1 174@ CHECK: Section: .TEST1 175@ CHECK: } 176@ CHECK: Symbol { 177@ CHECK: Name: func2 178@ CHECK: Section: TEST2 179@ CHECK: } 180@ CHECK: ] 181