hash bfd sections for fast lookup and create.

bfd/ChangeLog
	* bfd.c (struct _bfd): Add section_htab, section_tail.
	* libbfd-in.h (_bfd_delete_bfd): Declare.
	(bfd_section_hash_newfunc): Declare.
	* opncls.c (_bfd_new_bfd): Free memory on failure.  Init
	section_htab and section_tail.
	(_bfd_delete_bfd): New function.
	(bfd_openr): Use it.
	(bfd_fdopenr): Likewise.
	(bfd_openstreamr): Likewise.
	(bfd_openw): Likewise.
	(bfd_close): Likewise.
	(bfd_close_all_done): Likewise.
	(bfd_release): Comment.
	* section.c (struct section_hash_entry): New.
	(bfd_section_hash_newfunc): New function.
	(section_hash_lookup): Define.
	(bfd_section_init): New function, split out from
	bfd_make_section_anyway.
	(bfd_get_section_by_name): Lookup via hash table.
	(bfd_get_unique_section_name): Likewise.
	(bfd_make_section_old_way): Rewrite to use hash table.
	(bfd_make_section_anyway): Likewise.
	(bfd_make_section): Likewise.  Return NULL for attempts to make
	BFD_{ABS,COM,UND,IND}_SECTION_NAME.
	(_bfd_strip_section_from_output): Adjust section_tail if needed.
	* configure.in: Bump bfd version.
	* configure: Regenerate.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.

ld/ChangeLog
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Adjust
	section_tail when fiddling with section list.
	(gld${EMULATION_NAME}_list_options): Ensure sentences aren't
	broken into separate strings to make translation easier.
	* emultempl/mmo.em (mmo_place_orphan): Adjust section_tail when
	fiddling with section list.
	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
This commit is contained in:
Alan Modra
2001-12-17 00:40:53 +00:00
parent d9464f48d7
commit 73e87d7038
11 changed files with 499 additions and 387 deletions

View File

@@ -1274,10 +1274,14 @@ gld${EMULATION_NAME}_place_orphan (file, s)
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
;
*pps = snew->next;
if (snew->next == NULL)
snew->owner->section_tail = pps;
/* Now tack it on to the "place->os" section list. */
snew->next = *place->section;
*place->section = snew;
if (snew->next == NULL)
snew->owner->section_tail = &snew->next;
}
/* Save the end of this list. Further ophans of this type will
@@ -1598,8 +1602,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n"));
fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n"));
fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n"));
fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n"));
fprintf (file, _("\t\t\t at runtime\n"));
fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t at runtime\n"));
fprintf (file, _(" -z KEYWORD\t\tIgnored for Solaris compatibility\n"));
EOF
fi

View File

@@ -163,10 +163,14 @@ mmo_place_orphan (file, s)
for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
;
*pps = snew->next;
if (snew->next == NULL)
snew->owner->section_tail = pps;
/* Now tack it on to the "place->os" section list. */
snew->next = *place->section;
*place->section = snew;
if (snew->next == NULL)
snew->owner->section_tail = &snew->next;
}
place->section = &snew->next; /* Save the end of this list. */

View File

@@ -1691,10 +1691,14 @@ gld_${EMULATION_NAME}_place_orphan (file, s)
pps = &(*pps)->next)
;
*pps = snew->next;
if (snew->next == NULL)
snew->owner->section_tail = pps;
/* Now tack it on to the "place->os" section list. */
snew->next = *place->section;
*place->section = snew;
if (snew->next == NULL)
snew->owner->section_tail = &snew->next;
}
/* Save the end of this list. Further ophans of this type will