You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
it (it would need to use 64-bit .eh_frame format anyway). */
REQUIRE (sec->size == (unsigned int) sec->size);
- ptr_size = (elf_elfheader (abfd)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
+ ptr_size = (get_elf_backend_data (abfd)
+ ->elf_backend_eh_frame_address_size (abfd, sec));
+ REQUIRE (ptr_size != 0);
+
buf = ehbuf;
last_cie = NULL;
last_cie_inf = NULL;
for (;;)
{
- unsigned char *aug;
+ char *aug;
bfd_byte *start, *end, *insns;
bfd_size_type length;
on whether to output or discard last encountered CIE (if any). */
if ((bfd_size_type) (buf - ehbuf) == sec->size)
{
+ hdr.length = 0;
hdr.id = (unsigned int) -1;
end = buf;
}
/* Cannot handle unknown versions. */
REQUIRE (cie.version == 1 || cie.version == 3);
- REQUIRE (strlen (buf) < sizeof (cie.augmentation));
+ REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation));
- strcpy (cie.augmentation, buf);
- buf = strchr (buf, '\0') + 1;
+ strcpy (cie.augmentation, (char *) buf);
+ buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1;
ENSURE_NO_RELOCS (buf);
if (buf[0] == 'e' && buf[1] == 'h')
{
/* This function is called from size_dynamic_sections.
It needs to decide whether .eh_frame_hdr should be output or not,
- because later on it is too late for calling _bfd_strip_section_from_output,
- since dynamic symbol table has been sized. */
+ because when the dynamic symbol table has been sized it is too late
+ to strip sections. */
bfd_boolean
_bfd_elf_maybe_strip_eh_frame_hdr (struct bfd_link_info *info)
if (abfd == NULL)
{
- _bfd_strip_section_from_output (info, hdr_info->hdr_sec);
+ hdr_info->hdr_sec->flags |= SEC_EXCLUDE;
hdr_info->hdr_sec = NULL;
return TRUE;
}
unsigned int ptr_size;
struct eh_cie_fde *ent;
- ptr_size = (elf_elfheader (sec->owner)->e_ident[EI_CLASS]
- == ELFCLASS64) ? 8 : 4;
-
if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
return bfd_set_section_contents (abfd, sec->output_section, contents,
sec->output_offset, sec->size);
+
+ ptr_size = (get_elf_backend_data (abfd)
+ ->elf_backend_eh_frame_address_size (abfd, sec));
+ BFD_ASSERT (ptr_size != 0);
+
sec_info = elf_section_data (sec)->sec_info;
htab = elf_hash_table (info);
hdr_info = &htab->eh_info;
|| ent->need_lsda_relative
|| ent->per_encoding_relative)
{
- unsigned char *aug;
+ char *aug;
unsigned int action, extra_string, extra_data;
unsigned int per_width, per_encoding;
/* Skip length, id and version. */
buf += 9;
- aug = buf;
- buf = strchr (buf, '\0') + 1;
+ aug = (char *) buf;
+ buf += strlen (aug) + 1;
skip_leb128 (&buf, end);
skip_leb128 (&buf, end);
skip_leb128 (&buf, end);
/* Make room for the new augmentation string and data bytes. */
memmove (buf + extra_string + extra_data, buf, end - buf);
- memmove (aug + extra_string, aug, buf - aug);
+ memmove (aug + extra_string, aug, buf - (bfd_byte *) aug);
buf += extra_string;
end += extra_string + extra_data;
return retval;
}
+/* Return the width of FDE addresses. This is the default implementation. */
+
+unsigned int
+_bfd_elf_eh_frame_address_size (bfd *abfd, asection *sec ATTRIBUTE_UNUSED)
+{
+ return elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64 ? 8 : 4;
+}
+
/* Decide whether we can use a PC-relative encoding within the given
EH frame section. This is the default implementation. */