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 | |
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.
-rw-r--r-- | ld/ChangeLog | 18 | ||||
-rw-r--r-- | ld/NEWS | 4 | ||||
-rw-r--r-- | ld/emultempl/pe.em | 7 | ||||
-rw-r--r-- | ld/emultempl/pep.em | 8 | ||||
-rw-r--r-- | ld/ld.texinfo | 7 | ||||
-rw-r--r-- | ld/pe-dll.c | 28 | ||||
-rw-r--r-- | ld/pe-dll.h | 1 | ||||
-rw-r--r-- | ld/pep-dll.c | 2 | ||||
-rw-r--r-- | ld/pep-dll.h | 1 |
9 files changed, 68 insertions, 8 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index a87bbad..747633c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,21 @@ +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. + 2009-01-05 Kai Tietz <kai.tietz@onevision.com> * emultempl/pe.em: Prefix dollar characters to be outputed in @@ -1,4 +1,8 @@ -*- text -*- + +* Add new option --use-nul-prefixed-import-tables to ld for PE targets to + allow fallback to old import table generation with null element prefix. + * Windows PE systems now support a new --exclude-modules-for-implib option, allowing users to partition object files and archive members between a DLL and its associated import library as they are generated during linking. diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 26a70a7..d2d34ad 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -209,6 +209,8 @@ gld_${EMULATION_NAME}_before_parse (void) (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1 + 1) #define OPTION_EXCLUDE_MODULES_FOR_IMPLIB \ (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2 + 1) +#define OPTION_USE_NUL_PREFIXED_IMPORT_TABLES \ + (OPTION_EXCLUDE_MODULES_FOR_IMPLIB + 1) static void gld${EMULATION_NAME}_add_options @@ -234,6 +236,8 @@ gld${EMULATION_NAME}_add_options {"subsystem", required_argument, NULL, OPTION_SUBSYSTEM}, {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE}, {"thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY}, + {"use-nul-prefixed-import-tables", no_argument, NULL, + OPTION_USE_NUL_PREFIXED_IMPORT_TABLES}, #ifdef DLL_SUPPORT /* getopt allows abbreviations, so we do this to stop it from treating -o as an abbreviation for this option */ @@ -596,6 +600,9 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_THUMB_ENTRY: thumb_entry_symbol = optarg; break; + case OPTION_USE_NUL_PREFIXED_IMPORT_TABLES: + pe_use_nul_prefixed_import_tables = TRUE; + break; #ifdef DLL_SUPPORT case OPTION_OUT_DEF: pe_out_def_filename = xstrdup (optarg); diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index f921c1e..f6f802e 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -176,7 +176,8 @@ enum options OPTION_DLL_DISABLE_RUNTIME_PSEUDO_RELOC, OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V1, OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC_V2, - OPTION_EXCLUDE_MODULES_FOR_IMPLIB + OPTION_EXCLUDE_MODULES_FOR_IMPLIB, + OPTION_USE_NUL_PREFIXED_IMPORT_TABLES }; static void @@ -206,6 +207,8 @@ gld${EMULATION_NAME}_add_options {"stack", required_argument, NULL, OPTION_STACK}, {"subsystem", required_argument, NULL, OPTION_SUBSYSTEM}, {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE}, + {"use-nul-prefixed-import-tables", no_argument, NULL, + OPTION_USE_NUL_PREFIXED_IMPORT_TABLES}, #ifdef DLL_SUPPORT /* getopt allows abbreviations, so we do this to stop it from treating -o as an abbreviation for this option. */ @@ -556,6 +559,9 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_SUPPORT_OLD_CODE: support_old_code = 1; break; + case OPTION_USE_NUL_PREFIXED_IMPORT_TABLES: + pep_use_nul_prefixed_import_tables = TRUE; + break; #ifdef DLL_SUPPORT case OPTION_OUT_DEF: pep_out_def_filename = xstrdup (optarg); diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 11bde29..3f16546 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5619,6 +5619,13 @@ But it also sets the bottom bit of the address, so that it can be branched to using a BX instruction, and the program will start executing in Thumb mode straight away. +@cindex PE import table prefixing +@kindex --use-nul-prefixed-import-tables +The @samp{--use-nul-prefixed-import-tables} switch is specifying, that +the import tables idata4 and idata5 have to be generated with a zero +elememt prefix for import libraries. This is the old style to generate +import tables. By default this option is turned off. + @cindex BE8 @kindex --be8 The @samp{--be8} switch instructs @command{ld} to generate BE8 format 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); diff --git a/ld/pe-dll.h b/ld/pe-dll.h index 83e7422..22630dc 100644 --- a/ld/pe-dll.h +++ b/ld/pe-dll.h @@ -35,6 +35,7 @@ extern int pe_dll_stdcall_aliases; extern int pe_dll_warn_dup_exports; extern int pe_dll_compat_implib; extern int pe_dll_extra_pe_debug; +extern int pe_use_nul_prefixed_import_tables; typedef enum { EXCLUDESYMS, EXCLUDELIBS, EXCLUDEFORIMPLIB } exclude_type; diff --git a/ld/pep-dll.c b/ld/pep-dll.c index 89d237c..a7c31a7 100644 --- a/ld/pep-dll.c +++ b/ld/pep-dll.c @@ -33,6 +33,8 @@ #define pe_dll_kill_ats pep_dll_kill_ats #define pe_dll_stdcall_aliases pep_dll_stdcall_aliases #define pe_dll_warn_dup_exports pep_dll_warn_dup_exports +#define pe_use_nul_prefixed_import_tables \ + pep_use_nul_prefixed_import_tables /* External globals. */ #define pe_data_import_dll pep_data_import_dll diff --git a/ld/pep-dll.h b/ld/pep-dll.h index 5d09658..76ad61a 100644 --- a/ld/pep-dll.h +++ b/ld/pep-dll.h @@ -35,6 +35,7 @@ extern int pep_dll_stdcall_aliases; extern int pep_dll_warn_dup_exports; extern int pep_dll_compat_implib; extern int pep_dll_extra_pe_debug; +extern int pep_use_nul_prefixed_import_tables; typedef enum { EXCLUDESYMS, EXCLUDELIBS, EXCLUDEFORIMPLIB } exclude_type; |