diff options
author | Nathaniel Smith <njs@pobox.com> | 2016-02-01 13:44:15 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-02-01 13:44:15 +0000 |
commit | 655ed9ea1703173cb796070ed9843ea90bb74e58 (patch) | |
tree | 19e0ac905827f5a991c4f26a8c3d3a3aded1baa0 /bfd | |
parent | ac0d427f4b3a2b82dcf395da74fdbc71ee598095 (diff) | |
download | gdb-655ed9ea1703173cb796070ed9843ea90bb74e58.zip gdb-655ed9ea1703173cb796070ed9843ea90bb74e58.tar.gz gdb-655ed9ea1703173cb796070ed9843ea90bb74e58.tar.bz2 |
Add support for importing data from ILF images.
* peicode.h (pe_ILF_build_a_bfd): Create an import symbol for both
CODE and DATA.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/peicode.h | 29 |
2 files changed, 20 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f75631e..35d596d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2016-02-01 Nathaniel Smith <njs@pobox.com> + + * peicode.h (pe_ILF_build_a_bfd): Create an import symbol for both + CODE and DATA. + 2016-02-01 Alan Modra <amodra@gmail.com> * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Don't abort on diff --git a/bfd/peicode.h b/bfd/peicode.h index 96cfd65..a33e71b 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -959,13 +959,19 @@ pe_ILF_build_a_bfd (bfd * abfd, pe_ILF_save_relocs (&vars, id5); } + /* Create an import symbol. */ + pe_ILF_make_a_symbol (& vars, "__imp_", symbol_name, id5, 0); + imp_sym = vars.sym_ptr_ptr - 1; + imp_index = vars.sym_index - 1; + /* Create extra sections depending upon the type of import we are dealing with. */ switch (import_type) { int i; case IMPORT_CODE: - /* Create a .text section. + /* CODE functions are special, in that they get a trampoline that + jumps to the main import symbol. Create a .text section to hold it. First we need to look up its contents in the jump table. */ for (i = NUM_ENTRIES (jtab); i--;) { @@ -986,11 +992,6 @@ pe_ILF_build_a_bfd (bfd * abfd, /* Copy in the jump code. */ memcpy (text->contents, jtab[i].data, jtab[i].size); - /* Create an import symbol. */ - pe_ILF_make_a_symbol (& vars, "__imp_", symbol_name, id5, 0); - imp_sym = vars.sym_ptr_ptr - 1; - imp_index = vars.sym_index - 1; - /* Create a reloc for the data in the text section. */ #ifdef MIPS_ARCH_MAGIC_WINCE if (magic == MIPS_ARCH_MAGIC_WINCE) @@ -1068,14 +1069,6 @@ pe_ILF_build_a_bfd (bfd * abfd, pe_ILF_make_a_symbol (& vars, "", symbol_name, text, BSF_NOT_AT_END | BSF_FUNCTION); - /* 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 = '.'; break; case IMPORT_DATA: @@ -1087,6 +1080,14 @@ pe_ILF_build_a_bfd (bfd * abfd, 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; bfd_get_symcount (abfd) = vars.sym_index; |