dw2gencfi.c 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594
  1. /* dw2gencfi.c - Support for generating Dwarf2 CFI information.
  2. Copyright (C) 2003-2022 Free Software Foundation, Inc.
  3. Contributed by Michal Ludvig <mludvig@suse.cz>
  4. This file is part of GAS, the GNU Assembler.
  5. GAS is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GAS is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GAS; see the file COPYING. If not, write to the Free
  15. Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
  16. 02110-1301, USA. */
  17. #include "as.h"
  18. #include "dw2gencfi.h"
  19. #include "subsegs.h"
  20. #include "dwarf2dbg.h"
  21. #ifdef TARGET_USE_CFIPOP
  22. /* By default, use difference expressions if DIFF_EXPR_OK is defined. */
  23. #ifndef CFI_DIFF_EXPR_OK
  24. # ifdef DIFF_EXPR_OK
  25. # define CFI_DIFF_EXPR_OK 1
  26. # else
  27. # define CFI_DIFF_EXPR_OK 0
  28. # endif
  29. #endif
  30. #ifndef CFI_DIFF_LSDA_OK
  31. #define CFI_DIFF_LSDA_OK CFI_DIFF_EXPR_OK
  32. #endif
  33. #if CFI_DIFF_EXPR_OK == 1 && CFI_DIFF_LSDA_OK == 0
  34. # error "CFI_DIFF_EXPR_OK should imply CFI_DIFF_LSDA_OK"
  35. #endif
  36. /* We re-use DWARF2_LINE_MIN_INSN_LENGTH for the code alignment field
  37. of the CIE. Default to 1 if not otherwise specified. */
  38. #ifndef DWARF2_LINE_MIN_INSN_LENGTH
  39. #define DWARF2_LINE_MIN_INSN_LENGTH 1
  40. #endif
  41. /* By default, use 32-bit relocations from .eh_frame into .text. */
  42. #ifndef DWARF2_FDE_RELOC_SIZE
  43. #define DWARF2_FDE_RELOC_SIZE 4
  44. #endif
  45. /* By default, use a read-only .eh_frame section. */
  46. #ifndef DWARF2_EH_FRAME_READ_ONLY
  47. #define DWARF2_EH_FRAME_READ_ONLY SEC_READONLY
  48. #endif
  49. #ifndef EH_FRAME_ALIGNMENT
  50. #define EH_FRAME_ALIGNMENT (bfd_get_arch_size (stdoutput) == 64 ? 3 : 2)
  51. #endif
  52. #ifndef tc_cfi_frame_initial_instructions
  53. #define tc_cfi_frame_initial_instructions() ((void)0)
  54. #endif
  55. #ifndef tc_cfi_startproc
  56. # define tc_cfi_startproc() ((void)0)
  57. #endif
  58. #ifndef tc_cfi_endproc
  59. # define tc_cfi_endproc(fde) ((void) (fde))
  60. #endif
  61. #define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh)
  62. #ifndef DWARF2_FORMAT
  63. #define DWARF2_FORMAT(SEC) dwarf2_format_32bit
  64. #endif
  65. #ifndef DWARF2_ADDR_SIZE
  66. #define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8)
  67. #endif
  68. #if MULTIPLE_FRAME_SECTIONS
  69. #define CUR_SEG(structp) structp->cur_seg
  70. #define SET_CUR_SEG(structp, seg) structp->cur_seg = seg
  71. #define HANDLED(structp) structp->handled
  72. #define SET_HANDLED(structp, val) structp->handled = val
  73. #else
  74. #define CUR_SEG(structp) NULL
  75. #define SET_CUR_SEG(structp, seg) (void) (0 && seg)
  76. #define HANDLED(structp) 0
  77. #define SET_HANDLED(structp, val) (void) (0 && val)
  78. #endif
  79. #ifndef tc_cfi_reloc_for_encoding
  80. #define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE
  81. #endif
  82. /* Private segment collection list. */
  83. struct dwcfi_seg_list
  84. {
  85. segT seg;
  86. int subseg;
  87. char * seg_name;
  88. };
  89. #ifdef SUPPORT_COMPACT_EH
  90. static bool compact_eh;
  91. #else
  92. #define compact_eh 0
  93. #endif
  94. static htab_t dwcfi_hash;
  95. /* Emit a single byte into the current segment. */
  96. static inline void
  97. out_one (int byte)
  98. {
  99. FRAG_APPEND_1_CHAR (byte);
  100. }
  101. /* Emit a two-byte word into the current segment. */
  102. static inline void
  103. out_two (int data)
  104. {
  105. md_number_to_chars (frag_more (2), data, 2);
  106. }
  107. /* Emit a four byte word into the current segment. */
  108. static inline void
  109. out_four (int data)
  110. {
  111. md_number_to_chars (frag_more (4), data, 4);
  112. }
  113. /* Emit an unsigned "little-endian base 128" number. */
  114. static void
  115. out_uleb128 (addressT value)
  116. {
  117. output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0);
  118. }
  119. /* Emit an unsigned "little-endian base 128" number. */
  120. static void
  121. out_sleb128 (offsetT value)
  122. {
  123. output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1);
  124. }
  125. static unsigned int
  126. encoding_size (unsigned char encoding)
  127. {
  128. if (encoding == DW_EH_PE_omit)
  129. return 0;
  130. switch (encoding & 0x7)
  131. {
  132. case 0:
  133. return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4;
  134. case DW_EH_PE_udata2:
  135. return 2;
  136. case DW_EH_PE_udata4:
  137. return 4;
  138. case DW_EH_PE_udata8:
  139. return 8;
  140. default:
  141. abort ();
  142. }
  143. }
  144. /* Emit expression EXP in ENCODING. If EMIT_ENCODING is true, first
  145. emit a byte containing ENCODING. */
  146. static void
  147. emit_expr_encoded (expressionS *exp, int encoding, bool emit_encoding)
  148. {
  149. unsigned int size = encoding_size (encoding);
  150. bfd_reloc_code_real_type code;
  151. if (encoding == DW_EH_PE_omit)
  152. return;
  153. if (emit_encoding)
  154. out_one (encoding);
  155. code = tc_cfi_reloc_for_encoding (encoding);
  156. if (code != BFD_RELOC_NONE)
  157. {
  158. reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
  159. char *p = frag_more (size);
  160. gas_assert (size == (unsigned) howto->bitsize / 8);
  161. md_number_to_chars (p, 0, size);
  162. fix_new (frag_now, p - frag_now->fr_literal, size, exp->X_add_symbol,
  163. exp->X_add_number, howto->pc_relative, code);
  164. }
  165. else if ((encoding & 0x70) == DW_EH_PE_pcrel)
  166. {
  167. #if CFI_DIFF_EXPR_OK
  168. expressionS tmp = *exp;
  169. tmp.X_op = O_subtract;
  170. tmp.X_op_symbol = symbol_temp_new_now ();
  171. emit_expr (&tmp, size);
  172. #elif defined (tc_cfi_emit_pcrel_expr)
  173. tc_cfi_emit_pcrel_expr (exp, size);
  174. #else
  175. abort ();
  176. #endif
  177. }
  178. else
  179. emit_expr (exp, size);
  180. }
  181. /* Build based on segment the derived .debug_...
  182. segment name containing origin segment's postfix name part. */
  183. static char *
  184. get_debugseg_name (segT seg, const char *base_name)
  185. {
  186. const char * name;
  187. const char * dollar;
  188. const char * dot;
  189. if (!seg)
  190. return concat (base_name, NULL);
  191. name = bfd_section_name (seg);
  192. if (name == NULL || *name == 0)
  193. return concat (base_name, NULL);
  194. dollar = strchr (name, '$');
  195. dot = strchr (name + 1, '.');
  196. if (!dollar && !dot)
  197. {
  198. if (!strcmp (base_name, ".eh_frame_entry")
  199. && strcmp (name, ".text") != 0)
  200. return concat (base_name, ".", name, NULL);
  201. name = "";
  202. }
  203. else if (!dollar)
  204. name = dot;
  205. else if (!dot)
  206. name = dollar;
  207. else if (dot < dollar)
  208. name = dot;
  209. else
  210. name = dollar;
  211. return concat (base_name, name, NULL);
  212. }
  213. /* Allocate a dwcfi_seg_list structure. */
  214. static struct dwcfi_seg_list *
  215. alloc_debugseg_item (segT seg, int subseg, char *name)
  216. {
  217. struct dwcfi_seg_list *r;
  218. r = (struct dwcfi_seg_list *)
  219. xmalloc (sizeof (struct dwcfi_seg_list) + strlen (name));
  220. r->seg = seg;
  221. r->subseg = subseg;
  222. r->seg_name = name;
  223. return r;
  224. }
  225. static segT
  226. is_now_linkonce_segment (void)
  227. {
  228. if (compact_eh)
  229. return now_seg;
  230. if ((bfd_section_flags (now_seg)
  231. & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
  232. | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE
  233. | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0)
  234. return now_seg;
  235. return NULL;
  236. }
  237. /* Generate debug... segment with same linkonce properties
  238. of based segment. */
  239. static segT
  240. make_debug_seg (segT cseg, char *name, int sflags)
  241. {
  242. segT save_seg = now_seg;
  243. int save_subseg = now_subseg;
  244. segT r;
  245. flagword flags;
  246. r = subseg_new (name, 0);
  247. /* Check if code segment is marked as linked once. */
  248. if (!cseg)
  249. flags = 0;
  250. else
  251. flags = (bfd_section_flags (cseg)
  252. & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
  253. | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE
  254. | SEC_LINK_DUPLICATES_SAME_CONTENTS));
  255. /* Add standard section flags. */
  256. flags |= sflags;
  257. /* Apply possibly linked once flags to new generated segment, too. */
  258. if (!bfd_set_section_flags (r, flags))
  259. as_bad (_("bfd_set_section_flags: %s"),
  260. bfd_errmsg (bfd_get_error ()));
  261. /* Restore to previous segment. */
  262. if (save_seg != NULL)
  263. subseg_set (save_seg, save_subseg);
  264. return r;
  265. }
  266. static struct dwcfi_seg_list *
  267. dwcfi_hash_find (char *name)
  268. {
  269. return (struct dwcfi_seg_list *) str_hash_find (dwcfi_hash, name);
  270. }
  271. static struct dwcfi_seg_list *
  272. dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
  273. {
  274. struct dwcfi_seg_list *item;
  275. char *name;
  276. /* Initialize dwcfi_hash once. */
  277. if (!dwcfi_hash)
  278. dwcfi_hash = str_htab_create ();
  279. name = get_debugseg_name (cseg, base_name);
  280. item = dwcfi_hash_find (name);
  281. if (!item)
  282. {
  283. item = alloc_debugseg_item (make_debug_seg (cseg, name, flags), 0, name);
  284. str_hash_insert (dwcfi_hash, item->seg_name, item, 0);
  285. }
  286. else
  287. free (name);
  288. return item;
  289. }
  290. /* ??? Share this with dwarf2cfg.c. */
  291. #ifndef TC_DWARF2_EMIT_OFFSET
  292. #define TC_DWARF2_EMIT_OFFSET generic_dwarf2_emit_offset
  293. /* Create an offset to .dwarf2_*. */
  294. static void
  295. generic_dwarf2_emit_offset (symbolS *symbol, unsigned int size)
  296. {
  297. expressionS exp;
  298. exp.X_op = O_symbol;
  299. exp.X_add_symbol = symbol;
  300. exp.X_add_number = 0;
  301. emit_expr (&exp, size);
  302. }
  303. #endif
  304. struct cfi_escape_data
  305. {
  306. struct cfi_escape_data *next;
  307. expressionS exp;
  308. };
  309. struct cie_entry
  310. {
  311. struct cie_entry *next;
  312. #if MULTIPLE_FRAME_SECTIONS
  313. segT cur_seg;
  314. #endif
  315. symbolS *start_address;
  316. unsigned int return_column;
  317. unsigned int signal_frame;
  318. unsigned char fde_encoding;
  319. unsigned char per_encoding;
  320. unsigned char lsda_encoding;
  321. expressionS personality;
  322. #ifdef tc_cie_entry_extras
  323. tc_cie_entry_extras
  324. #endif
  325. struct cfi_insn_data *first, *last;
  326. };
  327. /* List of FDE entries. */
  328. struct fde_entry *all_fde_data;
  329. static struct fde_entry **last_fde_data = &all_fde_data;
  330. /* List of CIEs so that they could be reused. */
  331. static struct cie_entry *cie_root;
  332. /* Construct a new FDE structure and add it to the end of the fde list. */
  333. static struct fde_entry *
  334. alloc_fde_entry (void)
  335. {
  336. struct fde_entry *fde = XCNEW (struct fde_entry);
  337. frchain_now->frch_cfi_data = XCNEW (struct frch_cfi_data);
  338. frchain_now->frch_cfi_data->cur_fde_data = fde;
  339. *last_fde_data = fde;
  340. last_fde_data = &fde->next;
  341. SET_CUR_SEG (fde, is_now_linkonce_segment ());
  342. SET_HANDLED (fde, 0);
  343. fde->last = &fde->data;
  344. fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN;
  345. fde->per_encoding = DW_EH_PE_omit;
  346. fde->lsda_encoding = DW_EH_PE_omit;
  347. fde->eh_header_type = EH_COMPACT_UNKNOWN;
  348. #ifdef tc_fde_entry_init_extra
  349. tc_fde_entry_init_extra (fde)
  350. #endif
  351. return fde;
  352. }
  353. /* The following functions are available for a backend to construct its
  354. own unwind information, usually from legacy unwind directives. */
  355. /* Construct a new INSN structure and add it to the end of the insn list
  356. for the currently active FDE. */
  357. static bool cfi_sections_set = false;
  358. static int cfi_sections = CFI_EMIT_eh_frame;
  359. int all_cfi_sections = 0;
  360. static struct fde_entry *last_fde;
  361. static struct cfi_insn_data *
  362. alloc_cfi_insn_data (void)
  363. {
  364. struct cfi_insn_data *insn = XCNEW (struct cfi_insn_data);
  365. struct fde_entry *cur_fde_data = frchain_now->frch_cfi_data->cur_fde_data;
  366. *cur_fde_data->last = insn;
  367. cur_fde_data->last = &insn->next;
  368. SET_CUR_SEG (insn, is_now_linkonce_segment ());
  369. return insn;
  370. }
  371. /* Construct a new FDE structure that begins at LABEL. */
  372. void
  373. cfi_new_fde (symbolS *label)
  374. {
  375. struct fde_entry *fde = alloc_fde_entry ();
  376. fde->start_address = label;
  377. frchain_now->frch_cfi_data->last_address = label;
  378. }
  379. /* End the currently open FDE. */
  380. void
  381. cfi_end_fde (symbolS *label)
  382. {
  383. frchain_now->frch_cfi_data->cur_fde_data->end_address = label;
  384. free (frchain_now->frch_cfi_data);
  385. frchain_now->frch_cfi_data = NULL;
  386. }
  387. /* Set the return column for the current FDE. */
  388. void
  389. cfi_set_return_column (unsigned regno)
  390. {
  391. frchain_now->frch_cfi_data->cur_fde_data->return_column = regno;
  392. }
  393. void
  394. cfi_set_sections (void)
  395. {
  396. frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections;
  397. cfi_sections_set = true;
  398. }
  399. /* Universal functions to store new instructions. */
  400. static void
  401. cfi_add_CFA_insn (int insn)
  402. {
  403. struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  404. insn_ptr->insn = insn;
  405. }
  406. static void
  407. cfi_add_CFA_insn_reg (int insn, unsigned regno)
  408. {
  409. struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  410. insn_ptr->insn = insn;
  411. insn_ptr->u.r = regno;
  412. }
  413. static void
  414. cfi_add_CFA_insn_offset (int insn, offsetT offset)
  415. {
  416. struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  417. insn_ptr->insn = insn;
  418. insn_ptr->u.i = offset;
  419. }
  420. static void
  421. cfi_add_CFA_insn_reg_reg (int insn, unsigned reg1, unsigned reg2)
  422. {
  423. struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  424. insn_ptr->insn = insn;
  425. insn_ptr->u.rr.reg1 = reg1;
  426. insn_ptr->u.rr.reg2 = reg2;
  427. }
  428. static void
  429. cfi_add_CFA_insn_reg_offset (int insn, unsigned regno, offsetT offset)
  430. {
  431. struct cfi_insn_data *insn_ptr = alloc_cfi_insn_data ();
  432. insn_ptr->insn = insn;
  433. insn_ptr->u.ri.reg = regno;
  434. insn_ptr->u.ri.offset = offset;
  435. }
  436. /* Add a CFI insn to advance the PC from the last address to LABEL. */
  437. void
  438. cfi_add_advance_loc (symbolS *label)
  439. {
  440. struct cfi_insn_data *insn = alloc_cfi_insn_data ();
  441. insn->insn = DW_CFA_advance_loc;
  442. insn->u.ll.lab1 = frchain_now->frch_cfi_data->last_address;
  443. insn->u.ll.lab2 = label;
  444. frchain_now->frch_cfi_data->last_address = label;
  445. }
  446. /* Add a CFI insn to label the current position in the CFI segment. */
  447. void
  448. cfi_add_label (const char *name)
  449. {
  450. unsigned int len = strlen (name) + 1;
  451. struct cfi_insn_data *insn = alloc_cfi_insn_data ();
  452. insn->insn = CFI_label;
  453. obstack_grow (&notes, name, len);
  454. insn->u.sym_name = (char *) obstack_finish (&notes);
  455. }
  456. /* Add a DW_CFA_offset record to the CFI data. */
  457. void
  458. cfi_add_CFA_offset (unsigned regno, offsetT offset)
  459. {
  460. unsigned int abs_data_align;
  461. gas_assert (DWARF2_CIE_DATA_ALIGNMENT != 0);
  462. cfi_add_CFA_insn_reg_offset (DW_CFA_offset, regno, offset);
  463. abs_data_align = (DWARF2_CIE_DATA_ALIGNMENT < 0
  464. ? -DWARF2_CIE_DATA_ALIGNMENT : DWARF2_CIE_DATA_ALIGNMENT);
  465. if (offset % abs_data_align)
  466. as_bad (_("register save offset not a multiple of %u"), abs_data_align);
  467. }
  468. /* Add a DW_CFA_val_offset record to the CFI data. */
  469. void
  470. cfi_add_CFA_val_offset (unsigned regno, offsetT offset)
  471. {
  472. unsigned int abs_data_align;
  473. gas_assert (DWARF2_CIE_DATA_ALIGNMENT != 0);
  474. cfi_add_CFA_insn_reg_offset (DW_CFA_val_offset, regno, offset);
  475. abs_data_align = (DWARF2_CIE_DATA_ALIGNMENT < 0
  476. ? -DWARF2_CIE_DATA_ALIGNMENT : DWARF2_CIE_DATA_ALIGNMENT);
  477. if (offset % abs_data_align)
  478. as_bad (_("register save offset not a multiple of %u"), abs_data_align);
  479. }
  480. /* Add a DW_CFA_def_cfa record to the CFI data. */
  481. void
  482. cfi_add_CFA_def_cfa (unsigned regno, offsetT offset)
  483. {
  484. cfi_add_CFA_insn_reg_offset (DW_CFA_def_cfa, regno, offset);
  485. frchain_now->frch_cfi_data->cur_cfa_offset = offset;
  486. }
  487. /* Add a DW_CFA_register record to the CFI data. */
  488. void
  489. cfi_add_CFA_register (unsigned reg1, unsigned reg2)
  490. {
  491. cfi_add_CFA_insn_reg_reg (DW_CFA_register, reg1, reg2);
  492. }
  493. /* Add a DW_CFA_def_cfa_register record to the CFI data. */
  494. void
  495. cfi_add_CFA_def_cfa_register (unsigned regno)
  496. {
  497. cfi_add_CFA_insn_reg (DW_CFA_def_cfa_register, regno);
  498. }
  499. /* Add a DW_CFA_def_cfa_offset record to the CFI data. */
  500. void
  501. cfi_add_CFA_def_cfa_offset (offsetT offset)
  502. {
  503. cfi_add_CFA_insn_offset (DW_CFA_def_cfa_offset, offset);
  504. frchain_now->frch_cfi_data->cur_cfa_offset = offset;
  505. }
  506. void
  507. cfi_add_CFA_restore (unsigned regno)
  508. {
  509. cfi_add_CFA_insn_reg (DW_CFA_restore, regno);
  510. }
  511. void
  512. cfi_add_CFA_undefined (unsigned regno)
  513. {
  514. cfi_add_CFA_insn_reg (DW_CFA_undefined, regno);
  515. }
  516. void
  517. cfi_add_CFA_same_value (unsigned regno)
  518. {
  519. cfi_add_CFA_insn_reg (DW_CFA_same_value, regno);
  520. }
  521. void
  522. cfi_add_CFA_remember_state (void)
  523. {
  524. struct cfa_save_data *p;
  525. cfi_add_CFA_insn (DW_CFA_remember_state);
  526. p = XNEW (struct cfa_save_data);
  527. p->cfa_offset = frchain_now->frch_cfi_data->cur_cfa_offset;
  528. p->next = frchain_now->frch_cfi_data->cfa_save_stack;
  529. frchain_now->frch_cfi_data->cfa_save_stack = p;
  530. }
  531. void
  532. cfi_add_CFA_restore_state (void)
  533. {
  534. struct cfa_save_data *p;
  535. cfi_add_CFA_insn (DW_CFA_restore_state);
  536. p = frchain_now->frch_cfi_data->cfa_save_stack;
  537. if (p)
  538. {
  539. frchain_now->frch_cfi_data->cur_cfa_offset = p->cfa_offset;
  540. frchain_now->frch_cfi_data->cfa_save_stack = p->next;
  541. free (p);
  542. }
  543. else
  544. as_bad (_("CFI state restore without previous remember"));
  545. }
  546. /* Parse CFI assembler directives. */
  547. static void dot_cfi (int);
  548. static void dot_cfi_escape (int);
  549. static void dot_cfi_sections (int);
  550. static void dot_cfi_startproc (int);
  551. static void dot_cfi_endproc (int);
  552. static void dot_cfi_fde_data (int);
  553. static void dot_cfi_personality (int);
  554. static void dot_cfi_personality_id (int);
  555. static void dot_cfi_lsda (int);
  556. static void dot_cfi_val_encoded_addr (int);
  557. static void dot_cfi_inline_lsda (int);
  558. static void dot_cfi_label (int);
  559. const pseudo_typeS cfi_pseudo_table[] =
  560. {
  561. { "cfi_sections", dot_cfi_sections, 0 },
  562. { "cfi_startproc", dot_cfi_startproc, 0 },
  563. { "cfi_endproc", dot_cfi_endproc, 0 },
  564. { "cfi_fde_data", dot_cfi_fde_data, 0 },
  565. { "cfi_def_cfa", dot_cfi, DW_CFA_def_cfa },
  566. { "cfi_def_cfa_register", dot_cfi, DW_CFA_def_cfa_register },
  567. { "cfi_def_cfa_offset", dot_cfi, DW_CFA_def_cfa_offset },
  568. { "cfi_adjust_cfa_offset", dot_cfi, CFI_adjust_cfa_offset },
  569. { "cfi_offset", dot_cfi, DW_CFA_offset },
  570. { "cfi_rel_offset", dot_cfi, CFI_rel_offset },
  571. { "cfi_register", dot_cfi, DW_CFA_register },
  572. { "cfi_return_column", dot_cfi, CFI_return_column },
  573. { "cfi_restore", dot_cfi, DW_CFA_restore },
  574. { "cfi_undefined", dot_cfi, DW_CFA_undefined },
  575. { "cfi_same_value", dot_cfi, DW_CFA_same_value },
  576. { "cfi_remember_state", dot_cfi, DW_CFA_remember_state },
  577. { "cfi_restore_state", dot_cfi, DW_CFA_restore_state },
  578. { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save },
  579. { "cfi_negate_ra_state", dot_cfi, DW_CFA_AARCH64_negate_ra_state },
  580. { "cfi_escape", dot_cfi_escape, 0 },
  581. { "cfi_signal_frame", dot_cfi, CFI_signal_frame },
  582. { "cfi_personality", dot_cfi_personality, 0 },
  583. { "cfi_personality_id", dot_cfi_personality_id, 0 },
  584. { "cfi_lsda", dot_cfi_lsda, 0 },
  585. { "cfi_val_encoded_addr", dot_cfi_val_encoded_addr, 0 },
  586. { "cfi_inline_lsda", dot_cfi_inline_lsda, 0 },
  587. { "cfi_label", dot_cfi_label, 0 },
  588. { "cfi_val_offset", dot_cfi, DW_CFA_val_offset },
  589. { NULL, NULL, 0 }
  590. };
  591. static void
  592. cfi_parse_separator (void)
  593. {
  594. SKIP_WHITESPACE ();
  595. if (*input_line_pointer == ',')
  596. input_line_pointer++;
  597. else
  598. as_bad (_("missing separator"));
  599. }
  600. #ifndef tc_parse_to_dw2regnum
  601. static void
  602. tc_parse_to_dw2regnum (expressionS *exp)
  603. {
  604. # ifdef tc_regname_to_dw2regnum
  605. SKIP_WHITESPACE ();
  606. if (is_name_beginner (*input_line_pointer)
  607. || (*input_line_pointer == '%'
  608. && is_name_beginner (*++input_line_pointer)))
  609. {
  610. char *name, c;
  611. c = get_symbol_name (& name);
  612. exp->X_op = O_constant;
  613. exp->X_add_number = tc_regname_to_dw2regnum (name);
  614. restore_line_pointer (c);
  615. }
  616. else
  617. # endif
  618. expression_and_evaluate (exp);
  619. }
  620. #endif
  621. static unsigned
  622. cfi_parse_reg (void)
  623. {
  624. int regno;
  625. expressionS exp;
  626. tc_parse_to_dw2regnum (&exp);
  627. switch (exp.X_op)
  628. {
  629. case O_register:
  630. case O_constant:
  631. regno = exp.X_add_number;
  632. break;
  633. default:
  634. regno = -1;
  635. break;
  636. }
  637. if (regno < 0)
  638. {
  639. as_bad (_("bad register expression"));
  640. regno = 0;
  641. }
  642. return regno;
  643. }
  644. static offsetT
  645. cfi_parse_const (void)
  646. {
  647. return get_absolute_expression ();
  648. }
  649. static void
  650. dot_cfi (int arg)
  651. {
  652. offsetT offset;
  653. unsigned reg1, reg2;
  654. if (frchain_now->frch_cfi_data == NULL)
  655. {
  656. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  657. ignore_rest_of_line ();
  658. return;
  659. }
  660. /* If the last address was not at the current PC, advance to current. */
  661. if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  662. || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  663. != frag_now_fix ()))
  664. cfi_add_advance_loc (symbol_temp_new_now ());
  665. switch (arg)
  666. {
  667. case DW_CFA_offset:
  668. reg1 = cfi_parse_reg ();
  669. cfi_parse_separator ();
  670. offset = cfi_parse_const ();
  671. cfi_add_CFA_offset (reg1, offset);
  672. break;
  673. case DW_CFA_val_offset:
  674. reg1 = cfi_parse_reg ();
  675. cfi_parse_separator ();
  676. offset = cfi_parse_const ();
  677. cfi_add_CFA_val_offset (reg1, offset);
  678. break;
  679. case CFI_rel_offset:
  680. reg1 = cfi_parse_reg ();
  681. cfi_parse_separator ();
  682. offset = cfi_parse_const ();
  683. cfi_add_CFA_offset (reg1,
  684. offset - frchain_now->frch_cfi_data->cur_cfa_offset);
  685. break;
  686. case DW_CFA_def_cfa:
  687. reg1 = cfi_parse_reg ();
  688. cfi_parse_separator ();
  689. offset = cfi_parse_const ();
  690. cfi_add_CFA_def_cfa (reg1, offset);
  691. break;
  692. case DW_CFA_register:
  693. reg1 = cfi_parse_reg ();
  694. cfi_parse_separator ();
  695. reg2 = cfi_parse_reg ();
  696. cfi_add_CFA_register (reg1, reg2);
  697. break;
  698. case DW_CFA_def_cfa_register:
  699. reg1 = cfi_parse_reg ();
  700. cfi_add_CFA_def_cfa_register (reg1);
  701. break;
  702. case DW_CFA_def_cfa_offset:
  703. offset = cfi_parse_const ();
  704. cfi_add_CFA_def_cfa_offset (offset);
  705. break;
  706. case CFI_adjust_cfa_offset:
  707. offset = cfi_parse_const ();
  708. cfi_add_CFA_def_cfa_offset (frchain_now->frch_cfi_data->cur_cfa_offset
  709. + offset);
  710. break;
  711. case DW_CFA_restore:
  712. for (;;)
  713. {
  714. reg1 = cfi_parse_reg ();
  715. cfi_add_CFA_restore (reg1);
  716. SKIP_WHITESPACE ();
  717. if (*input_line_pointer != ',')
  718. break;
  719. ++input_line_pointer;
  720. }
  721. break;
  722. case DW_CFA_undefined:
  723. for (;;)
  724. {
  725. reg1 = cfi_parse_reg ();
  726. cfi_add_CFA_undefined (reg1);
  727. SKIP_WHITESPACE ();
  728. if (*input_line_pointer != ',')
  729. break;
  730. ++input_line_pointer;
  731. }
  732. break;
  733. case DW_CFA_same_value:
  734. reg1 = cfi_parse_reg ();
  735. cfi_add_CFA_same_value (reg1);
  736. break;
  737. case CFI_return_column:
  738. reg1 = cfi_parse_reg ();
  739. cfi_set_return_column (reg1);
  740. break;
  741. case DW_CFA_remember_state:
  742. cfi_add_CFA_remember_state ();
  743. break;
  744. case DW_CFA_restore_state:
  745. cfi_add_CFA_restore_state ();
  746. break;
  747. case DW_CFA_GNU_window_save:
  748. cfi_add_CFA_insn (DW_CFA_GNU_window_save);
  749. break;
  750. case CFI_signal_frame:
  751. frchain_now->frch_cfi_data->cur_fde_data->signal_frame = 1;
  752. break;
  753. default:
  754. abort ();
  755. }
  756. demand_empty_rest_of_line ();
  757. }
  758. static void
  759. dot_cfi_escape (int ignored ATTRIBUTE_UNUSED)
  760. {
  761. struct cfi_escape_data *head, **tail, *e;
  762. struct cfi_insn_data *insn;
  763. if (frchain_now->frch_cfi_data == NULL)
  764. {
  765. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  766. ignore_rest_of_line ();
  767. return;
  768. }
  769. /* If the last address was not at the current PC, advance to current. */
  770. if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  771. || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  772. != frag_now_fix ()))
  773. cfi_add_advance_loc (symbol_temp_new_now ());
  774. tail = &head;
  775. do
  776. {
  777. e = XNEW (struct cfi_escape_data);
  778. do_parse_cons_expression (&e->exp, 1);
  779. *tail = e;
  780. tail = &e->next;
  781. }
  782. while (*input_line_pointer++ == ',');
  783. *tail = NULL;
  784. insn = alloc_cfi_insn_data ();
  785. insn->insn = CFI_escape;
  786. insn->u.esc = head;
  787. --input_line_pointer;
  788. demand_empty_rest_of_line ();
  789. }
  790. static void
  791. dot_cfi_personality (int ignored ATTRIBUTE_UNUSED)
  792. {
  793. struct fde_entry *fde;
  794. offsetT encoding;
  795. if (frchain_now->frch_cfi_data == NULL)
  796. {
  797. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  798. ignore_rest_of_line ();
  799. return;
  800. }
  801. fde = frchain_now->frch_cfi_data->cur_fde_data;
  802. encoding = cfi_parse_const ();
  803. if (encoding == DW_EH_PE_omit)
  804. {
  805. demand_empty_rest_of_line ();
  806. fde->per_encoding = encoding;
  807. return;
  808. }
  809. if ((encoding & 0xff) != encoding
  810. || ((((encoding & 0x70) != 0
  811. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  812. && (encoding & 0x70) != DW_EH_PE_pcrel
  813. #endif
  814. )
  815. /* leb128 can be handled, but does something actually need it? */
  816. || (encoding & 7) == DW_EH_PE_uleb128
  817. || (encoding & 7) > DW_EH_PE_udata8)
  818. && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
  819. {
  820. as_bad (_("invalid or unsupported encoding in .cfi_personality"));
  821. ignore_rest_of_line ();
  822. return;
  823. }
  824. if (*input_line_pointer++ != ',')
  825. {
  826. as_bad (_(".cfi_personality requires encoding and symbol arguments"));
  827. ignore_rest_of_line ();
  828. return;
  829. }
  830. expression_and_evaluate (&fde->personality);
  831. switch (fde->personality.X_op)
  832. {
  833. case O_symbol:
  834. break;
  835. case O_constant:
  836. if ((encoding & 0x70) == DW_EH_PE_pcrel)
  837. encoding = DW_EH_PE_omit;
  838. break;
  839. default:
  840. encoding = DW_EH_PE_omit;
  841. break;
  842. }
  843. fde->per_encoding = encoding;
  844. if (encoding == DW_EH_PE_omit)
  845. {
  846. as_bad (_("wrong second argument to .cfi_personality"));
  847. ignore_rest_of_line ();
  848. return;
  849. }
  850. demand_empty_rest_of_line ();
  851. }
  852. static void
  853. dot_cfi_lsda (int ignored ATTRIBUTE_UNUSED)
  854. {
  855. struct fde_entry *fde;
  856. offsetT encoding;
  857. if (frchain_now->frch_cfi_data == NULL)
  858. {
  859. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  860. ignore_rest_of_line ();
  861. return;
  862. }
  863. fde = frchain_now->frch_cfi_data->cur_fde_data;
  864. encoding = cfi_parse_const ();
  865. if (encoding == DW_EH_PE_omit)
  866. {
  867. demand_empty_rest_of_line ();
  868. fde->lsda_encoding = encoding;
  869. return;
  870. }
  871. if ((encoding & 0xff) != encoding
  872. || ((((encoding & 0x70) != 0
  873. #if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr
  874. && (encoding & 0x70) != DW_EH_PE_pcrel
  875. #endif
  876. )
  877. /* leb128 can be handled, but does something actually need it? */
  878. || (encoding & 7) == DW_EH_PE_uleb128
  879. || (encoding & 7) > DW_EH_PE_udata8)
  880. && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE))
  881. {
  882. as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
  883. ignore_rest_of_line ();
  884. return;
  885. }
  886. if (*input_line_pointer++ != ',')
  887. {
  888. as_bad (_(".cfi_lsda requires encoding and symbol arguments"));
  889. ignore_rest_of_line ();
  890. return;
  891. }
  892. fde->lsda_encoding = encoding;
  893. expression_and_evaluate (&fde->lsda);
  894. switch (fde->lsda.X_op)
  895. {
  896. case O_symbol:
  897. break;
  898. case O_constant:
  899. if ((encoding & 0x70) == DW_EH_PE_pcrel)
  900. encoding = DW_EH_PE_omit;
  901. break;
  902. default:
  903. encoding = DW_EH_PE_omit;
  904. break;
  905. }
  906. fde->lsda_encoding = encoding;
  907. if (encoding == DW_EH_PE_omit)
  908. {
  909. as_bad (_("wrong second argument to .cfi_lsda"));
  910. ignore_rest_of_line ();
  911. return;
  912. }
  913. demand_empty_rest_of_line ();
  914. }
  915. static void
  916. dot_cfi_val_encoded_addr (int ignored ATTRIBUTE_UNUSED)
  917. {
  918. struct cfi_insn_data *insn_ptr;
  919. offsetT encoding;
  920. if (frchain_now->frch_cfi_data == NULL)
  921. {
  922. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  923. ignore_rest_of_line ();
  924. return;
  925. }
  926. /* If the last address was not at the current PC, advance to current. */
  927. if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  928. || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  929. != frag_now_fix ()))
  930. cfi_add_advance_loc (symbol_temp_new_now ());
  931. insn_ptr = alloc_cfi_insn_data ();
  932. insn_ptr->insn = CFI_val_encoded_addr;
  933. insn_ptr->u.ea.reg = cfi_parse_reg ();
  934. cfi_parse_separator ();
  935. encoding = cfi_parse_const ();
  936. if ((encoding & 0xff) != encoding
  937. || ((encoding & 0x70) != 0
  938. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  939. && (encoding & 0x70) != DW_EH_PE_pcrel
  940. #endif
  941. )
  942. /* leb128 can be handled, but does something actually need it? */
  943. || (encoding & 7) == DW_EH_PE_uleb128
  944. || (encoding & 7) > DW_EH_PE_udata8)
  945. {
  946. as_bad (_("invalid or unsupported encoding in .cfi_lsda"));
  947. encoding = DW_EH_PE_omit;
  948. }
  949. cfi_parse_separator ();
  950. expression_and_evaluate (&insn_ptr->u.ea.exp);
  951. switch (insn_ptr->u.ea.exp.X_op)
  952. {
  953. case O_symbol:
  954. break;
  955. case O_constant:
  956. if ((encoding & 0x70) != DW_EH_PE_pcrel)
  957. break;
  958. /* Fall through. */
  959. default:
  960. encoding = DW_EH_PE_omit;
  961. break;
  962. }
  963. insn_ptr->u.ea.encoding = encoding;
  964. if (encoding == DW_EH_PE_omit)
  965. {
  966. as_bad (_("wrong third argument to .cfi_val_encoded_addr"));
  967. ignore_rest_of_line ();
  968. return;
  969. }
  970. demand_empty_rest_of_line ();
  971. }
  972. static void
  973. dot_cfi_label (int ignored ATTRIBUTE_UNUSED)
  974. {
  975. char *name;
  976. if (frchain_now->frch_cfi_data == NULL)
  977. {
  978. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  979. ignore_rest_of_line ();
  980. return;
  981. }
  982. name = read_symbol_name ();
  983. if (name == NULL)
  984. return;
  985. /* If the last address was not at the current PC, advance to current. */
  986. if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now
  987. || (S_GET_VALUE (frchain_now->frch_cfi_data->last_address)
  988. != frag_now_fix ()))
  989. cfi_add_advance_loc (symbol_temp_new_now ());
  990. cfi_add_label (name);
  991. free (name);
  992. demand_empty_rest_of_line ();
  993. }
  994. static void
  995. dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
  996. {
  997. int sections = 0;
  998. SKIP_WHITESPACE ();
  999. if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
  1000. while (1)
  1001. {
  1002. char * saved_ilp;
  1003. char *name, c;
  1004. saved_ilp = input_line_pointer;
  1005. c = get_symbol_name (& name);
  1006. if (startswith (name, ".eh_frame")
  1007. && name[9] != '_')
  1008. sections |= CFI_EMIT_eh_frame;
  1009. else if (startswith (name, ".debug_frame"))
  1010. sections |= CFI_EMIT_debug_frame;
  1011. #if SUPPORT_COMPACT_EH
  1012. else if (startswith (name, ".eh_frame_entry"))
  1013. {
  1014. compact_eh = true;
  1015. sections |= CFI_EMIT_eh_frame_compact;
  1016. }
  1017. #endif
  1018. #ifdef tc_cfi_section_name
  1019. else if (strcmp (name, tc_cfi_section_name) == 0)
  1020. sections |= CFI_EMIT_target;
  1021. #endif
  1022. else
  1023. {
  1024. *input_line_pointer = c;
  1025. input_line_pointer = saved_ilp;
  1026. break;
  1027. }
  1028. *input_line_pointer = c;
  1029. SKIP_WHITESPACE_AFTER_NAME ();
  1030. if (*input_line_pointer == ',')
  1031. {
  1032. name = input_line_pointer++;
  1033. SKIP_WHITESPACE ();
  1034. if (!is_name_beginner (*input_line_pointer)
  1035. && *input_line_pointer != '"')
  1036. {
  1037. input_line_pointer = name;
  1038. break;
  1039. }
  1040. }
  1041. else if (is_name_beginner (*input_line_pointer)
  1042. || *input_line_pointer == '"')
  1043. break;
  1044. }
  1045. demand_empty_rest_of_line ();
  1046. if (cfi_sections_set
  1047. && (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
  1048. && ((cfi_sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))
  1049. != (sections & (CFI_EMIT_eh_frame | CFI_EMIT_eh_frame_compact))))
  1050. as_bad (_("inconsistent uses of .cfi_sections"));
  1051. cfi_sections = sections;
  1052. }
  1053. static void
  1054. dot_cfi_startproc (int ignored ATTRIBUTE_UNUSED)
  1055. {
  1056. int simple = 0;
  1057. if (frchain_now->frch_cfi_data != NULL)
  1058. {
  1059. as_bad (_("previous CFI entry not closed (missing .cfi_endproc)"));
  1060. ignore_rest_of_line ();
  1061. return;
  1062. }
  1063. cfi_new_fde (symbol_temp_new_now ());
  1064. SKIP_WHITESPACE ();
  1065. if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"')
  1066. {
  1067. char * saved_ilp = input_line_pointer;
  1068. char *name, c;
  1069. c = get_symbol_name (& name);
  1070. if (strcmp (name, "simple") == 0)
  1071. {
  1072. simple = 1;
  1073. restore_line_pointer (c);
  1074. }
  1075. else
  1076. input_line_pointer = saved_ilp;
  1077. }
  1078. demand_empty_rest_of_line ();
  1079. cfi_sections_set = true;
  1080. all_cfi_sections |= cfi_sections;
  1081. cfi_set_sections ();
  1082. frchain_now->frch_cfi_data->cur_cfa_offset = 0;
  1083. if (!simple)
  1084. tc_cfi_frame_initial_instructions ();
  1085. if ((cfi_sections & CFI_EMIT_target) != 0)
  1086. tc_cfi_startproc ();
  1087. }
  1088. static void
  1089. dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED)
  1090. {
  1091. if (frchain_now->frch_cfi_data == NULL)
  1092. {
  1093. as_bad (_(".cfi_endproc without corresponding .cfi_startproc"));
  1094. ignore_rest_of_line ();
  1095. return;
  1096. }
  1097. last_fde = frchain_now->frch_cfi_data->cur_fde_data;
  1098. cfi_end_fde (symbol_temp_new_now ());
  1099. demand_empty_rest_of_line ();
  1100. cfi_sections_set = true;
  1101. if ((cfi_sections & CFI_EMIT_target) != 0)
  1102. tc_cfi_endproc (last_fde);
  1103. }
  1104. static segT
  1105. get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
  1106. {
  1107. /* Exclude .debug_frame sections for Compact EH. */
  1108. if (SUPPORT_FRAME_LINKONCE || ((flags & SEC_DEBUGGING) == 0 && compact_eh))
  1109. {
  1110. struct dwcfi_seg_list *l;
  1111. l = dwcfi_hash_find_or_make (cseg, base, flags);
  1112. cseg = l->seg;
  1113. subseg_set (cseg, l->subseg);
  1114. }
  1115. else
  1116. {
  1117. cseg = subseg_new (base, 0);
  1118. bfd_set_section_flags (cseg, flags);
  1119. }
  1120. record_alignment (cseg, align);
  1121. return cseg;
  1122. }
  1123. #if SUPPORT_COMPACT_EH
  1124. static void
  1125. dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
  1126. {
  1127. struct fde_entry *fde;
  1128. if (frchain_now->frch_cfi_data == NULL)
  1129. {
  1130. as_bad (_("CFI instruction used without previous .cfi_startproc"));
  1131. ignore_rest_of_line ();
  1132. return;
  1133. }
  1134. fde = frchain_now->frch_cfi_data->cur_fde_data;
  1135. fde->personality_id = cfi_parse_const ();
  1136. demand_empty_rest_of_line ();
  1137. if (fde->personality_id == 0 || fde->personality_id > 3)
  1138. {
  1139. as_bad (_("wrong argument to .cfi_personality_id"));
  1140. return;
  1141. }
  1142. }
  1143. static void
  1144. dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
  1145. {
  1146. if (frchain_now->frch_cfi_data == NULL)
  1147. {
  1148. as_bad (_(".cfi_fde_data without corresponding .cfi_startproc"));
  1149. ignore_rest_of_line ();
  1150. return;
  1151. }
  1152. last_fde = frchain_now->frch_cfi_data->cur_fde_data;
  1153. cfi_sections_set = true;
  1154. if ((cfi_sections & CFI_EMIT_target) != 0
  1155. || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
  1156. {
  1157. struct cfi_escape_data *head, **tail, *e;
  1158. int num_ops = 0;
  1159. tail = &head;
  1160. if (!is_it_end_of_statement ())
  1161. {
  1162. num_ops = 0;
  1163. do
  1164. {
  1165. e = XNEW (struct cfi_escape_data);
  1166. do_parse_cons_expression (&e->exp, 1);
  1167. *tail = e;
  1168. tail = &e->next;
  1169. num_ops++;
  1170. }
  1171. while (*input_line_pointer++ == ',');
  1172. --input_line_pointer;
  1173. }
  1174. *tail = NULL;
  1175. if (last_fde->lsda_encoding != DW_EH_PE_omit)
  1176. last_fde->eh_header_type = EH_COMPACT_HAS_LSDA;
  1177. else if (num_ops <= 3 && last_fde->per_encoding == DW_EH_PE_omit)
  1178. last_fde->eh_header_type = EH_COMPACT_INLINE;
  1179. else
  1180. last_fde->eh_header_type = EH_COMPACT_OUTLINE;
  1181. if (last_fde->eh_header_type == EH_COMPACT_INLINE)
  1182. num_ops = 3;
  1183. last_fde->eh_data_size = num_ops;
  1184. last_fde->eh_data = XNEWVEC (bfd_byte, num_ops);
  1185. num_ops = 0;
  1186. while (head)
  1187. {
  1188. e = head;
  1189. head = e->next;
  1190. last_fde->eh_data[num_ops++] = e->exp.X_add_number;
  1191. free (e);
  1192. }
  1193. if (last_fde->eh_header_type == EH_COMPACT_INLINE)
  1194. while (num_ops < 3)
  1195. last_fde->eh_data[num_ops++] = tc_compact_eh_opcode_stop;
  1196. }
  1197. demand_empty_rest_of_line ();
  1198. }
  1199. /* Function to emit the compact unwinding opcodes stored in the
  1200. fde's eh_data field. The end of the opcode data will be
  1201. padded to the value in align. */
  1202. static void
  1203. output_compact_unwind_data (struct fde_entry *fde, int align)
  1204. {
  1205. int data_size = fde->eh_data_size + 2;
  1206. int align_padding;
  1207. int amask;
  1208. char *p;
  1209. fde->eh_loc = symbol_temp_new_now ();
  1210. p = frag_more (1);
  1211. if (fde->personality_id != 0)
  1212. *p = fde->personality_id;
  1213. else if (fde->per_encoding != DW_EH_PE_omit)
  1214. {
  1215. *p = 0;
  1216. emit_expr_encoded (&fde->personality, fde->per_encoding, false);
  1217. data_size += encoding_size (fde->per_encoding);
  1218. }
  1219. else
  1220. *p = 1;
  1221. amask = (1 << align) - 1;
  1222. align_padding = ((data_size + amask) & ~amask) - data_size;
  1223. p = frag_more (fde->eh_data_size + 1 + align_padding);
  1224. memcpy (p, fde->eh_data, fde->eh_data_size);
  1225. p += fde->eh_data_size;
  1226. while (align_padding-- > 0)
  1227. *(p++) = tc_compact_eh_opcode_pad;
  1228. *(p++) = tc_compact_eh_opcode_stop;
  1229. fde->eh_header_type = EH_COMPACT_OUTLINE_DONE;
  1230. }
  1231. /* Handle the .cfi_inline_lsda directive. */
  1232. static void
  1233. dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
  1234. {
  1235. segT ccseg;
  1236. int align;
  1237. long max_alignment = 28;
  1238. if (!last_fde)
  1239. {
  1240. as_bad (_("unexpected .cfi_inline_lsda"));
  1241. ignore_rest_of_line ();
  1242. return;
  1243. }
  1244. if ((last_fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  1245. {
  1246. as_bad (_(".cfi_inline_lsda not valid for this frame"));
  1247. ignore_rest_of_line ();
  1248. return;
  1249. }
  1250. if (last_fde->eh_header_type != EH_COMPACT_UNKNOWN
  1251. && last_fde->eh_header_type != EH_COMPACT_HAS_LSDA)
  1252. {
  1253. as_bad (_(".cfi_inline_lsda seen for frame without .cfi_lsda"));
  1254. ignore_rest_of_line ();
  1255. return;
  1256. }
  1257. #ifdef md_flush_pending_output
  1258. md_flush_pending_output ();
  1259. #endif
  1260. align = get_absolute_expression ();
  1261. if (align > max_alignment)
  1262. {
  1263. align = max_alignment;
  1264. as_bad (_("Alignment too large: %d. assumed."), align);
  1265. }
  1266. else if (align < 0)
  1267. {
  1268. as_warn (_("Alignment negative: 0 assumed."));
  1269. align = 0;
  1270. }
  1271. demand_empty_rest_of_line ();
  1272. ccseg = CUR_SEG (last_fde);
  1273. /* Open .gnu_extab section. */
  1274. get_cfi_seg (ccseg, ".gnu_extab",
  1275. (SEC_ALLOC | SEC_LOAD | SEC_DATA
  1276. | DWARF2_EH_FRAME_READ_ONLY),
  1277. 1);
  1278. frag_align (align, 0, 0);
  1279. record_alignment (now_seg, align);
  1280. if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA)
  1281. output_compact_unwind_data (last_fde, align);
  1282. last_fde = NULL;
  1283. return;
  1284. }
  1285. #else /* !SUPPORT_COMPACT_EH */
  1286. static void
  1287. dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED)
  1288. {
  1289. as_bad (_(".cfi_inline_lsda is not supported for this target"));
  1290. ignore_rest_of_line ();
  1291. }
  1292. static void
  1293. dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED)
  1294. {
  1295. as_bad (_(".cfi_fde_data is not supported for this target"));
  1296. ignore_rest_of_line ();
  1297. }
  1298. static void
  1299. dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED)
  1300. {
  1301. as_bad (_(".cfi_personality_id is not supported for this target"));
  1302. ignore_rest_of_line ();
  1303. }
  1304. #endif
  1305. static void
  1306. output_cfi_insn (struct cfi_insn_data *insn)
  1307. {
  1308. offsetT offset;
  1309. unsigned int regno;
  1310. switch (insn->insn)
  1311. {
  1312. case DW_CFA_advance_loc:
  1313. {
  1314. symbolS *from = insn->u.ll.lab1;
  1315. symbolS *to = insn->u.ll.lab2;
  1316. if (symbol_get_frag (to) == symbol_get_frag (from))
  1317. {
  1318. addressT delta = S_GET_VALUE (to) - S_GET_VALUE (from);
  1319. addressT scaled = delta / DWARF2_LINE_MIN_INSN_LENGTH;
  1320. if (scaled == 0)
  1321. ;
  1322. else if (scaled <= 0x3F)
  1323. out_one (DW_CFA_advance_loc + scaled);
  1324. else if (scaled <= 0xFF)
  1325. {
  1326. out_one (DW_CFA_advance_loc1);
  1327. out_one (scaled);
  1328. }
  1329. else if (scaled <= 0xFFFF)
  1330. {
  1331. out_one (DW_CFA_advance_loc2);
  1332. out_two (scaled);
  1333. }
  1334. else
  1335. {
  1336. out_one (DW_CFA_advance_loc4);
  1337. out_four (scaled);
  1338. }
  1339. }
  1340. else
  1341. {
  1342. expressionS exp;
  1343. exp.X_op = O_subtract;
  1344. exp.X_add_symbol = to;
  1345. exp.X_op_symbol = from;
  1346. exp.X_add_number = 0;
  1347. /* The code in ehopt.c expects that one byte of the encoding
  1348. is already allocated to the frag. This comes from the way
  1349. that it scans the .eh_frame section looking first for the
  1350. .byte DW_CFA_advance_loc4. Call frag_grow with the sum of
  1351. room needed by frag_more and frag_var to preallocate space
  1352. ensuring that the DW_CFA_advance_loc4 is in the fixed part
  1353. of the rs_cfa frag, so that the relax machinery can remove
  1354. the advance_loc should it advance by zero. */
  1355. frag_grow (5);
  1356. *frag_more (1) = DW_CFA_advance_loc4;
  1357. frag_var (rs_cfa, 4, 0, DWARF2_LINE_MIN_INSN_LENGTH << 3,
  1358. make_expr_symbol (&exp), frag_now_fix () - 1,
  1359. (char *) frag_now);
  1360. }
  1361. }
  1362. break;
  1363. case DW_CFA_def_cfa:
  1364. offset = insn->u.ri.offset;
  1365. if (offset < 0)
  1366. {
  1367. out_one (DW_CFA_def_cfa_sf);
  1368. out_uleb128 (insn->u.ri.reg);
  1369. out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT);
  1370. }
  1371. else
  1372. {
  1373. out_one (DW_CFA_def_cfa);
  1374. out_uleb128 (insn->u.ri.reg);
  1375. out_uleb128 (offset);
  1376. }
  1377. break;
  1378. case DW_CFA_def_cfa_register:
  1379. case DW_CFA_undefined:
  1380. case DW_CFA_same_value:
  1381. out_one (insn->insn);
  1382. out_uleb128 (insn->u.r);
  1383. break;
  1384. case DW_CFA_def_cfa_offset:
  1385. offset = insn->u.i;
  1386. if (offset < 0)
  1387. {
  1388. out_one (DW_CFA_def_cfa_offset_sf);
  1389. out_sleb128 (offset / DWARF2_CIE_DATA_ALIGNMENT);
  1390. }
  1391. else
  1392. {
  1393. out_one (DW_CFA_def_cfa_offset);
  1394. out_uleb128 (offset);
  1395. }
  1396. break;
  1397. case DW_CFA_restore:
  1398. regno = insn->u.r;
  1399. if (regno <= 0x3F)
  1400. {
  1401. out_one (DW_CFA_restore + regno);
  1402. }
  1403. else
  1404. {
  1405. out_one (DW_CFA_restore_extended);
  1406. out_uleb128 (regno);
  1407. }
  1408. break;
  1409. case DW_CFA_offset:
  1410. regno = insn->u.ri.reg;
  1411. offset = insn->u.ri.offset / DWARF2_CIE_DATA_ALIGNMENT;
  1412. if (offset < 0)
  1413. {
  1414. out_one (DW_CFA_offset_extended_sf);
  1415. out_uleb128 (regno);
  1416. out_sleb128 (offset);
  1417. }
  1418. else if (regno <= 0x3F)
  1419. {
  1420. out_one (DW_CFA_offset + regno);
  1421. out_uleb128 (offset);
  1422. }
  1423. else
  1424. {
  1425. out_one (DW_CFA_offset_extended);
  1426. out_uleb128 (regno);
  1427. out_uleb128 (offset);
  1428. }
  1429. break;
  1430. case DW_CFA_val_offset:
  1431. regno = insn->u.ri.reg;
  1432. offset = insn->u.ri.offset / DWARF2_CIE_DATA_ALIGNMENT;
  1433. if (offset < 0)
  1434. {
  1435. out_one (DW_CFA_val_offset_sf);
  1436. out_uleb128 (regno);
  1437. out_sleb128 (offset);
  1438. }
  1439. else
  1440. {
  1441. out_one (DW_CFA_val_offset);
  1442. out_uleb128 (regno);
  1443. out_uleb128 (offset);
  1444. }
  1445. break;
  1446. case DW_CFA_register:
  1447. out_one (DW_CFA_register);
  1448. out_uleb128 (insn->u.rr.reg1);
  1449. out_uleb128 (insn->u.rr.reg2);
  1450. break;
  1451. case DW_CFA_remember_state:
  1452. case DW_CFA_restore_state:
  1453. out_one (insn->insn);
  1454. break;
  1455. case DW_CFA_GNU_window_save:
  1456. out_one (DW_CFA_GNU_window_save);
  1457. break;
  1458. case CFI_escape:
  1459. {
  1460. struct cfi_escape_data *e;
  1461. for (e = insn->u.esc; e ; e = e->next)
  1462. emit_expr (&e->exp, 1);
  1463. break;
  1464. }
  1465. case CFI_val_encoded_addr:
  1466. {
  1467. unsigned encoding = insn->u.ea.encoding;
  1468. offsetT enc_size;
  1469. if (encoding == DW_EH_PE_omit)
  1470. break;
  1471. out_one (DW_CFA_val_expression);
  1472. out_uleb128 (insn->u.ea.reg);
  1473. switch (encoding & 0x7)
  1474. {
  1475. case DW_EH_PE_absptr:
  1476. enc_size = DWARF2_ADDR_SIZE (stdoutput);
  1477. break;
  1478. case DW_EH_PE_udata2:
  1479. enc_size = 2;
  1480. break;
  1481. case DW_EH_PE_udata4:
  1482. enc_size = 4;
  1483. break;
  1484. case DW_EH_PE_udata8:
  1485. enc_size = 8;
  1486. break;
  1487. default:
  1488. abort ();
  1489. }
  1490. /* If the user has requested absolute encoding,
  1491. then use the smaller DW_OP_addr encoding. */
  1492. if (insn->u.ea.encoding == DW_EH_PE_absptr)
  1493. {
  1494. out_uleb128 (1 + enc_size);
  1495. out_one (DW_OP_addr);
  1496. }
  1497. else
  1498. {
  1499. out_uleb128 (1 + 1 + enc_size);
  1500. out_one (DW_OP_GNU_encoded_addr);
  1501. out_one (encoding);
  1502. if ((encoding & 0x70) == DW_EH_PE_pcrel)
  1503. {
  1504. #if CFI_DIFF_EXPR_OK
  1505. insn->u.ea.exp.X_op = O_subtract;
  1506. insn->u.ea.exp.X_op_symbol = symbol_temp_new_now ();
  1507. #elif defined (tc_cfi_emit_pcrel_expr)
  1508. tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, enc_size);
  1509. break;
  1510. #else
  1511. abort ();
  1512. #endif
  1513. }
  1514. }
  1515. emit_expr (&insn->u.ea.exp, enc_size);
  1516. }
  1517. break;
  1518. case CFI_label:
  1519. colon (insn->u.sym_name);
  1520. break;
  1521. default:
  1522. abort ();
  1523. }
  1524. }
  1525. static void
  1526. output_cie (struct cie_entry *cie, bool eh_frame, int align)
  1527. {
  1528. symbolS *after_size_address, *end_address;
  1529. expressionS exp;
  1530. struct cfi_insn_data *i;
  1531. offsetT augmentation_size;
  1532. int enc;
  1533. enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
  1534. cie->start_address = symbol_temp_new_now ();
  1535. after_size_address = symbol_temp_make ();
  1536. end_address = symbol_temp_make ();
  1537. exp.X_op = O_subtract;
  1538. exp.X_add_symbol = end_address;
  1539. exp.X_op_symbol = after_size_address;
  1540. exp.X_add_number = 0;
  1541. if (eh_frame || fmt == dwarf2_format_32bit)
  1542. emit_expr (&exp, 4); /* Length. */
  1543. else
  1544. {
  1545. if (fmt == dwarf2_format_64bit)
  1546. out_four (-1);
  1547. emit_expr (&exp, 8); /* Length. */
  1548. }
  1549. symbol_set_value_now (after_size_address);
  1550. if (eh_frame)
  1551. out_four (0); /* CIE id. */
  1552. else
  1553. {
  1554. out_four (-1); /* CIE id. */
  1555. if (fmt != dwarf2_format_32bit)
  1556. out_four (-1);
  1557. }
  1558. out_one (flag_dwarf_cie_version); /* Version. */
  1559. if (eh_frame)
  1560. {
  1561. out_one ('z'); /* Augmentation. */
  1562. if (cie->per_encoding != DW_EH_PE_omit)
  1563. out_one ('P');
  1564. if (cie->lsda_encoding != DW_EH_PE_omit)
  1565. out_one ('L');
  1566. out_one ('R');
  1567. #ifdef tc_output_cie_extra
  1568. tc_output_cie_extra (cie);
  1569. #endif
  1570. }
  1571. if (cie->signal_frame)
  1572. out_one ('S');
  1573. out_one (0);
  1574. if (flag_dwarf_cie_version >= 4)
  1575. {
  1576. /* For now we are assuming a flat address space with 4 or 8 byte
  1577. addresses. */
  1578. int address_size = dwarf2_format_32bit ? 4 : 8;
  1579. out_one (address_size); /* Address size. */
  1580. out_one (0); /* Segment size. */
  1581. }
  1582. out_uleb128 (DWARF2_LINE_MIN_INSN_LENGTH); /* Code alignment. */
  1583. out_sleb128 (DWARF2_CIE_DATA_ALIGNMENT); /* Data alignment. */
  1584. if (flag_dwarf_cie_version == 1) /* Return column. */
  1585. {
  1586. if ((cie->return_column & 0xff) != cie->return_column)
  1587. as_bad (_("return column number %d overflows in CIE version 1"),
  1588. cie->return_column);
  1589. out_one (cie->return_column);
  1590. }
  1591. else
  1592. out_uleb128 (cie->return_column);
  1593. if (eh_frame)
  1594. {
  1595. augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit);
  1596. if (cie->per_encoding != DW_EH_PE_omit)
  1597. augmentation_size += 1 + encoding_size (cie->per_encoding);
  1598. out_uleb128 (augmentation_size); /* Augmentation size. */
  1599. emit_expr_encoded (&cie->personality, cie->per_encoding, true);
  1600. if (cie->lsda_encoding != DW_EH_PE_omit)
  1601. out_one (cie->lsda_encoding);
  1602. }
  1603. switch (DWARF2_FDE_RELOC_SIZE)
  1604. {
  1605. case 2:
  1606. enc = DW_EH_PE_sdata2;
  1607. break;
  1608. case 4:
  1609. enc = DW_EH_PE_sdata4;
  1610. break;
  1611. case 8:
  1612. enc = DW_EH_PE_sdata8;
  1613. break;
  1614. default:
  1615. abort ();
  1616. }
  1617. #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr
  1618. enc |= DW_EH_PE_pcrel;
  1619. #endif
  1620. #ifdef DWARF2_FDE_RELOC_ENCODING
  1621. /* Allow target to override encoding. */
  1622. enc = DWARF2_FDE_RELOC_ENCODING (enc);
  1623. #endif
  1624. cie->fde_encoding = enc;
  1625. if (eh_frame)
  1626. out_one (enc);
  1627. if (cie->first)
  1628. {
  1629. for (i = cie->first; i != cie->last; i = i->next)
  1630. {
  1631. if (CUR_SEG (i) != CUR_SEG (cie))
  1632. continue;
  1633. output_cfi_insn (i);
  1634. }
  1635. }
  1636. frag_align (align, DW_CFA_nop, 0);
  1637. symbol_set_value_now (end_address);
  1638. }
  1639. static void
  1640. output_fde (struct fde_entry *fde, struct cie_entry *cie,
  1641. bool eh_frame, struct cfi_insn_data *first,
  1642. int align)
  1643. {
  1644. symbolS *after_size_address, *end_address;
  1645. expressionS exp;
  1646. offsetT augmentation_size;
  1647. enum dwarf2_format fmt = DWARF2_FORMAT (now_seg);
  1648. unsigned int offset_size;
  1649. unsigned int addr_size;
  1650. after_size_address = symbol_temp_make ();
  1651. end_address = symbol_temp_make ();
  1652. exp.X_op = O_subtract;
  1653. exp.X_add_symbol = end_address;
  1654. exp.X_op_symbol = after_size_address;
  1655. exp.X_add_number = 0;
  1656. if (eh_frame || fmt == dwarf2_format_32bit)
  1657. offset_size = 4;
  1658. else
  1659. {
  1660. if (fmt == dwarf2_format_64bit)
  1661. out_four (-1);
  1662. offset_size = 8;
  1663. }
  1664. emit_expr (&exp, offset_size); /* Length. */
  1665. symbol_set_value_now (after_size_address);
  1666. if (eh_frame)
  1667. {
  1668. exp.X_op = O_subtract;
  1669. exp.X_add_symbol = after_size_address;
  1670. exp.X_op_symbol = cie->start_address;
  1671. exp.X_add_number = 0;
  1672. emit_expr (&exp, offset_size); /* CIE offset. */
  1673. }
  1674. else
  1675. {
  1676. TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size);
  1677. }
  1678. exp.X_op = O_symbol;
  1679. if (eh_frame)
  1680. {
  1681. bfd_reloc_code_real_type code
  1682. = tc_cfi_reloc_for_encoding (cie->fde_encoding);
  1683. addr_size = DWARF2_FDE_RELOC_SIZE;
  1684. if (code != BFD_RELOC_NONE)
  1685. {
  1686. reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code);
  1687. char *p = frag_more (addr_size);
  1688. gas_assert (addr_size == (unsigned) howto->bitsize / 8);
  1689. md_number_to_chars (p, 0, addr_size);
  1690. fix_new (frag_now, p - frag_now->fr_literal, addr_size,
  1691. fde->start_address, 0, howto->pc_relative, code);
  1692. }
  1693. else
  1694. {
  1695. exp.X_op = O_subtract;
  1696. exp.X_add_number = 0;
  1697. #if CFI_DIFF_EXPR_OK
  1698. exp.X_add_symbol = fde->start_address;
  1699. exp.X_op_symbol = symbol_temp_new_now ();
  1700. emit_expr (&exp, addr_size); /* Code offset. */
  1701. #else
  1702. exp.X_op = O_symbol;
  1703. exp.X_add_symbol = fde->start_address;
  1704. #if defined(tc_cfi_emit_pcrel_expr)
  1705. tc_cfi_emit_pcrel_expr (&exp, addr_size); /* Code offset. */
  1706. #else
  1707. emit_expr (&exp, addr_size); /* Code offset. */
  1708. #endif
  1709. #endif
  1710. }
  1711. }
  1712. else
  1713. {
  1714. exp.X_add_number = 0;
  1715. exp.X_add_symbol = fde->start_address;
  1716. addr_size = DWARF2_ADDR_SIZE (stdoutput);
  1717. emit_expr (&exp, addr_size);
  1718. }
  1719. exp.X_op = O_subtract;
  1720. exp.X_add_symbol = fde->end_address;
  1721. exp.X_op_symbol = fde->start_address; /* Code length. */
  1722. exp.X_add_number = 0;
  1723. emit_expr (&exp, addr_size);
  1724. augmentation_size = encoding_size (fde->lsda_encoding);
  1725. if (eh_frame)
  1726. out_uleb128 (augmentation_size); /* Augmentation size. */
  1727. emit_expr_encoded (&fde->lsda, cie->lsda_encoding, false);
  1728. for (; first; first = first->next)
  1729. if (CUR_SEG (first) == CUR_SEG (fde))
  1730. output_cfi_insn (first);
  1731. frag_align (align, DW_CFA_nop, 0);
  1732. symbol_set_value_now (end_address);
  1733. }
  1734. /* Allow these insns to be put in the initial sequence of a CIE.
  1735. If J is non-NULL, then compare I and J insns for a match. */
  1736. static inline bool
  1737. initial_cie_insn (const struct cfi_insn_data *i, const struct cfi_insn_data *j)
  1738. {
  1739. if (j && i->insn != j->insn)
  1740. return false;
  1741. switch (i->insn)
  1742. {
  1743. case DW_CFA_offset:
  1744. case DW_CFA_def_cfa:
  1745. case DW_CFA_val_offset:
  1746. if (j)
  1747. {
  1748. if (i->u.ri.reg != j->u.ri.reg)
  1749. return false;
  1750. if (i->u.ri.offset != j->u.ri.offset)
  1751. return false;
  1752. }
  1753. break;
  1754. case DW_CFA_register:
  1755. if (j)
  1756. {
  1757. if (i->u.rr.reg1 != j->u.rr.reg1)
  1758. return false;
  1759. if (i->u.rr.reg2 != j->u.rr.reg2)
  1760. return false;
  1761. }
  1762. break;
  1763. case DW_CFA_def_cfa_register:
  1764. case DW_CFA_restore:
  1765. case DW_CFA_undefined:
  1766. case DW_CFA_same_value:
  1767. if (j)
  1768. {
  1769. if (i->u.r != j->u.r)
  1770. return false;
  1771. }
  1772. break;
  1773. case DW_CFA_def_cfa_offset:
  1774. if (j)
  1775. {
  1776. if (i->u.i != j->u.i)
  1777. return false;
  1778. }
  1779. break;
  1780. default:
  1781. return false;
  1782. }
  1783. return true;
  1784. }
  1785. static struct cie_entry *
  1786. select_cie_for_fde (struct fde_entry *fde, bool eh_frame,
  1787. struct cfi_insn_data **pfirst, int align)
  1788. {
  1789. struct cfi_insn_data *i, *j;
  1790. struct cie_entry *cie;
  1791. for (cie = cie_root; cie; cie = cie->next)
  1792. {
  1793. if (CUR_SEG (cie) != CUR_SEG (fde))
  1794. continue;
  1795. #ifdef tc_cie_fde_equivalent_extra
  1796. if (!tc_cie_fde_equivalent_extra (cie, fde))
  1797. continue;
  1798. #endif
  1799. if (cie->return_column != fde->return_column
  1800. || cie->signal_frame != fde->signal_frame
  1801. || cie->per_encoding != fde->per_encoding
  1802. || cie->lsda_encoding != fde->lsda_encoding)
  1803. continue;
  1804. if (cie->per_encoding != DW_EH_PE_omit)
  1805. {
  1806. if (cie->personality.X_op != fde->personality.X_op
  1807. || (cie->personality.X_add_number
  1808. != fde->personality.X_add_number))
  1809. continue;
  1810. switch (cie->personality.X_op)
  1811. {
  1812. case O_constant:
  1813. if (cie->personality.X_unsigned != fde->personality.X_unsigned)
  1814. continue;
  1815. break;
  1816. case O_symbol:
  1817. if (cie->personality.X_add_symbol
  1818. != fde->personality.X_add_symbol)
  1819. continue;
  1820. break;
  1821. default:
  1822. abort ();
  1823. }
  1824. }
  1825. for (i = cie->first, j = fde->data;
  1826. i != cie->last && j != NULL;
  1827. i = i->next, j = j->next)
  1828. {
  1829. if (!initial_cie_insn (i, j))
  1830. break;
  1831. }
  1832. if (i == cie->last)
  1833. {
  1834. *pfirst = j;
  1835. return cie;
  1836. }
  1837. }
  1838. cie = XNEW (struct cie_entry);
  1839. cie->next = cie_root;
  1840. cie_root = cie;
  1841. SET_CUR_SEG (cie, CUR_SEG (fde));
  1842. cie->return_column = fde->return_column;
  1843. cie->signal_frame = fde->signal_frame;
  1844. cie->per_encoding = fde->per_encoding;
  1845. cie->lsda_encoding = fde->lsda_encoding;
  1846. cie->personality = fde->personality;
  1847. cie->first = fde->data;
  1848. #ifdef tc_cie_entry_init_extra
  1849. tc_cie_entry_init_extra (cie, fde)
  1850. #endif
  1851. for (i = cie->first; i ; i = i->next)
  1852. if (!initial_cie_insn (i, NULL))
  1853. break;
  1854. cie->last = i;
  1855. *pfirst = i;
  1856. output_cie (cie, eh_frame, align);
  1857. return cie;
  1858. }
  1859. #ifdef md_reg_eh_frame_to_debug_frame
  1860. static void
  1861. cfi_change_reg_numbers (struct cfi_insn_data *insn, segT ccseg)
  1862. {
  1863. for (; insn; insn = insn->next)
  1864. {
  1865. if (CUR_SEG (insn) != ccseg)
  1866. continue;
  1867. switch (insn->insn)
  1868. {
  1869. case DW_CFA_advance_loc:
  1870. case DW_CFA_def_cfa_offset:
  1871. case DW_CFA_remember_state:
  1872. case DW_CFA_restore_state:
  1873. case DW_CFA_GNU_window_save:
  1874. case CFI_escape:
  1875. case CFI_label:
  1876. break;
  1877. case DW_CFA_def_cfa:
  1878. case DW_CFA_offset:
  1879. insn->u.ri.reg = md_reg_eh_frame_to_debug_frame (insn->u.ri.reg);
  1880. break;
  1881. case DW_CFA_def_cfa_register:
  1882. case DW_CFA_undefined:
  1883. case DW_CFA_same_value:
  1884. case DW_CFA_restore:
  1885. insn->u.r = md_reg_eh_frame_to_debug_frame (insn->u.r);
  1886. break;
  1887. case DW_CFA_register:
  1888. insn->u.rr.reg1 = md_reg_eh_frame_to_debug_frame (insn->u.rr.reg1);
  1889. insn->u.rr.reg2 = md_reg_eh_frame_to_debug_frame (insn->u.rr.reg2);
  1890. break;
  1891. case CFI_val_encoded_addr:
  1892. insn->u.ea.reg = md_reg_eh_frame_to_debug_frame (insn->u.ea.reg);
  1893. break;
  1894. default:
  1895. abort ();
  1896. }
  1897. }
  1898. }
  1899. #else
  1900. #define cfi_change_reg_numbers(insn, cseg) do { } while (0)
  1901. #endif
  1902. #if SUPPORT_COMPACT_EH
  1903. static void
  1904. cfi_emit_eh_header (symbolS *sym, bfd_vma addend)
  1905. {
  1906. expressionS exp;
  1907. exp.X_add_number = addend;
  1908. exp.X_add_symbol = sym;
  1909. emit_expr_encoded (&exp, DW_EH_PE_sdata4 | DW_EH_PE_pcrel, false);
  1910. }
  1911. static void
  1912. output_eh_header (struct fde_entry *fde)
  1913. {
  1914. char *p;
  1915. bfd_vma addend;
  1916. if (fde->eh_header_type == EH_COMPACT_INLINE)
  1917. addend = 0;
  1918. else
  1919. addend = 1;
  1920. cfi_emit_eh_header (fde->start_address, addend);
  1921. if (fde->eh_header_type == EH_COMPACT_INLINE)
  1922. {
  1923. p = frag_more (4);
  1924. /* Inline entries always use PR1. */
  1925. *(p++) = 1;
  1926. memcpy(p, fde->eh_data, 3);
  1927. }
  1928. else
  1929. {
  1930. if (fde->eh_header_type == EH_COMPACT_LEGACY)
  1931. addend = 1;
  1932. else if (fde->eh_header_type == EH_COMPACT_OUTLINE
  1933. || fde->eh_header_type == EH_COMPACT_OUTLINE_DONE)
  1934. addend = 0;
  1935. else
  1936. abort ();
  1937. cfi_emit_eh_header (fde->eh_loc, addend);
  1938. }
  1939. }
  1940. #endif
  1941. void
  1942. cfi_finish (void)
  1943. {
  1944. struct cie_entry *cie, *cie_next;
  1945. segT cfi_seg, ccseg;
  1946. struct fde_entry *fde;
  1947. struct cfi_insn_data *first;
  1948. int save_flag_traditional_format, seek_next_seg;
  1949. if (all_fde_data == 0)
  1950. return;
  1951. cfi_sections_set = true;
  1952. if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0
  1953. || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0)
  1954. {
  1955. /* Make sure check_eh_frame doesn't do anything with our output. */
  1956. save_flag_traditional_format = flag_traditional_format;
  1957. flag_traditional_format = 1;
  1958. if (!EH_FRAME_LINKONCE)
  1959. {
  1960. /* Open .eh_frame section. */
  1961. cfi_seg = get_cfi_seg (NULL, ".eh_frame",
  1962. (SEC_ALLOC | SEC_LOAD | SEC_DATA
  1963. | DWARF2_EH_FRAME_READ_ONLY),
  1964. EH_FRAME_ALIGNMENT);
  1965. #ifdef md_fix_up_eh_frame
  1966. md_fix_up_eh_frame (cfi_seg);
  1967. #else
  1968. (void) cfi_seg;
  1969. #endif
  1970. }
  1971. do
  1972. {
  1973. ccseg = NULL;
  1974. seek_next_seg = 0;
  1975. for (cie = cie_root; cie; cie = cie_next)
  1976. {
  1977. cie_next = cie->next;
  1978. free ((void *) cie);
  1979. }
  1980. cie_root = NULL;
  1981. for (fde = all_fde_data; fde ; fde = fde->next)
  1982. {
  1983. if ((fde->sections & CFI_EMIT_eh_frame) == 0
  1984. && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  1985. continue;
  1986. #if SUPPORT_COMPACT_EH
  1987. /* Emit a LEGACY format header if we have processed all
  1988. of the .cfi directives without encountering either inline or
  1989. out-of-line compact unwinding opcodes. */
  1990. if (fde->eh_header_type == EH_COMPACT_HAS_LSDA
  1991. || fde->eh_header_type == EH_COMPACT_UNKNOWN)
  1992. fde->eh_header_type = EH_COMPACT_LEGACY;
  1993. if (fde->eh_header_type != EH_COMPACT_LEGACY)
  1994. continue;
  1995. #endif
  1996. if (EH_FRAME_LINKONCE)
  1997. {
  1998. if (HANDLED (fde))
  1999. continue;
  2000. if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2001. {
  2002. seek_next_seg = 2;
  2003. continue;
  2004. }
  2005. if (!seek_next_seg)
  2006. {
  2007. ccseg = CUR_SEG (fde);
  2008. /* Open .eh_frame section. */
  2009. cfi_seg = get_cfi_seg (ccseg, ".eh_frame",
  2010. (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2011. | DWARF2_EH_FRAME_READ_ONLY),
  2012. EH_FRAME_ALIGNMENT);
  2013. #ifdef md_fix_up_eh_frame
  2014. md_fix_up_eh_frame (cfi_seg);
  2015. #else
  2016. (void) cfi_seg;
  2017. #endif
  2018. seek_next_seg = 1;
  2019. }
  2020. SET_HANDLED (fde, 1);
  2021. }
  2022. if (fde->end_address == NULL)
  2023. {
  2024. as_bad (_("open CFI at the end of file; "
  2025. "missing .cfi_endproc directive"));
  2026. fde->end_address = fde->start_address;
  2027. }
  2028. cie = select_cie_for_fde (fde, true, &first, 2);
  2029. fde->eh_loc = symbol_temp_new_now ();
  2030. output_fde (fde, cie, true, first,
  2031. fde->next == NULL ? EH_FRAME_ALIGNMENT : 2);
  2032. }
  2033. }
  2034. while (EH_FRAME_LINKONCE && seek_next_seg == 2);
  2035. if (EH_FRAME_LINKONCE)
  2036. for (fde = all_fde_data; fde ; fde = fde->next)
  2037. SET_HANDLED (fde, 0);
  2038. #if SUPPORT_COMPACT_EH
  2039. if (compact_eh)
  2040. {
  2041. /* Create remaining out of line table entries. */
  2042. do
  2043. {
  2044. ccseg = NULL;
  2045. seek_next_seg = 0;
  2046. for (fde = all_fde_data; fde ; fde = fde->next)
  2047. {
  2048. if ((fde->sections & CFI_EMIT_eh_frame) == 0
  2049. && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  2050. continue;
  2051. if (fde->eh_header_type != EH_COMPACT_OUTLINE)
  2052. continue;
  2053. if (HANDLED (fde))
  2054. continue;
  2055. if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2056. {
  2057. seek_next_seg = 2;
  2058. continue;
  2059. }
  2060. if (!seek_next_seg)
  2061. {
  2062. ccseg = CUR_SEG (fde);
  2063. /* Open .gnu_extab section. */
  2064. get_cfi_seg (ccseg, ".gnu_extab",
  2065. (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2066. | DWARF2_EH_FRAME_READ_ONLY),
  2067. 1);
  2068. seek_next_seg = 1;
  2069. }
  2070. SET_HANDLED (fde, 1);
  2071. frag_align (1, 0, 0);
  2072. record_alignment (now_seg, 1);
  2073. output_compact_unwind_data (fde, 1);
  2074. }
  2075. }
  2076. while (EH_FRAME_LINKONCE && seek_next_seg == 2);
  2077. for (fde = all_fde_data; fde ; fde = fde->next)
  2078. SET_HANDLED (fde, 0);
  2079. /* Create index table fragments. */
  2080. do
  2081. {
  2082. ccseg = NULL;
  2083. seek_next_seg = 0;
  2084. for (fde = all_fde_data; fde ; fde = fde->next)
  2085. {
  2086. if ((fde->sections & CFI_EMIT_eh_frame) == 0
  2087. && (fde->sections & CFI_EMIT_eh_frame_compact) == 0)
  2088. continue;
  2089. if (HANDLED (fde))
  2090. continue;
  2091. if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2092. {
  2093. seek_next_seg = 2;
  2094. continue;
  2095. }
  2096. if (!seek_next_seg)
  2097. {
  2098. ccseg = CUR_SEG (fde);
  2099. /* Open .eh_frame_entry section. */
  2100. cfi_seg = get_cfi_seg (ccseg, ".eh_frame_entry",
  2101. (SEC_ALLOC | SEC_LOAD | SEC_DATA
  2102. | DWARF2_EH_FRAME_READ_ONLY),
  2103. 2);
  2104. seek_next_seg = 1;
  2105. }
  2106. SET_HANDLED (fde, 1);
  2107. output_eh_header (fde);
  2108. }
  2109. }
  2110. while (seek_next_seg == 2);
  2111. for (fde = all_fde_data; fde ; fde = fde->next)
  2112. SET_HANDLED (fde, 0);
  2113. }
  2114. #endif /* SUPPORT_COMPACT_EH */
  2115. flag_traditional_format = save_flag_traditional_format;
  2116. }
  2117. cfi_sections_set = true;
  2118. if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0)
  2119. {
  2120. int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1;
  2121. if (!SUPPORT_FRAME_LINKONCE)
  2122. get_cfi_seg (NULL, ".debug_frame",
  2123. SEC_READONLY | SEC_DEBUGGING,
  2124. alignment);
  2125. do
  2126. {
  2127. ccseg = NULL;
  2128. seek_next_seg = 0;
  2129. for (cie = cie_root; cie; cie = cie_next)
  2130. {
  2131. cie_next = cie->next;
  2132. free ((void *) cie);
  2133. }
  2134. cie_root = NULL;
  2135. for (fde = all_fde_data; fde ; fde = fde->next)
  2136. {
  2137. if ((fde->sections & CFI_EMIT_debug_frame) == 0)
  2138. continue;
  2139. if (SUPPORT_FRAME_LINKONCE)
  2140. {
  2141. if (HANDLED (fde))
  2142. continue;
  2143. if (seek_next_seg && CUR_SEG (fde) != ccseg)
  2144. {
  2145. seek_next_seg = 2;
  2146. continue;
  2147. }
  2148. if (!seek_next_seg)
  2149. {
  2150. ccseg = CUR_SEG (fde);
  2151. /* Open .debug_frame section. */
  2152. get_cfi_seg (ccseg, ".debug_frame",
  2153. SEC_READONLY | SEC_DEBUGGING,
  2154. alignment);
  2155. seek_next_seg = 1;
  2156. }
  2157. SET_HANDLED (fde, 1);
  2158. }
  2159. if (fde->end_address == NULL)
  2160. {
  2161. as_bad (_("open CFI at the end of file; "
  2162. "missing .cfi_endproc directive"));
  2163. fde->end_address = fde->start_address;
  2164. }
  2165. fde->per_encoding = DW_EH_PE_omit;
  2166. fde->lsda_encoding = DW_EH_PE_omit;
  2167. cfi_change_reg_numbers (fde->data, ccseg);
  2168. cie = select_cie_for_fde (fde, false, &first, alignment);
  2169. output_fde (fde, cie, false, first, alignment);
  2170. }
  2171. }
  2172. while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
  2173. if (SUPPORT_FRAME_LINKONCE)
  2174. for (fde = all_fde_data; fde ; fde = fde->next)
  2175. SET_HANDLED (fde, 0);
  2176. }
  2177. }
  2178. #else /* TARGET_USE_CFIPOP */
  2179. /* Emit an intelligible error message for missing support. */
  2180. static void
  2181. dot_cfi_dummy (int ignored ATTRIBUTE_UNUSED)
  2182. {
  2183. as_bad (_("CFI is not supported for this target"));
  2184. ignore_rest_of_line ();
  2185. }
  2186. const pseudo_typeS cfi_pseudo_table[] =
  2187. {
  2188. { "cfi_sections", dot_cfi_dummy, 0 },
  2189. { "cfi_startproc", dot_cfi_dummy, 0 },
  2190. { "cfi_endproc", dot_cfi_dummy, 0 },
  2191. { "cfi_fde_data", dot_cfi_dummy, 0 },
  2192. { "cfi_def_cfa", dot_cfi_dummy, 0 },
  2193. { "cfi_def_cfa_register", dot_cfi_dummy, 0 },
  2194. { "cfi_def_cfa_offset", dot_cfi_dummy, 0 },
  2195. { "cfi_adjust_cfa_offset", dot_cfi_dummy, 0 },
  2196. { "cfi_offset", dot_cfi_dummy, 0 },
  2197. { "cfi_rel_offset", dot_cfi_dummy, 0 },
  2198. { "cfi_register", dot_cfi_dummy, 0 },
  2199. { "cfi_return_column", dot_cfi_dummy, 0 },
  2200. { "cfi_restore", dot_cfi_dummy, 0 },
  2201. { "cfi_undefined", dot_cfi_dummy, 0 },
  2202. { "cfi_same_value", dot_cfi_dummy, 0 },
  2203. { "cfi_remember_state", dot_cfi_dummy, 0 },
  2204. { "cfi_restore_state", dot_cfi_dummy, 0 },
  2205. { "cfi_window_save", dot_cfi_dummy, 0 },
  2206. { "cfi_escape", dot_cfi_dummy, 0 },
  2207. { "cfi_signal_frame", dot_cfi_dummy, 0 },
  2208. { "cfi_personality", dot_cfi_dummy, 0 },
  2209. { "cfi_personality_id", dot_cfi_dummy, 0 },
  2210. { "cfi_lsda", dot_cfi_dummy, 0 },
  2211. { "cfi_val_encoded_addr", dot_cfi_dummy, 0 },
  2212. { "cfi_label", dot_cfi_dummy, 0 },
  2213. { "cfi_inline_lsda", dot_cfi_dummy, 0 },
  2214. { "cfi_val_offset", dot_cfi_dummy, 0 },
  2215. { NULL, NULL, 0 }
  2216. };
  2217. void
  2218. cfi_finish (void)
  2219. {
  2220. }
  2221. #endif /* TARGET_USE_CFIPOP */