+ /* For relocatable objects we must add an offset telling
+ where the section is actually mapped in the memory. */
+ init_loc += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
+
+ /* If we have both .debug_frame and .eh_frame present in
+ a file, we must eliminate duplicate FDEs. For now we'll
+ run through all entries in fde_chunks and check it one
+ by one. Perhaps in the future we can implement a faster
+ searching algorithm. */
+ /* eh_frame==2 indicates, that this file has an already
+ parsed .debug_frame too. When eh_frame==1 it means, that no
+ .debug_frame is present and thus we don't need to check for
+ duplicities. eh_frame==0 means, that we parse .debug_frame
+ and don't need to care about duplicate FDEs, because
+ .debug_frame is parsed first. */
+ if (eh_frame == 2)
+ for (i = 0; eh_frame == 2 && i < fde_chunks.elems; i++)
+ {
+ /* We assume that FDEs in .debug_frame and .eh_frame
+ have the same order (if they are present, of course).
+ If we find a duplicate entry for one FDE and save
+ it's index to last_dup_fde it's very likely, that
+ we'll find an entry for the following FDE right after
+ the previous one. Thus in many cases we'll run this
+ loop only once. */
+ last_dup_fde = (last_dup_fde + i) % fde_chunks.elems;
+ if (fde_chunks.array[last_dup_fde]->initial_location
+ == init_loc)
+ {
+ dup = 1;
+ break;
+ }
+ }
+
+ /* Allocate a new entry only if this FDE isn't a duplicate of
+ something we have already seen. */
+ if (!dup)
+ {
+ fde_chunks_need_space ();
+ fde = fde_unit_alloc ();