[vms/committed] Do not create anymore dummy sections
Tristan Gingold
gingold@adacore.com
Fri Jun 25 15:21:00 GMT 2010
More information about the Binutils mailing list
Fri Jun 25 15:21:00 GMT 2010
- Previous message (by thread): [vms/committed]: set linktime
- Next message (by thread): [vms/committed] Create an absolute section if needed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, there was code in vms-alpha.c to generate dummy sections in object files in case of non-consecutive sections index. Although I never saw such sections, this code can be removed by using target_index instead. Committed. Tristan. bfd/ 2010-06-25 Tristan Gingold <gingold@adacore.com> * vms-alpha.c (_bfd_vms_write_egsd): Set target_index field of sections. Mark .vmsdebug section as SEC_DEBUGGING. Do not create dummy psect anymore. Adjust. (_bfd_vms_write_eeom): Adjust (use target_index instead of index) (_bfd_vms_write_etir): Ditto. (start_etir_or_etbt_record): Test for SEC_DEBUGGING instead of section name. Adjust. Index: vms-alpha.c =================================================================== RCS file: /cvs/src/src/bfd/vms-alpha.c,v retrieving revision 1.26 diff -c -r1.26 vms-alpha.c *** vms-alpha.c 25 Jun 2010 14:54:19 -0000 1.26 --- vms-alpha.c 25 Jun 2010 15:20:46 -0000 *************** *** 2666,2672 **** return FALSE; } _bfd_vms_output_short (recwr, 0); ! _bfd_vms_output_long (recwr, (unsigned long) (section->index)); _bfd_vms_output_long (recwr, (unsigned long) bfd_get_start_address (abfd)); _bfd_vms_output_long (recwr, 0); --- 2666,2672 ---- return FALSE; } _bfd_vms_output_short (recwr, 0); ! _bfd_vms_output_long (recwr, (unsigned long) section->target_index); _bfd_vms_output_long (recwr, (unsigned long) bfd_get_start_address (abfd)); _bfd_vms_output_long (recwr, 0); *************** *** 3279,3296 **** asection *section; asymbol *symbol; unsigned int symnum; - int last_index = -1; - char dummy_name[10]; const char *sname; flagword new_flags, old_flags; int abs_section_index = 0; struct vms_rec_wr *recwr = &PRIV (recwr); ! vms_debug2 ((2, "vms_write_gsd\n")); ! ! /* Output sections. */ ! section = abfd->sections; ! vms_debug2 ((3, "%d sections found\n", abfd->section_count)); /* Egsd is quadword aligned. */ _bfd_vms_output_alignment (recwr, 8); --- 3279,3291 ---- asection *section; asymbol *symbol; unsigned int symnum; const char *sname; flagword new_flags, old_flags; int abs_section_index = 0; + unsigned int target_index = 0; struct vms_rec_wr *recwr = &PRIV (recwr); ! vms_debug2 ((2, "vms_write_egsd\n")); /* Egsd is quadword aligned. */ _bfd_vms_output_alignment (recwr, 8); *************** *** 3298,3312 **** _bfd_vms_output_begin (recwr, EOBJ__C_EGSD); _bfd_vms_output_long (recwr, 0); ! while (section != 0) { vms_debug2 ((3, "Section #%d %s, %d bytes\n", ! section->index, section->name, (int)section->size)); /* Don't write out the VMS debug info section since it is in the ETBT and EDBG sections in etir. */ ! if (!strcmp (section->name, ".vmsdebug")) ! goto done; /* 13 bytes egsd, max 31 chars name -> should be 44 bytes. */ if (_bfd_vms_output_check (recwr, 64) < 0) --- 3293,3320 ---- _bfd_vms_output_begin (recwr, EOBJ__C_EGSD); _bfd_vms_output_long (recwr, 0); ! /* Number sections. */ ! for (section = abfd->sections; section != NULL; section = section->next) ! { ! if (section->flags & SEC_DEBUGGING) ! continue; ! if (!strcmp (section->name, ".vmsdebug")) ! { ! section->flags |= SEC_DEBUGGING; ! continue; ! } ! section->target_index = target_index++; ! } ! ! for (section = abfd->sections; section != NULL; section = section->next) { vms_debug2 ((3, "Section #%d %s, %d bytes\n", ! section->target_index, section->name, (int)section->size)); /* Don't write out the VMS debug info section since it is in the ETBT and EDBG sections in etir. */ ! if (section->flags & SEC_DEBUGGING) ! continue; /* 13 bytes egsd, max 31 chars name -> should be 44 bytes. */ if (_bfd_vms_output_check (recwr, 64) < 0) *************** *** 3316,3335 **** _bfd_vms_output_long (recwr, 0); } - /* Create dummy sections to keep consecutive indices. */ - while (section->index - last_index > 1) - { - vms_debug2 ((3, "index %d, last %d\n", section->index, last_index)); - _bfd_vms_output_begin_subrec (recwr, EGSD__C_PSC); - _bfd_vms_output_short (recwr, 0); - _bfd_vms_output_short (recwr, 0); - _bfd_vms_output_long (recwr, 0); - sprintf (dummy_name, ".DUMMY%02d", last_index); - _bfd_vms_output_counted (recwr, dummy_name); - _bfd_vms_output_end_subrec (recwr); - last_index++; - } - /* Don't know if this is necessary for the linker but for now it keeps vms_slurp_gsd happy. */ sname = section->name; --- 3324,3329 ---- *************** *** 3352,3358 **** else if ((*sname == 'l') && (strcmp (sname, "literals") == 0)) { sname = EVAX_LITERALS_NAME; ! abs_section_index = section->index; } else if ((*sname == 'c') && (strcmp (sname, "comm") == 0)) sname = EVAX_COMMON_NAME; --- 3346,3352 ---- else if ((*sname == 'l') && (strcmp (sname, "literals") == 0)) { sname = EVAX_LITERALS_NAME; ! abs_section_index = section->target_index; } else if ((*sname == 'c') && (strcmp (sname, "comm") == 0)) sname = EVAX_COMMON_NAME; *************** *** 3387,3396 **** _bfd_vms_output_long (recwr, (unsigned long) section->size); _bfd_vms_output_counted (recwr, sname); _bfd_vms_output_end_subrec (recwr); - - last_index = section->index; - done: - section = section->next; } /* Output symbols. */ --- 3381,3386 ---- *************** *** 3470,3483 **** { asymbol *sym; ! sym = ((struct evax_private_udata_struct *)symbol->udata.p)->enbsym; code_address = sym->value; ! ca_psindx = sym->section->index; } if (bfd_is_abs_section (symbol->section)) psindx = abs_section_index; else ! psindx = symbol->section->index; _bfd_vms_output_quad (recwr, symbol->value); _bfd_vms_output_quad (recwr, code_address); --- 3460,3474 ---- { asymbol *sym; ! sym = ! ((struct evax_private_udata_struct *)symbol->udata.p)->enbsym; code_address = sym->value; ! ca_psindx = sym->section->target_index; } if (bfd_is_abs_section (symbol->section)) psindx = abs_section_index; else ! psindx = symbol->section->target_index; _bfd_vms_output_quad (recwr, symbol->value); _bfd_vms_output_quad (recwr, code_address); *************** *** 3587,3594 **** { struct vms_rec_wr *recwr = &PRIV (recwr); ! if (section->name[0] == '.' && section->name[1] == 'v' ! && !strcmp (section->name, ".vmsdebug")) { _bfd_vms_output_begin (recwr, EOBJ__C_ETBT); --- 3578,3584 ---- { struct vms_rec_wr *recwr = &PRIV (recwr); ! if (section->flags & SEC_DEBUGGING) { _bfd_vms_output_begin (recwr, EOBJ__C_ETBT); *************** *** 3612,3618 **** { /* Push start offset. */ _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, (unsigned long) section->index); _bfd_vms_output_quad (recwr, offset); _bfd_vms_output_end_subrec (recwr); --- 3602,3608 ---- { /* Push start offset. */ _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, (unsigned long) section->target_index); _bfd_vms_output_quad (recwr, offset); _bfd_vms_output_end_subrec (recwr); *************** *** 3717,3723 **** for (section = abfd->sections; section; section = section->next) { vms_debug2 ((4, "writing %d. section '%s' (%d bytes)\n", ! section->index, section->name, (int) (section->size))); if (!(section->flags & SEC_HAS_CONTENTS) || bfd_is_com_section (section)) --- 3707,3713 ---- for (section = abfd->sections; section; section = section->next) { vms_debug2 ((4, "writing %d. section '%s' (%d bytes)\n", ! section->target_index, section->name, (int) (section->size))); if (!(section->flags & SEC_HAS_CONTENTS) || bfd_is_com_section (section)) *************** *** 3852,3858 **** { etir_output_check (abfd, section, curr_addr, 32); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, (unsigned long) sec->index); _bfd_vms_output_quad (recwr, rptr->addend + sym->value); _bfd_vms_output_end_subrec (recwr); /* ??? Table B-8 of the OpenVMS Linker Utilily Manual --- 3842,3849 ---- { etir_output_check (abfd, section, curr_addr, 32); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, ! (unsigned long) sec->target_index); _bfd_vms_output_quad (recwr, rptr->addend + sym->value); _bfd_vms_output_end_subrec (recwr); /* ??? Table B-8 of the OpenVMS Linker Utilily Manual *************** *** 3905,3911 **** { etir_output_check (abfd, section, curr_addr, 32); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, (unsigned long) sec->index); _bfd_vms_output_quad (recwr, rptr->addend + sym->value); _bfd_vms_output_end_subrec (recwr); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STO_OFF); --- 3896,3903 ---- { etir_output_check (abfd, section, curr_addr, 32); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STA_PQ); ! _bfd_vms_output_long (recwr, ! (unsigned long) sec->target_index); _bfd_vms_output_quad (recwr, rptr->addend + sym->value); _bfd_vms_output_end_subrec (recwr); _bfd_vms_output_begin_subrec (recwr, ETIR__C_STO_OFF); *************** *** 3948,3958 **** _bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_NOP_GBL); _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex); _bfd_vms_output_long ! (recwr, (unsigned long) udata->enbsym->section->index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0x47ff041f); _bfd_vms_output_long ! (recwr, (unsigned long) udata->enbsym->section->index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol --- 3940,3952 ---- _bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_NOP_GBL); _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex); _bfd_vms_output_long ! (recwr, ! (unsigned long) udata->enbsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0x47ff041f); _bfd_vms_output_long ! (recwr, ! (unsigned long) udata->enbsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol *************** *** 3973,3983 **** _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex + 1); _bfd_vms_output_long ! (recwr, (unsigned long) udata->enbsym->section->index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0x237B0000); _bfd_vms_output_long ! (recwr, (unsigned long) udata->bsym->section->index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol --- 3967,3978 ---- _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex + 1); _bfd_vms_output_long ! (recwr, ! (unsigned long) udata->enbsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0x237B0000); _bfd_vms_output_long ! (recwr, (unsigned long) udata->bsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol *************** *** 3993,4003 **** _bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_BOH_GBL); _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex); _bfd_vms_output_long ! (recwr, (unsigned long) udata->enbsym->section->index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0xD3400000); _bfd_vms_output_long ! (recwr, (unsigned long) udata->enbsym->section->index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol --- 3988,4000 ---- _bfd_vms_output_begin_subrec (recwr, ETIR__C_STC_BOH_GBL); _bfd_vms_output_long (recwr, (unsigned long) udata->lkindex); _bfd_vms_output_long ! (recwr, ! (unsigned long) udata->enbsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->address); _bfd_vms_output_long (recwr, (unsigned long) 0xD3400000); _bfd_vms_output_long ! (recwr, ! (unsigned long) udata->enbsym->section->target_index); _bfd_vms_output_quad (recwr, rptr->addend); _bfd_vms_output_counted (recwr, _bfd_vms_length_hash_symbol
- Previous message (by thread): [vms/committed]: set linktime
- Next message (by thread): [vms/committed] Create an absolute section if needed
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list