+ /* Add end of list marker. */
+ xdata_arr[xdata_arr_cnt++] = ~((bfd_vma) 0);
+
+ /* Sort start RVAs of xdata. */
+ if (xdata_arr_cnt > 1)
+ qsort (xdata_arr, (size_t) xdata_arr_cnt, sizeof (bfd_vma),
+ sort_xdata_arr);
+
+ /* Find the section containing the unwind data (.xdata). */
+ xdata_base = xdata_arr[0];
+ /* For sections with long names, first look for the same
+ section name, replacing .pdata by .xdata prefix. */
+ if (strcmp (pdata_section->name, ".pdata") != 0)
+ {
+ size_t len = strlen (pdata_section->name);
+ char *xdata_name = xmalloc (len + 1);
+
+ xdata_name = memcpy (xdata_name, pdata_section->name, len + 1);
+ /* Transform .pdata prefix into .xdata prefix. */
+ if (len > 1)
+ xdata_name [1] = 'x';
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base,
+ xdata_name);
+ free (xdata_name);
+ }
+ /* Second, try the .xdata section itself. */
+ if (!xdata_section)
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".xdata");
+ /* Otherwise, if xdata_base is non zero, search also inside
+ other standard sections. */
+ if (!xdata_section && xdata_base)
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".rdata");
+ if (!xdata_section && xdata_base)
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".data");
+ if (!xdata_section && xdata_base)
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".pdata");
+ if (!xdata_section && xdata_base)
+ xdata_section = pex64_get_section_by_rva (abfd, xdata_base, ".text");
+ /* Transfer xdata section into xdata array. */
+ if (!xdata_section
+ || !bfd_malloc_and_get_section (abfd, xdata_section, &xdata))
+ goto done;
+
+ /* Avoid "also used "... ouput for single unwind info
+ in object file. */
+ prev_unwinddata_rva = (bfd_vma) -1;
+
+ /* Do dump of pdata related xdata. */
+ for (i = 0; i < stop; i += onaline)