Lines Matching refs:buf
168 read_value (bfd *abfd, bfd_byte *buf, int width, int is_signed) in read_value() argument
176 value = bfd_get_signed_16 (abfd, buf); in read_value()
178 value = bfd_get_16 (abfd, buf); in read_value()
182 value = bfd_get_signed_32 (abfd, buf); in read_value()
184 value = bfd_get_32 (abfd, buf); in read_value()
188 value = bfd_get_signed_64 (abfd, buf); in read_value()
190 value = bfd_get_64 (abfd, buf); in read_value()
203 write_value (bfd *abfd, bfd_byte *buf, bfd_vma value, int width) in write_value() argument
207 case 2: bfd_put_16 (abfd, value, buf); break; in write_value()
208 case 4: bfd_put_32 (abfd, value, buf); break; in write_value()
209 case 8: bfd_put_64 (abfd, value, buf); break; in write_value()
413 skip_non_nops (bfd_byte *buf, bfd_byte *end, unsigned int encoded_ptr_width, in skip_non_nops() argument
418 last = buf; in skip_non_nops()
419 while (buf < end) in skip_non_nops()
420 if (*buf == DW_CFA_nop) in skip_non_nops()
421 buf++; in skip_non_nops()
424 if (*buf == DW_CFA_set_loc) in skip_non_nops()
426 if (!skip_cfa_op (&buf, end, encoded_ptr_width)) in skip_non_nops()
428 last = buf; in skip_non_nops()
469 bfd_byte *ehbuf = NULL, *buf, *end; in _bfd_elf_parse_eh_frame() local
523 buf = ehbuf; in _bfd_elf_parse_eh_frame()
527 while (buf != end) in _bfd_elf_parse_eh_frame()
532 REQUIRE (skip_bytes (&buf, end, 4)); in _bfd_elf_parse_eh_frame()
533 hdr_length = bfd_get_32 (abfd, buf - 4); in _bfd_elf_parse_eh_frame()
540 REQUIRE (skip_bytes (&buf, end, 4)); in _bfd_elf_parse_eh_frame()
541 hdr_id = bfd_get_32 (abfd, buf - 4); in _bfd_elf_parse_eh_frame()
545 REQUIRE (skip_bytes (&buf, end, hdr_length - 4)); in _bfd_elf_parse_eh_frame()
558 #define ENSURE_NO_RELOCS(buf) \ in _bfd_elf_parse_eh_frame() argument
561 < (bfd_size_type) ((buf) - ehbuf))) \ in _bfd_elf_parse_eh_frame()
568 #define SKIP_RELOCS(buf) \ in _bfd_elf_parse_eh_frame() argument
571 < (bfd_size_type) ((buf) - ehbuf))) \ in _bfd_elf_parse_eh_frame()
575 #define GET_RELOC(buf) \ in _bfd_elf_parse_eh_frame() argument
578 == (bfd_size_type) ((buf) - ehbuf))) \ in _bfd_elf_parse_eh_frame()
581 buf = ehbuf; in _bfd_elf_parse_eh_frame()
584 while ((bfd_size_type) (buf - ehbuf) != sec->size) in _bfd_elf_parse_eh_frame()
592 last_fde = buf; in _bfd_elf_parse_eh_frame()
595 REQUIRE (skip_bytes (&buf, ehbuf + sec->size, 4)); in _bfd_elf_parse_eh_frame()
596 hdr_length = bfd_get_32 (abfd, buf - 4); in _bfd_elf_parse_eh_frame()
599 REQUIRE ((bfd_size_type) (buf - ehbuf) + hdr_length <= sec->size); in _bfd_elf_parse_eh_frame()
600 end = buf + hdr_length; in _bfd_elf_parse_eh_frame()
610 REQUIRE ((bfd_size_type) (buf - ehbuf) == sec->size); in _bfd_elf_parse_eh_frame()
611 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
616 REQUIRE (skip_bytes (&buf, end, 4)); in _bfd_elf_parse_eh_frame()
617 hdr_id = bfd_get_32 (abfd, buf - 4); in _bfd_elf_parse_eh_frame()
631 start = buf; in _bfd_elf_parse_eh_frame()
632 REQUIRE (read_byte (&buf, end, &cie->version)); in _bfd_elf_parse_eh_frame()
638 REQUIRE (strlen ((char *) buf) < sizeof (cie->augmentation)); in _bfd_elf_parse_eh_frame()
640 strcpy (cie->augmentation, (char *) buf); in _bfd_elf_parse_eh_frame()
641 buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1; in _bfd_elf_parse_eh_frame()
642 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
643 if (buf[0] == 'e' && buf[1] == 'h') in _bfd_elf_parse_eh_frame()
649 REQUIRE (skip_bytes (&buf, end, ptr_size)); in _bfd_elf_parse_eh_frame()
650 SKIP_RELOCS (buf); in _bfd_elf_parse_eh_frame()
654 REQUIRE (buf + 1 < end); in _bfd_elf_parse_eh_frame()
655 REQUIRE (buf[0] == ptr_size); in _bfd_elf_parse_eh_frame()
656 REQUIRE (buf[1] == 0); in _bfd_elf_parse_eh_frame()
657 buf += 2; in _bfd_elf_parse_eh_frame()
659 REQUIRE (read_uleb128 (&buf, end, &cie->code_align)); in _bfd_elf_parse_eh_frame()
660 REQUIRE (read_sleb128 (&buf, end, &cie->data_align)); in _bfd_elf_parse_eh_frame()
663 REQUIRE (buf < end); in _bfd_elf_parse_eh_frame()
664 cie->ra_column = *buf++; in _bfd_elf_parse_eh_frame()
667 REQUIRE (read_uleb128 (&buf, end, &cie->ra_column)); in _bfd_elf_parse_eh_frame()
668 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
678 REQUIRE (read_uleb128 (&buf, end, &cie->augmentation_size)); in _bfd_elf_parse_eh_frame()
679 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
686 REQUIRE (read_byte (&buf, end, &cie->lsda_encoding)); in _bfd_elf_parse_eh_frame()
687 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
691 REQUIRE (read_byte (&buf, end, &cie->fde_encoding)); in _bfd_elf_parse_eh_frame()
692 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
701 REQUIRE (read_byte (&buf, end, &cie->per_encoding)); in _bfd_elf_parse_eh_frame()
707 length = -(buf - ehbuf) & (per_width - 1); in _bfd_elf_parse_eh_frame()
708 REQUIRE (skip_bytes (&buf, end, length)); in _bfd_elf_parse_eh_frame()
710 this_inf->u.cie.personality_offset = buf - start; in _bfd_elf_parse_eh_frame()
711 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
713 REQUIRE (GET_RELOC (buf)); in _bfd_elf_parse_eh_frame()
719 while (GET_RELOC (buf) != NULL); in _bfd_elf_parse_eh_frame()
720 REQUIRE (skip_bytes (&buf, end, per_width)); in _bfd_elf_parse_eh_frame()
760 initial_insn_length = end - buf; in _bfd_elf_parse_eh_frame()
762 memcpy (cie->initial_instructions, buf, in _bfd_elf_parse_eh_frame()
765 insns = buf; in _bfd_elf_parse_eh_frame()
766 buf += initial_insn_length; in _bfd_elf_parse_eh_frame()
767 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
793 ENSURE_NO_RELOCS (buf); in _bfd_elf_parse_eh_frame()
798 REQUIRE (GET_RELOC (buf)); in _bfd_elf_parse_eh_frame()
813 start = buf; in _bfd_elf_parse_eh_frame()
815 REQUIRE (skip_bytes (&buf, end, 2 * length)); in _bfd_elf_parse_eh_frame()
817 SKIP_RELOCS (buf - length); in _bfd_elf_parse_eh_frame()
818 if (!GET_RELOC (buf - length) in _bfd_elf_parse_eh_frame()
819 && read_value (abfd, buf - length, length, FALSE) == 0) in _bfd_elf_parse_eh_frame()
829 REQUIRE (read_uleb128 (&buf, end, &length)); in _bfd_elf_parse_eh_frame()
838 SKIP_RELOCS (buf); in _bfd_elf_parse_eh_frame()
839 if (cie->can_make_lsda_relative && GET_RELOC (buf)) in _bfd_elf_parse_eh_frame()
841 this_inf->lsda_offset = buf - start; in _bfd_elf_parse_eh_frame()
845 length = end - buf; in _bfd_elf_parse_eh_frame()
849 REQUIRE (skip_bytes (&buf, end, length)); in _bfd_elf_parse_eh_frame()
850 insns = buf; in _bfd_elf_parse_eh_frame()
852 buf = last_fde + 4 + hdr_length; in _bfd_elf_parse_eh_frame()
863 SKIP_RELOCS (buf); in _bfd_elf_parse_eh_frame()
1437 unsigned char *buf, *end; in _bfd_elf_write_section_eh_frame() local
1450 buf = contents + ent->new_offset; in _bfd_elf_write_section_eh_frame()
1451 end = buf + ent->size; in _bfd_elf_write_section_eh_frame()
1455 bfd_put_32 (abfd, new_size - 4, buf); in _bfd_elf_write_section_eh_frame()
1481 buf += 9; in _bfd_elf_write_section_eh_frame()
1482 aug = (char *) buf; in _bfd_elf_write_section_eh_frame()
1483 buf += strlen (aug) + 1; in _bfd_elf_write_section_eh_frame()
1484 skip_leb128 (&buf, end); in _bfd_elf_write_section_eh_frame()
1485 skip_leb128 (&buf, end); in _bfd_elf_write_section_eh_frame()
1486 skip_leb128 (&buf, end); in _bfd_elf_write_section_eh_frame()
1491 *buf++ += extra_data; in _bfd_elf_write_section_eh_frame()
1496 memmove (buf + extra_string + extra_data, buf, end - buf); in _bfd_elf_write_section_eh_frame()
1497 memmove (aug + extra_string, aug, buf - (bfd_byte *) aug); in _bfd_elf_write_section_eh_frame()
1498 buf += extra_string; in _bfd_elf_write_section_eh_frame()
1504 *buf++ = extra_data - 1; in _bfd_elf_write_section_eh_frame()
1510 *buf++ = make_pc_relative (DW_EH_PE_absptr, ptr_size); in _bfd_elf_write_section_eh_frame()
1520 BFD_ASSERT (*buf == ent->lsda_encoding); in _bfd_elf_write_section_eh_frame()
1521 *buf = make_pc_relative (*buf, ptr_size); in _bfd_elf_write_section_eh_frame()
1524 buf++; in _bfd_elf_write_section_eh_frame()
1528 *buf = make_pc_relative (*buf, ptr_size); in _bfd_elf_write_section_eh_frame()
1529 per_encoding = *buf++; in _bfd_elf_write_section_eh_frame()
1535 buf = (contents in _bfd_elf_write_section_eh_frame()
1536 + ((buf - contents + per_width - 1) in _bfd_elf_write_section_eh_frame()
1542 val = read_value (abfd, buf, per_width, in _bfd_elf_write_section_eh_frame()
1547 + (buf - contents)); in _bfd_elf_write_section_eh_frame()
1553 write_value (abfd, buf, val, per_width); in _bfd_elf_write_section_eh_frame()
1556 buf += per_width; in _bfd_elf_write_section_eh_frame()
1561 BFD_ASSERT (*buf == ent->fde_encoding); in _bfd_elf_write_section_eh_frame()
1562 *buf = make_pc_relative (*buf, ptr_size); in _bfd_elf_write_section_eh_frame()
1565 buf++; in _bfd_elf_write_section_eh_frame()
1584 buf += 4; in _bfd_elf_write_section_eh_frame()
1587 bfd_put_32 (abfd, value, buf); in _bfd_elf_write_section_eh_frame()
1590 buf += 4; in _bfd_elf_write_section_eh_frame()
1592 value = read_value (abfd, buf, width, in _bfd_elf_write_section_eh_frame()
1642 write_value (abfd, buf, value, width); in _bfd_elf_write_section_eh_frame()
1645 start = buf; in _bfd_elf_write_section_eh_frame()
1656 = read_value (abfd, buf + width, width, FALSE); in _bfd_elf_write_section_eh_frame()
1666 buf += ent->lsda_offset; in _bfd_elf_write_section_eh_frame()
1668 value = read_value (abfd, buf, width, in _bfd_elf_write_section_eh_frame()
1678 write_value (abfd, buf, value, width); in _bfd_elf_write_section_eh_frame()
1685 buf += width * 2; in _bfd_elf_write_section_eh_frame()
1686 memmove (buf + 1, buf, end - buf); in _bfd_elf_write_section_eh_frame()
1687 *buf = 0; in _bfd_elf_write_section_eh_frame()
1703 buf = start + ent->set_loc[cnt]; in _bfd_elf_write_section_eh_frame()
1705 value = read_value (abfd, buf, width, in _bfd_elf_write_section_eh_frame()
1716 write_value (abfd, buf, value, width); in _bfd_elf_write_section_eh_frame()