diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index a13e81ebb861129a50ac92390ffb2980111f06c1..15745550772da5241e7270f6552eb4cf3b82edef 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -1993,7 +1993,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, || ent->u.cie.per_encoding_relative) { char *aug; - unsigned int action, extra_string, extra_data; + unsigned int version, action, extra_string, extra_data; unsigned int per_width, per_encoding; /* Need to find 'R' or 'L' augmentation's argument and modify @@ -2005,12 +2005,16 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, extra_data = extra_augmentation_data_bytes (ent); /* Skip length, id and version. */ - buf += 9; + buf += 8; + version = (unsigned int)(*(char*) buf++); aug = (char *) buf; buf += strlen (aug) + 1; skip_leb128 (&buf, end); skip_leb128 (&buf, end); - skip_leb128 (&buf, end); + if (version == 1) + skip_bytes (&buf, end, 1); + else + skip_leb128 (&buf, end); if (*aug == 'z') { /* The uleb128 will always be a single byte for the kind