View | Details | Raw Unified | Return to bug 14052 | Differences between
and this patch

Collapse All | Expand All

(-)a/bfd/linker.c (-7 / +23 lines)
Lines 3132-3141 _bfd_generic_section_already_linked (bfd *abfd ATTRIBUTE_UNUSED, Link Here
3132
}
3132
}
3133
3133
3134
/* Choose a neighbouring section to S in OBFD that will be output, or
3134
/* Choose a neighbouring section to S in OBFD that will be output, or
3135
   the absolute section if ADDR is out of bounds of the neighbours.  */
3135
   the absolute section if USE_ABS_SECTION is TRUE and ADDR is out of
3136
   bounds of the neighbours.  */
3136
3137
3137
asection *
3138
static asection *
3138
_bfd_nearby_section (bfd *obfd, asection *s, bfd_vma addr)
3139
bfd_nearby_section (bfd *obfd, asection *s, bfd_vma addr,
3140
		    bfd_boolean use_abs_section)
3139
{
3141
{
3140
  asection *next, *prev, *best;
3142
  asection *next, *prev, *best;
3141
3143
Lines 3198-3211 _bfd_nearby_section (bfd *obfd, asection *s, bfd_vma addr) Link Here
3198
	best = prev;
3200
	best = prev;
3199
    }
3201
    }
3200
3202
3201
  /* Refuse to choose a section for which we are out of bounds.  */
3203
  /* Refuse to choose a section for which we are out of bounds if
3202
  /* ??? This may make most of the above moot.  */
3204
     asked.  */
3203
  if (addr < best->vma || addr > best->vma + best->size)
3205
  if (use_abs_section
3206
      && (addr < best->vma || addr > best->vma + best->size))
3204
    best = bfd_abs_section_ptr;
3207
    best = bfd_abs_section_ptr;
3205
3208
3206
  return best;
3209
  return best;
3207
}
3210
}
3208
3211
3212
/* Choose a neighbouring section to S in OBFD that will be output, or
3213
   the absolute section if ADDR is out of bounds of the neighbours.  */
3214
3215
asection *
3216
_bfd_nearby_section (bfd *obfd, asection *s, bfd_vma addr)
3217
{
3218
  return bfd_nearby_section (obfd, s, addr, TRUE);
3219
}
3220
3209
/* Convert symbols in excluded output sections to use a kept section.  */
3221
/* Convert symbols in excluded output sections to use a kept section.  */
3210
3222
3211
static bfd_boolean
3223
static bfd_boolean
Lines 3225-3231 fix_syms (struct bfd_link_hash_entry *h, void *data) Link Here
3225
	  asection *op;
3237
	  asection *op;
3226
3238
3227
	  h->u.def.value += s->output_offset + s->output_section->vma;
3239
	  h->u.def.value += s->output_offset + s->output_section->vma;
3228
	  op = _bfd_nearby_section (obfd, s->output_section, h->u.def.value);
3240
	  /* Don't use the absolute section if symbol is defined in
3241
	     output.  See PR ld/14052.  */
3242
	  op = bfd_nearby_section (obfd, s->output_section,
3243
				   h->u.def.value,
3244
				   h->u.def.section->owner != obfd);
3229
	  h->u.def.value -= op->vma;
3245
	  h->u.def.value -= op->vma;
3230
	  h->u.def.section = op;
3246
	  h->u.def.section = op;
3231
	}
3247
	}

Return to bug 14052