Lines Matching refs:sec

343 #define mmo_section_data(sec) \  argument
344 ((struct mmo_section_data_struct *) (sec)->used_by_bfd)
359 asection *sec; member
450 asection *sec = bfd_get_section_by_name (abfd, secname); in mmo_make_section() local
452 if (sec == NULL) in mmo_make_section()
464 sec = bfd_make_section (abfd, newsecname); in mmo_make_section()
467 return sec; in mmo_make_section()
607 mmo_find_sec_w_addr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p) in mmo_find_sec_w_addr() argument
610 bfd_vma vma = bfd_get_section_vma (abfd, sec); in mmo_find_sec_w_addr()
613 if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) in mmo_find_sec_w_addr()
617 if (infop->addr >= vma && infop->addr < vma + sec->size) in mmo_find_sec_w_addr()
618 infop->sec = sec; in mmo_find_sec_w_addr()
622 mmo_find_sec_w_addr_grow (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p) in mmo_find_sec_w_addr_grow() argument
625 bfd_vma vma = bfd_get_section_vma (abfd, sec); in mmo_find_sec_w_addr_grow()
628 if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) in mmo_find_sec_w_addr_grow()
633 infop->sec = sec; in mmo_find_sec_w_addr_grow()
644 asection *sec = NULL; in mmo_decide_section() local
649 info.sec = NULL; in mmo_decide_section()
654 if (info.sec != NULL) in mmo_decide_section()
655 return info.sec; in mmo_decide_section()
663 sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME); in mmo_decide_section()
665 if (sec == NULL) in mmo_decide_section()
668 if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) in mmo_decide_section()
671 if (! bfd_set_section_flags (abfd, sec, in mmo_decide_section()
672 bfd_get_section_flags (abfd, sec) in mmo_decide_section()
678 sec = bfd_make_section_old_way (abfd, MMO_DATA_SECTION_NAME); in mmo_decide_section()
680 if (sec == NULL) in mmo_decide_section()
683 if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) in mmo_decide_section()
686 if (! bfd_set_section_flags (abfd, sec, in mmo_decide_section()
687 bfd_get_section_flags (abfd, sec) in mmo_decide_section()
694 if (info.sec != NULL) in mmo_decide_section()
695 return info.sec; in mmo_decide_section()
699 sec = mmo_make_section (abfd, sec_name); in mmo_decide_section()
701 if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) in mmo_decide_section()
704 if (! bfd_set_section_flags (abfd, sec, in mmo_decide_section()
705 bfd_get_section_flags (abfd, sec) in mmo_decide_section()
708 return sec; in mmo_decide_section()
714 mmo_xore_64 (asection *sec, bfd_vma vma, bfd_vma value) in mmo_xore_64() argument
716 bfd_byte *loc = mmo_get_loc (sec, vma, 8); in mmo_xore_64()
717 bfd_vma prev = bfd_get_64 (sec->owner, loc); in mmo_xore_64()
720 bfd_put_64 (sec->owner, value, loc); in mmo_xore_64()
726 mmo_xore_32 (asection *sec, bfd_vma vma, unsigned int value) in mmo_xore_32() argument
728 bfd_byte *loc = mmo_get_loc (sec, vma, 4); in mmo_xore_32()
729 unsigned int prev = bfd_get_32 (sec->owner, loc); in mmo_xore_32()
732 bfd_put_32 (sec->owner, value, loc); in mmo_xore_32()
738 mmo_xore_16 (asection *sec, bfd_vma vma, unsigned int value) in mmo_xore_16() argument
740 bfd_byte *loc = mmo_get_loc (sec, vma, 2); in mmo_xore_16()
741 unsigned int prev = bfd_get_16 (sec->owner, loc); in mmo_xore_16()
744 bfd_put_16 (sec->owner, value, loc); in mmo_xore_16()
959 asection *sec; in mmo_get_generic_spec_data_section() local
966 sec = mmo_make_section (abfd, secname); in mmo_get_generic_spec_data_section()
968 return sec; in mmo_get_generic_spec_data_section()
978 asection *sec; in mmo_get_spec_section() local
1084 sec = mmo_make_section (abfd, secname); in mmo_get_spec_section()
1086 if (sec == NULL) in mmo_get_spec_section()
1102 if (! bfd_set_section_flags (abfd, sec, in mmo_get_spec_section()
1104 | bfd_get_section_flags (abfd, sec) in mmo_get_spec_section()
1106 || ! bfd_set_section_size (abfd, sec, sec->size + section_length) in mmo_get_spec_section()
1108 || (! sec->user_set_vma in mmo_get_spec_section()
1109 && ! bfd_set_section_vma (abfd, sec, section_vma))) in mmo_get_spec_section()
1117 if (mmo_section_data (sec)->tail != NULL) in mmo_get_spec_section()
1118 mmo_section_data (sec)->tail->next = loc; in mmo_get_spec_section()
1120 mmo_section_data (sec)->head = loc; in mmo_get_spec_section()
1121 mmo_section_data (sec)->tail = loc; in mmo_get_spec_section()
1124 return sec; in mmo_get_spec_section()
1442 mmo_get_loc (asection *sec, bfd_vma vma, int size) in mmo_get_loc() argument
1445 struct mmo_section_data_struct *sdatap = mmo_section_data (sec); in mmo_get_loc()
1471 if (vma + size > sec->vma + sec->size) in mmo_get_loc()
1472 sec->size += (vma + size) - (sec->vma + sec->size); in mmo_get_loc()
1493 bfd_zalloc (sec->owner, sizeof (mmo_data_list_type) + allocated_size); in mmo_get_loc()
1525 if (! bfd_set_section_flags (sec->owner, sec, in mmo_get_loc()
1526 bfd_get_section_flags (sec->owner, sec) in mmo_get_loc()
1534 if (vma + size > sec->vma + sec->size) in mmo_get_loc()
1535 sec->size += (vma + size) - (sec->vma + sec->size); in mmo_get_loc()
1542 mmo_map_set_sizes (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, in mmo_map_set_sizes() argument
1545 sec->lma = sec->vma; in mmo_map_set_sizes()
1557 asection *sec = bfd_make_section_old_way (abfd, MMO_TEXT_SECTION_NAME); in mmo_scan() local
1584 sec = non_spec_sec; in mmo_scan()
1612 mmo_xore_32 (sec, vma, bfd_get_32 (abfd, buf)); in mmo_scan()
1648 sec = mmo_decide_section (abfd, vma & ~3); in mmo_scan()
1649 if (sec == NULL) in mmo_scan()
1657 sec = mmo_decide_section (abfd, vma); in mmo_scan()
1658 if (sec == NULL) in mmo_scan()
1836 non_spec_sec = sec; in mmo_scan()
1838 sec = mmo_get_spec_section (abfd, y * 256 + z); in mmo_scan()
1839 if (sec == NULL) in mmo_scan()
1842 vma = sec->vma; in mmo_scan()
1987 mmo_xore_32 (sec, vma & ~3, bfd_get_32 (abfd, buf)); in mmo_scan()
2012 sec = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME); in mmo_scan()
2013 if (sec != NULL in mmo_scan()
2014 && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) in mmo_scan()
2015 && ! bfd_set_section_flags (abfd, sec, in mmo_scan()
2016 bfd_get_section_flags (abfd, sec) in mmo_scan()
2020 sec = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME); in mmo_scan()
2021 if (sec != NULL in mmo_scan()
2022 && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) in mmo_scan()
2023 && ! bfd_set_section_flags (abfd, sec, in mmo_scan()
2024 bfd_get_section_flags (abfd, sec) in mmo_scan()
2061 asection *sec, in mmo_get_section_contents() argument
2078 loc = mmo_get_loc (sec, sec->vma + offset, chunk_size); in mmo_get_section_contents()
2291 mmo_internal_write_post (bfd *abfd, int z, asection *sec) in mmo_internal_write_post() argument
2299 bfd_byte *data = mmo_get_loc (sec, i * 8, 8); in mmo_internal_write_post()
2374 mmo_has_leading_or_trailing_zero_tetra_p (bfd *abfd, asection *sec) in mmo_has_leading_or_trailing_zero_tetra_p() argument
2376 bfd_vma secaddr = bfd_get_section_vma (abfd, sec); in mmo_has_leading_or_trailing_zero_tetra_p()
2378 if (sec->size < 4) in mmo_has_leading_or_trailing_zero_tetra_p()
2381 if (bfd_get_32 (abfd, mmo_get_loc (sec, secaddr, 4)) == 0 in mmo_has_leading_or_trailing_zero_tetra_p()
2383 mmo_get_loc (sec, secaddr + sec->size - 4, 4)) == 0) in mmo_has_leading_or_trailing_zero_tetra_p()
2392 mmo_internal_write_section (bfd *abfd, asection *sec) in mmo_internal_write_section() argument
2406 if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0) in mmo_internal_write_section()
2408 bfd_vma secaddr = bfd_get_section_vma (abfd, sec); in mmo_internal_write_section()
2414 if (sec->size != 0 in mmo_internal_write_section()
2415 && (secaddr + sec->size >= (bfd_vma) 1 << 56 in mmo_internal_write_section()
2417 || (sec->size & 3) != 0 in mmo_internal_write_section()
2418 || mmo_has_leading_or_trailing_zero_tetra_p (abfd, sec))) in mmo_internal_write_section()
2420 if (!mmo_write_section_description (abfd, sec)) in mmo_internal_write_section()
2425 return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head); in mmo_internal_write_section()
2427 else if (strcmp (sec->name, MMO_DATA_SECTION_NAME) == 0) in mmo_internal_write_section()
2429 bfd_vma secaddr = bfd_get_section_vma (abfd, sec); in mmo_internal_write_section()
2432 if (sec->size != 0 in mmo_internal_write_section()
2434 || secaddr + sec->size >= (bfd_vma) 0x21 << 56 in mmo_internal_write_section()
2436 || (sec->size & 3) != 0 in mmo_internal_write_section()
2437 || mmo_has_leading_or_trailing_zero_tetra_p (abfd, sec))) in mmo_internal_write_section()
2439 if (!mmo_write_section_description (abfd, sec)) in mmo_internal_write_section()
2443 return mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head); in mmo_internal_write_section()
2445 else if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0) in mmo_internal_write_section()
2453 else if (CONST_STRNEQ (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX)) in mmo_internal_write_section()
2455 int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)); in mmo_internal_write_section()
2459 && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head)); in mmo_internal_write_section()
2463 else if ((bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) != 0 in mmo_internal_write_section()
2464 && sec->size != 0) in mmo_internal_write_section()
2466 if (!mmo_write_section_description (abfd, sec)) in mmo_internal_write_section()
2471 if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) in mmo_internal_write_section()
2474 mmo_section_data (sec)->head)); in mmo_internal_write_section()
2476 && mmo_write_chunk_list (abfd, mmo_section_data (sec)->head)); in mmo_internal_write_section()
2486 mmo_write_section_description (bfd *abfd, asection *sec) in mmo_write_section_description() argument
2582 mmo_write_tetra (abfd, (strlen (sec->name) + 3) / 4); in mmo_write_section_description()
2583 mmo_write_chunk (abfd, (bfd_byte *) sec->name, strlen (sec->name)); in mmo_write_section_description()
2591 (bfd_get_section_flags (abfd, sec))); in mmo_write_section_description()
2592 mmo_write_octa (abfd, sec->size); in mmo_write_section_description()
2593 mmo_write_octa (abfd, bfd_get_section_vma (abfd, sec)); in mmo_write_section_description()
2600 mmo_set_section_contents (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec, in mmo_set_section_contents() argument
2615 loc = mmo_get_loc (sec, sec->vma + offset, chunk_size); in mmo_set_section_contents()
3087 mmo_write_section_unless_reg_contents (bfd *abfd, asection *sec, void *p) in mmo_write_section_unless_reg_contents() argument
3094 if (strcmp (sec->name, MMIX_REG_CONTENTS_SECTION_NAME) == 0) in mmo_write_section_unless_reg_contents()
3096 infop->reg_section = sec; in mmo_write_section_unless_reg_contents()
3101 if (strcmp (sec->name, MMIX_REG_SECTION_NAME) == 0) in mmo_write_section_unless_reg_contents()
3103 if (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) in mmo_write_section_unless_reg_contents()
3111 bfd_get_filename (abfd), sec->name); in mmo_write_section_unless_reg_contents()
3120 infop->retval = mmo_internal_write_section (abfd, sec); in mmo_write_section_unless_reg_contents()
3146 asection *sec = wsecinfo.reg_section; in mmo_write_object_contents() local
3147 unsigned int z = (unsigned int) (sec->vma / 8); in mmo_write_object_contents()
3152 if (z < 32 || z >= 255 || (sec->vma & 7) != 0 in mmo_write_object_contents()
3153 || sec->vma != 256 * 8 - sec->size - 8) in mmo_write_object_contents()
3157 if (sec->size == 0) in mmo_write_object_contents()
3162 else if (sec->vma > (256 - 32) * 8) in mmo_write_object_contents()
3168 (long) sec->size); in mmo_write_object_contents()
3174 (long) sec->size, in mmo_write_object_contents()
3175 (unsigned long) (sec->vma >> 32), (unsigned long) (sec->vma)); in mmo_write_object_contents()
3180 if (! mmo_internal_write_post (abfd, z, sec)) in mmo_write_object_contents()