}
else
{
+ asection *isec = symbol->section;
+
native->u.syment.n_scnum = output_section->target_index;
- native->u.syment.n_value = (symbol->value
- + symbol->section->output_offset);
+ native->u.syment.n_value = symbol->value;
+
+ if (isec->sec_info_type == SEC_INFO_TYPE_MERGE
+ && !(symbol->flags & (BSF_SECTION_SYM | BSF_MERGE_RESOLVED)))
+ native->u.syment.n_value =
+ _bfd_merged_section_offset (abfd, &isec, symbol->value);
+
+ native->u.syment.n_value += isec->output_offset;
if (! obj_pe (abfd))
native->u.syment.n_value += output_section->vma;
{
asection *sec;
- sec = h->root.u.def.section->output_section;
+ sec = h->root.u.def.section;
+ isym.n_value = h->root.u.def.value;
+ if (sec->sec_info_type == SEC_INFO_TYPE_MERGE)
+ isym.n_value =
+ _bfd_merged_section_offset (output_bfd, &sec, isym.n_value);
+ isym.n_value += sec->output_offset;
+
+ sec = sec->output_section;
if (bfd_is_abs_section (sec))
isym.n_scnum = N_ABS;
else
isym.n_scnum = sec->target_index;
- isym.n_value = (h->root.u.def.value
- + h->root.u.def.section->output_offset);
if (! obj_pe (flaginfo->output_bfd))
isym.n_value += sec->vma;
#ifdef BFD64
struct sec_merge_sec_info *secinfo = sec->sec_info;
file_ptr pos;
unsigned char *contents;
- Elf_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr = NULL;
if (!secinfo)
return false;
return true;
/* FIXME: octets_per_byte. */
- hdr = &elf_section_data (sec->output_section)->this_hdr;
- if (hdr->sh_offset == (file_ptr) -1)
+ if (bfd_get_flavour (output_bfd) == bfd_target_elf_flavour)
+ hdr = &elf_section_data (sec->output_section)->this_hdr;
+ if (hdr != NULL && hdr->sh_offset == (file_ptr) -1)
{
/* We must compress this section. Write output to the
buffer. */
#define coff_mkobject_hook pe_mkobject_hook
#ifdef COFF_IMAGE_WITH_PE
+
+/* For the case of linking ELF objects into a PE binary. */
+#undef TARGET_MERGE_SECTIONS
+#define TARGET_MERGE_SECTIONS true
+
/* This structure contains static variables used by the ILF code. */
typedef asection * asection_ptr;