file config.texi was initially added on branch binutils-2_17-branch.
[binutils.git] / ld / testsuite / ld-mips-elf / eh-frame1.s
blob94ed70d43e6c14cf853a26ce6fddb267bb730eb0
1 #----------------------------------------------------------------------------
2 # Macros
3 #----------------------------------------------------------------------------
5 mask = (1 << alignment) - 1
7 # Output VALUE as an unaligned pointer-sized quantity.
8 .macro pbyte value
9 .if alignment == 2
10 .4byte \value
11 .else
12 .8byte \value
13 .endif
14 .endm
17 # Start a new CIE, and emit everything up to the augmentation data.
18 # Use LABEL to mark the start of the entry and AUG as the augmentation
19 # string.
20 .macro start_cie label,aug
21 .section .eh_frame,"aw",@progbits
22 \label:
23 .word 2f-1f # Length
25 .word 0 # Identifier
26 .byte 1 # Version
27 .string "\aug" # Augmentation
28 .byte 1 # Code alignment
29 .byte 4 # Data alignment
30 .byte 31 # Return address column
31 .endm
34 # Create a dummy function of SIZE bytes in SECTION and emit the
35 # first four entries of an FDE for it.
36 .macro start_fde cie,section,size
37 .section \section,"ax",@progbits
39 .rept \size / 4
40 nop
41 .endr
43 .section .eh_frame,"aw",@progbits
44 .word 2f-1f # Length
46 .word .-\cie # CIE offset
47 pbyte 3b # Initial PC
48 pbyte 4b-3b # Size of code
49 .endm
52 # Finish a CIE or FDE entry.
53 .macro end_entry
54 .p2align alignment,fill
56 .endm
59 # Start the augmentation data for a CIE that has a 'P' entry
60 # followed by EXTRA bytes. AUGLEN is the length of augmentation
61 # string (including zero terminator), ENCODING is the encoding to
62 # use for the personality routine and VALUE is the value it
63 # should have.
64 .macro persaug auglen,extra,encoding,value
65 .if (\encoding & 0xf0) == 0x50
66 .byte (-(9 + \auglen + 3 + 2) & mask) + 2 + mask + \extra
67 .byte \encoding
68 .fill -(9 + \auglen + 3 + 2) & mask,1,0
69 .else
70 .byte 2 + mask + \extra
71 .byte \encoding
72 .endif
73 pbyte \value
74 .endm
77 .macro cie_basic label
78 start_cie \label,""
79 end_entry
80 .endm
82 .macro fde_basic cie,section,size
83 start_fde \cie,\section,\size
84 end_entry
85 .endm
88 .macro cie_zP label,encoding,value
89 start_cie \label,"zP"
90 persaug 3,0,\encoding,\value
91 end_entry
92 .endm
94 .macro fde_zP cie,section,size
95 start_fde \cie,\section,\size
96 .byte 0 # Augmentation length
97 end_entry
98 .endm
101 .macro cie_zPR label,encoding,value
102 start_cie \label,"zPR"
103 persaug 4,1,\encoding,\value
104 .byte 0 # FDE enconding
105 end_entry
106 .endm
108 .macro fde_zPR cie,section,size
109 start_fde \cie,\section,\size
110 .byte 0 # Augmentation length
111 end_entry
112 .endm
114 #----------------------------------------------------------------------------
115 # Test code
116 #----------------------------------------------------------------------------
118 cie_basic basic1
119 fde_basic basic1,.text,0x10
120 fde_basic basic1,.text,0x20
122 cie_basic basic2
123 fde_basic basic2,.text,0x30
125 cie_basic basic3
126 fde_basic basic3,.text,0x40
128 cie_basic basic4
129 fde_basic basic4,.text,0x50
131 cie_zP zP_unalign1,0x00,foo
132 fde_zP zP_unalign1,.text,0x10
133 fde_zP zP_unalign1,.text,0x20
135 cie_zP zP_align1,0x50,foo
136 fde_zP zP_align1,.text,0x10
137 fde_zP zP_align1,.text,0x20
139 cie_zPR zPR1,0x00,foo
140 fde_zPR zPR1,.text,0x10
141 fde_zPR zPR1,.discard,0x20
143 cie_zPR zPR2,0x00,foo
144 fde_zPR zPR2,.text,0x30
145 fde_zPR zPR2,.text,0x40
147 cie_basic basic5
148 fde_basic basic5,.text,0x10
150 .if alignment == 2
151 .section .gcc_compiled_long32
152 .endif