diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2009-01-08 13:28:48 +0000 |
---|---|---|
committer | Kai Tietz <kai.tietz@onevision.com> | 2009-01-08 13:28:48 +0000 |
commit | ce11ba6c9d65f4606431e5d73986ad87e3ee9583 (patch) | |
tree | c7999040c68c6e2e020088296ea0fe8526c67410 /ld/pe-dll.c | |
parent | dde0281261f8a2b4e89ec28a3b602d52ba97e9fd (diff) | |
download | gdb-ce11ba6c9d65f4606431e5d73986ad87e3ee9583.zip gdb-ce11ba6c9d65f4606431e5d73986ad87e3ee9583.tar.gz gdb-ce11ba6c9d65f4606431e5d73986ad87e3ee9583.tar.bz2 |
2009-01-08 Kai Tietz <kai.tietz@onevision.com>
* pe.em (OPTION_USE_NUL_PREFIXED_IMPORT_TABLES): New.
(gld..._add_options): Add new option
--use-nul-prefixed-import-tables.
(gld..._handle_option): Likewise.
* pep.em: Same as for pe.em.
* ld.texinfo: Add new option documentation for
--use-nul-prefixed-import-tables.
* pe-dll.c (pe_use_nul_prefixed_import_tables): New.
(make_head): Make prefix leading zero prefix element for
idata$4 and idata$5 dependent to new flag.
(make_import_fixup_entry): Remove idata4/5 prefix.
* pe-dll.h (pe_use_nul_prefixed_import_tables): New.
* pep-dll.c (pe_use_nul_prefixed_import_tables): New.
* pep-dll.h (pep_use_nul_prefixed_import_tables): New.
* NEWS: Add new option.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r-- | ld/pe-dll.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c index d76d0cf..89e1541 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -155,6 +155,7 @@ int pe_dll_stdcall_aliases = 0; int pe_dll_warn_dup_exports = 0; int pe_dll_compat_implib = 0; int pe_dll_extra_pe_debug = 0; +int pe_use_nul_prefixed_import_tables = 0; /* Static variables and types. */ @@ -1796,18 +1797,24 @@ make_head (bfd *parent) d2 = xmalloc (20); id2->contents = d2; memset (d2, 0, 20); - d2[0] = d2[16] = PE_IDATA5_SIZE; /* Reloc addend. */ + if (pe_use_nul_prefixed_import_tables) + d2[0] = d2[16] = PE_IDATA5_SIZE; /* Reloc addend. */ quick_reloc (abfd, 0, BFD_RELOC_RVA, 2); quick_reloc (abfd, 12, BFD_RELOC_RVA, 4); quick_reloc (abfd, 16, BFD_RELOC_RVA, 1); save_relocs (id2); - bfd_set_section_size (abfd, id5, PE_IDATA5_SIZE); + if (pe_use_nul_prefixed_import_tables) + bfd_set_section_size (abfd, id5, PE_IDATA5_SIZE); + else + bfd_set_section_size (abfd, id5, 0); d5 = xmalloc (PE_IDATA5_SIZE); id5->contents = d5; memset (d5, 0, PE_IDATA5_SIZE); - - bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE); + if (pe_use_nul_prefixed_import_tables) + bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE); + else + bfd_set_section_size (abfd, id4, 0); d4 = xmalloc (PE_IDATA4_SIZE); id4->contents = d4; memset (d4, 0, PE_IDATA4_SIZE); @@ -1815,8 +1822,16 @@ make_head (bfd *parent) bfd_set_symtab (abfd, symtab, symptr); bfd_set_section_contents (abfd, id2, d2, 0, 20); - bfd_set_section_contents (abfd, id5, d5, 0, PE_IDATA5_SIZE); - bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE); + if (pe_use_nul_prefixed_import_tables) + { + bfd_set_section_contents (abfd, id5, d5, 0, PE_IDATA5_SIZE); + bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE); + } + else + { + bfd_set_section_contents (abfd, id5, d5, 0, 0); + bfd_set_section_contents (abfd, id4, d4, 0, 0); + } bfd_make_readable (abfd); return abfd; @@ -2279,7 +2294,6 @@ make_import_fixup_entry (const char *name, d2 = xmalloc (20); id2->contents = d2; memset (d2, 0, 20); - d2[0] = d2[16] = PE_IDATA5_SIZE; /* Reloc addend. */ quick_reloc (abfd, 0, BFD_RELOC_RVA, 1); quick_reloc (abfd, 12, BFD_RELOC_RVA, 2); |