case PT_NOTE: pt = "NOTE"; break;
case PT_SHLIB: pt = "SHLIB"; break;
case PT_PHDR: pt = "PHDR"; break;
+ case PT_GNU_EH_FRAME: pt = "EH_FRAME"; break;
default: sprintf (buf, "0x%lx", p->p_type); pt = buf; break;
}
fprintf (f, "%8s off 0x", pt);
asection **hdrpp;
boolean phdr_in_segment = true;
boolean writable;
- asection *dynsec;
+ asection *dynsec, *eh_frame_hdr;
bfd_size_type amt;
if (elf_tdata (abfd)->segment_map != NULL)
}
}
+ /* If there is a .eh_frame_hdr section, throw in a PT_GNU_EH_FRAME
+ segment. */
+ eh_frame_hdr = bfd_get_section_by_name (abfd, ".eh_frame_hdr");
+ if (eh_frame_hdr != NULL && (eh_frame_hdr->flags & SEC_LOAD))
+ {
+ amt = sizeof (struct elf_segment_map);
+ m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
+ if (m == NULL)
+ goto error_return;
+ m->next = NULL;
+ m->p_type = PT_GNU_EH_FRAME;
+ m->count = 1;
+ m->sections[0] = eh_frame_hdr;
+
+ *pm = m;
+ pm = &m->next;
+ }
+
free (sections);
sections = NULL;
{
if (i == 0)
{
- (* _bfd_error_handler)
- (_("Error: First section in segment (%s) starts at 0x%x"),
- bfd_section_name (abfd, sec), sec->lma);
- (* _bfd_error_handler)
- (_(" whereas segment starts at 0x%x"),
- p->p_paddr);
-
+ (* _bfd_error_handler) (_("\
+Error: First section in segment (%s) starts at 0x%x whereas the segment starts at 0x%x"),
+ bfd_section_name (abfd, sec),
+ sec->lma,
+ p->p_paddr);
return false;
}
p->p_memsz += adjust;
++segs;
}
+ if (elf_tdata (abfd)->eh_frame_hdr
+ && bfd_get_section_by_name (abfd, ".eh_frame_hdr") != NULL)
+ {
+ /* We need a PT_GNU_EH_FRAME segment. */
+ ++segs;
+ }
+
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
offset = offsetof (prstatus_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+ /* Do not overwrite the core signal if it
+ has already been set by another thread. */
+ if (elf_tdata (abfd)->core_signal == 0)
+ elf_tdata (abfd)->core_signal = prstat.pr_cursig;
elf_tdata (abfd)->core_pid = prstat.pr_pid;
/* pr_who exists on:
offset = offsetof (prstatus32_t, pr_reg);
memcpy (&prstat, note->descdata, sizeof (prstat));
- elf_tdata (abfd)->core_signal = prstat.pr_cursig;
+ /* Do not overwrite the core signal if it
+ has already been set by another thread. */
+ if (elf_tdata (abfd)->core_signal == 0)
+ elf_tdata (abfd)->core_signal = prstat.pr_cursig;
elf_tdata (abfd)->core_pid = prstat.pr_pid;
/* pr_who exists on:
+ sec->output_offset
+ sym->st_value);
if ((sec->flags & SEC_MERGE)
- && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+ && ELF_ST_TYPE (sym->st_info) == STT_SECTION
+ && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
{
asection *msec;
msec = sec;
rel->r_addend =
_bfd_merged_section_offset (abfd, &msec,
- elf_section_data (sec)->merge_info,
+ elf_section_data (sec)->sec_info,
sym->st_value + rel->r_addend,
(bfd_vma) 0)
- relocation;
}
return relocation;
}
+
+bfd_vma
+_bfd_elf_rel_local_sym (abfd, sym, psec, addend)
+ bfd *abfd;
+ Elf_Internal_Sym *sym;
+ asection **psec;
+ bfd_vma addend;
+{
+ asection *sec = *psec;
+
+ if (elf_section_data (sec)->sec_info_type != ELF_INFO_TYPE_MERGE)
+ return sym->st_value + addend;
+
+ return _bfd_merged_section_offset (abfd, psec,
+ elf_section_data (sec)->sec_info,
+ sym->st_value + addend, (bfd_vma) 0);
+}
+
+bfd_vma
+_bfd_elf_section_offset (abfd, info, sec, offset)
+ bfd *abfd;
+ struct bfd_link_info *info;
+ asection *sec;
+ bfd_vma offset;
+{
+ struct bfd_elf_section_data *sec_data;
+
+ sec_data = elf_section_data (sec);
+ switch (sec_data->sec_info_type)
+ {
+ case ELF_INFO_TYPE_STABS:
+ return _bfd_stab_section_offset
+ (abfd, &elf_hash_table (info)->merge_info, sec, &sec_data->sec_info,
+ offset);
+ case ELF_INFO_TYPE_EH_FRAME:
+ return _bfd_elf_eh_frame_section_offset (abfd, sec, offset);
+ default:
+ return offset;
+ }
+}