diff options
author | DJ Delorie <dj@redhat.com> | 1999-09-29 00:31:40 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 1999-09-29 00:31:40 +0000 |
commit | 8a5b676cd20d44969c9d797e5b522b673acd6963 (patch) | |
tree | 662c00b9ab35af85931d12bc62b936671e71cbb5 | |
parent | 6426a772a2645ef6afa596319dba0ff966bff050 (diff) | |
download | gdb-8a5b676cd20d44969c9d797e5b522b673acd6963.zip gdb-8a5b676cd20d44969c9d797e5b522b673acd6963.tar.gz gdb-8a5b676cd20d44969c9d797e5b522b673acd6963.tar.bz2 |
* pe-dll.c (process_def_file): Move the offset lookup from here to
(fill_exported_offsets): here. New static function.
(fill_edata): Use.
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/pe-dll.c | 54 |
2 files changed, 57 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index f4ca897..60e6cb4 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,11 @@ 1999-09-28 Mumit Khan <khan@xraylith.wisc.edu> + * pe-dll.c (process_def_file): Move the offset lookup from here to + (fill_exported_offsets): here. New static function. + (fill_edata): Use. + +1999-09-28 Mumit Khan <khan@xraylith.wisc.edu> + * deffilep.y (tokens): Add upper and lower case versions of DATA, CONSTANT, NONAME and PRIVATE tokens. (command): Use DATAU. diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 61f57f0..657f41d 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -384,13 +384,22 @@ process_def_file (abfd, info) name, false, false, true); - if (blhe && (blhe->type == bfd_link_hash_defined)) + if (blhe + && (blhe->type == bfd_link_hash_defined + || (blhe->type == bfd_link_hash_common))) { count_exported++; if (!pe_def_file->exports[i].flag_noname) count_exported_byname++; - exported_symbol_offsets[i] = blhe->u.def.value; - exported_symbol_sections[i] = blhe->u.def.section; + + /* Only fill in the sections. The actual offsets are computed + in fill_exported_offsets() after common symbols are laid + out. */ + if (blhe->type == bfd_link_hash_defined) + exported_symbol_sections[i] = blhe->u.def.section; + else + exported_symbol_sections[i] = blhe->u.c.p->section; + if (pe_def_file->exports[i].ordinal != -1) { if (max_ordinal < pe_def_file->exports[i].ordinal) @@ -572,6 +581,43 @@ generate_edata (abfd, info) + name_table_size + strlen (dll_name) + 1); } +/* Fill the exported symbol offsets. The preliminary work has already + been done in process_def_file(). */ + +static void +fill_exported_offsets (abfd, info) + bfd *abfd; + struct bfd_link_info *info; +{ + int i, j; + struct bfd_link_hash_entry *blhe; + bfd *b; + struct sec *s; + def_file_export *e=0; + + for (i = 0; i < pe_def_file->num_exports; i++) + { + char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2); + if (pe_details->underscored) + { + *name = '_'; + strcpy (name + 1, pe_def_file->exports[i].internal_name); + } + else + strcpy (name, pe_def_file->exports[i].internal_name); + + blhe = bfd_link_hash_lookup (info->hash, + name, + false, false, true); + + if (blhe && (blhe->type == bfd_link_hash_defined)) + { + exported_symbol_offsets[i] = blhe->u.def.value; + } + free (name); + } +} + static void fill_edata (abfd, info) bfd *abfd; @@ -615,6 +661,8 @@ fill_edata (abfd, info) bfd_put_32 (abfd, ERVA (enameptrs), edata_d + 32); bfd_put_32 (abfd, ERVA (eordinals), edata_d + 36); + fill_exported_offsets (abfd, info); + /* Ok, now for the filling in part */ hint = 0; for (i = 0; i < export_table_size; i++) |