#ifdef COFF_IMAGE_WITH_PE
\f
-/* Code to handle Microsoft's Image Library Format.
+/* Code to handle Microsoft's Import Library Format.
Also known as LINK6 format.
Documentation about this format can be found at:
- http://msdn.microsoft.com/library/specs/pecoff_section8.htm */
+ https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#import-library-format */
/* The following constants specify the sizes of the various data
structures that we have to create in order to build a bfd describing
abort ();
}
+ /* Now create a symbol describing the imported value. */
+ switch (import_type)
+ {
+ case IMPORT_CODE:
+ pe_ILF_make_a_symbol (& vars, "", symbol_name, text,
+ BSF_NOT_AT_END | BSF_FUNCTION);
+
+ break;
+
+ case IMPORT_DATA:
+ /* Nothing to do here. */
+ break;
+
+ default:
+ /* XXX code not yet written. */
+ abort ();
+ }
+
+ /* Create an import symbol for the DLL, without the .dll suffix. */
+ ptr = (bfd_byte *) strrchr (source_dll, '.');
+ if (ptr)
+ * ptr = 0;
+ pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0);
+ if (ptr)
+ * ptr = '.';
+
/* Initialise the bfd. */
memset (& internal_f, 0, sizeof (internal_f));
bfd_cache_close (abfd);
abfd->iostream = (void *) vars.bim;
- abfd->flags |= BFD_IN_MEMORY /* | HAS_LOCALS */;
+ abfd->flags |= BFD_IN_MEMORY | HAS_SYMS;
abfd->iovec = &_bfd_memory_iovec;
abfd->where = 0;
abfd->origin = 0;
abfd->size = 0;
obj_sym_filepos (abfd) = 0;
- /* Now create a symbol describing the imported value. */
- switch (import_type)
- {
- case IMPORT_CODE:
- pe_ILF_make_a_symbol (& vars, "", symbol_name, text,
- BSF_NOT_AT_END | BSF_FUNCTION);
-
- break;
-
- case IMPORT_DATA:
- /* Nothing to do here. */
- break;
-
- default:
- /* XXX code not yet written. */
- abort ();
- }
-
- /* Create an import symbol for the DLL, without the .dll suffix. */
- ptr = (bfd_byte *) strrchr (source_dll, '.');
- if (ptr)
- * ptr = 0;
- pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0);
- if (ptr)
- * ptr = '.';
-
/* Point the bfd at the symbol table. */
obj_symbols (abfd) = vars.sym_cache;
abfd->symcount = vars.sym_index;
obj_coff_strings (abfd) = vars.string_table;
obj_coff_keep_strings (abfd) = true;
- abfd->flags |= HAS_SYMS;
-
return true;
error_return:
return false;
}
-/* We have detected a Image Library Format archive element.
+/* We have detected an Import Library Format archive element.
Decode the element and return the appropriate target. */
static bfd_cleanup
unsigned int magic;
/* Upon entry the first six bytes of the ILF header have
- already been read. Now read the rest of the header. */
+ already been read. Now read the rest of the header. */
if (bfd_bread (buffer, (bfd_size_type) 14, abfd) != 14)
return NULL;