macho debug changes This patch is aimed at fixing "FAIL: eqv involving dot" and any similar problems in real code when generating DWARF. * config/obj-macho.c (obj_mach_o_frob_label), (obj_mach_o_frob_symbol): Ignore more debug symbols. (obj_mach_o_set_subsections): Ignore SEC_DEBUGGING sections. (obj_mach_o_force_reloc_sub_same), (obj_mach_o_force_reloc_sub_local), (obj_mach_o_force_reloc): Add seg param. Return false when processing debug sections. * config/obj-macho.h: Update prototypes. * config/tc-i386.h <OBJ_MACHO>: Smuggle section being processed by TC_FORCE_RELOCATION* to obj_macho_o functions.
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index bf6f275..d0d4763 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c
@@ -1383,7 +1383,8 @@ s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (sp); /* Leave debug symbols alone. */ - if ((s->n_type & BFD_MACH_O_N_STAB) != 0) + if ((s->n_type & BFD_MACH_O_N_STAB) != 0 + || (s->symbol.section->flags & SEC_DEBUGGING) != 0) return; /* This is the base symbol type, that we mask in. */ @@ -1433,7 +1434,8 @@ s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (sp); /* Leave debug symbols alone. */ - if ((s->n_type & BFD_MACH_O_N_STAB) != 0) + if ((s->n_type & BFD_MACH_O_N_STAB) != 0 + || (s->symbol.section->flags & SEC_DEBUGGING) != 0) return 0; base_type = obj_mach_o_type_for_symbol (s); @@ -1570,6 +1572,10 @@ fragS *frag; frchainS *chain; + /* Don't waste time on debug sections. */ + if ((sec->flags & SEC_DEBUGGING) != 0) + return; + /* Protect against sections not created by gas. */ if (seginfo == NULL) return; @@ -1893,17 +1899,22 @@ } bool -obj_mach_o_force_reloc_sub_same (fixS *fix, segT seg) +obj_mach_o_force_reloc_sub_same (segT seg, fixS *fix, segT addsymseg) { - if (! SEG_NORMAL (seg)) + if (!SEG_NORMAL (addsymseg)) return true; - return obj_mach_o_in_different_subsection (fix->fx_addsy, seg, + if ((seg->flags & SEC_DEBUGGING) != 0) + return false; + return obj_mach_o_in_different_subsection (fix->fx_addsy, addsymseg, fix->fx_offset, fix->fx_subsy); } bool -obj_mach_o_force_reloc_sub_local (fixS *fix, segT seg ATTRIBUTE_UNUSED) +obj_mach_o_force_reloc_sub_local (segT seg, fixS *fix, + segT addsymseg ATTRIBUTE_UNUSED) { + if ((seg->flags & SEC_DEBUGGING) != 0) + return false; symbolS *fragsym = fix->fx_frag->obj_frag_data.subsection; if (fragsym == NULL) return false; @@ -1911,11 +1922,14 @@ } bool -obj_mach_o_force_reloc (fixS *fix) +obj_mach_o_force_reloc (segT seg, fixS *fix) { if (generic_force_reloc (fix)) return true; + if ((seg->flags & SEC_DEBUGGING) != 0) + return false; + /* Force a reloc if the target is not in the same subsection. FIXME: handle (a - b) where a and b belongs to the same subsection ? */ if (fix->fx_addsy != NULL)
diff --git a/gas/config/obj-macho.h b/gas/config/obj-macho.h index eac0afd..0a499f2 100644 --- a/gas/config/obj-macho.h +++ b/gas/config/obj-macho.h
@@ -108,8 +108,8 @@ segT); struct fix; -extern bool obj_mach_o_force_reloc (struct fix *); -extern bool obj_mach_o_force_reloc_sub_same (struct fix *, segT); -extern bool obj_mach_o_force_reloc_sub_local (struct fix *, segT); +extern bool obj_mach_o_force_reloc (segT, struct fix *); +extern bool obj_mach_o_force_reloc_sub_same (segT, struct fix *, segT); +extern bool obj_mach_o_force_reloc_sub_local (segT, struct fix *, segT); #endif /* _OBJ_MACH_O_H */
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 20e5334..5eaed70 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h
@@ -498,13 +498,13 @@ #ifdef OBJ_MACH_O -#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (FIX)) +#define TC_FORCE_RELOCATION(FIX) (obj_mach_o_force_reloc (this_segment, FIX)) #define TC_FORCE_RELOCATION_SUB_SAME(FIX,SEG) \ - (obj_mach_o_force_reloc_sub_same (FIX, SEG)) + (obj_mach_o_force_reloc_sub_same (this_segment, FIX, SEG)) #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX,SEG) \ - (obj_mach_o_force_reloc_sub_local (FIX, SEG)) + (obj_mach_o_force_reloc_sub_local (this_segment, FIX, SEG)) #endif /* OBJ_MACH_O */