diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index 8a45bf6..d615cd2 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -116,7 +116,7 @@ typedef struct pe_tdata int dll; int has_reloc_section; int dont_strip_reloc; - bfd_boolean insert_timestamp; + bfd_boolean strip_timestamp; bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); flagword real_flags; diff --git a/bfd/libcoff.h b/bfd/libcoff.h index d2c794d..499781e 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -120,7 +120,7 @@ typedef struct pe_tdata int dll; int has_reloc_section; int dont_strip_reloc; - bfd_boolean insert_timestamp; + bfd_boolean strip_timestamp; bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); flagword real_flags; diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 3808d39..250f06b 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -836,8 +836,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out) H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->f_magic); H_PUT_16 (abfd, filehdr_in->f_nscns, filehdr_out->f_nscns); - /* Only use a real timestamp if the option was chosen. */ - if ((pe_data (abfd)->insert_timestamp)) + /* Strip timestamp if the option was chosen. */ + if (!(pe_data (abfd)->strip_timestamp)) H_PUT_32 (abfd, time (0), filehdr_out->f_timdat); PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 71eca31..2651018 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2014-06-18 Linda Zhang + + * bfd/libcoff-in.h: Change insert_timestamp to strip_timestamp. + * bfd/libcoff.h: Update after change to bfd/libcoff-in.h. + * bfd/peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Strip timestamp if + the option was chosen. + * ld/pe-dll.c (fill_edata): Likewise. + * ld/emultempl/pe.em: Change insert_timestamp to strip_timestamp, and + make the default behaviour to preserve timestamp. + * ld/emultempl/pep.em: Likewise for 64bit. + * ld/ld.texinfo: Change insert_timestamp to strip_timestamp. + 2014-06-17 Anton Lavrentiwev PR binutils/16923 diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 0466eb3..3d63fd9 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -132,7 +132,7 @@ static int support_old_code = 0; static char * thumb_entry_symbol = NULL; static lang_assignment_statement_type *image_base_statement = 0; static unsigned short pe_dll_characteristics = 0; -static bfd_boolean insert_timestamp = FALSE; +static bfd_boolean strip_timestamp = FALSE; static const char *emit_build_id; #ifdef DLL_SUPPORT @@ -271,8 +271,8 @@ fragment < Set the entry point to be Thumb \n")); - fprintf (file, _(" --insert-timestamp Use a real timestamp rather than zero.\n")); - fprintf (file, _(" This makes binaries non-deterministic\n")); + fprintf (file, _(" --strip-timestamp Strip real timestamp\n")); + fprintf (file, _(" This makes binaries deterministic but\n")); + fprintf (file, _(" breaks bound import compatibility.\n")); #ifdef DLL_SUPPORT fprintf (file, _(" --add-stdcall-alias Export symbols with and without @nn\n")); fprintf (file, _(" --disable-stdcall-fixup Don't link _sym to _sym@nn\n")); @@ -766,8 +767,8 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_LEADING_UNDERSCORE: pe_leading_underscore = 1; break; - case OPTION_INSERT_TIMESTAMP: - insert_timestamp = TRUE; + case OPTION_STRIP_TIMESTAMP: + strip_timestamp = TRUE; break; #ifdef DLL_SUPPORT case OPTION_OUT_DEF: @@ -1470,7 +1471,7 @@ gld_${EMULATION_NAME}_after_open (void) pe_data (link_info.output_bfd)->pe_opthdr = pe; pe_data (link_info.output_bfd)->dll = init[DLLOFF].value; pe_data (link_info.output_bfd)->real_flags |= real_flags; - pe_data (link_info.output_bfd)->insert_timestamp = insert_timestamp; + pe_data (link_info.output_bfd)->strip_timestamp = strip_timestamp; /* At this point we must decide whether to use long section names in the output or not. If the user hasn't explicitly specified diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 6e3ecd8..c4f846b 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -147,7 +147,7 @@ static flagword real_flags = IMAGE_FILE_LARGE_ADDRESS_AWARE; static int support_old_code = 0; static lang_assignment_statement_type *image_base_statement = 0; static unsigned short pe_dll_characteristics = 0; -static bfd_boolean insert_timestamp = FALSE; +static bfd_boolean strip_timestamp = FALSE; static const char *emit_build_id; #ifdef DLL_SUPPORT @@ -244,9 +244,9 @@ enum options OPTION_NO_SEH, OPTION_NO_BIND, OPTION_WDM_DRIVER, - OPTION_INSERT_TIMESTAMP, OPTION_TERMINAL_SERVER_AWARE, - OPTION_BUILD_ID + OPTION_BUILD_ID, + OPTION_STRIP_TIMESTAMP }; static void @@ -321,8 +321,8 @@ gld${EMULATION_NAME}_add_options {"no-bind", no_argument, NULL, OPTION_NO_BIND}, {"wdmdriver", no_argument, NULL, OPTION_WDM_DRIVER}, {"tsaware", no_argument, NULL, OPTION_TERMINAL_SERVER_AWARE}, - {"insert-timestamp", no_argument, NULL, OPTION_INSERT_TIMESTAMP}, {"build-id", optional_argument, NULL, OPTION_BUILD_ID}, + {"strip-timestamp", no_argument, NULL, OPTION_STRIP_TIMESTAMP}, {NULL, no_argument, NULL, 0} }; @@ -409,8 +409,9 @@ gld_${EMULATION_NAME}_list_options (FILE *file) fprintf (file, _(" --subsystem [:] Set required OS subsystem [& version]\n")); fprintf (file, _(" --support-old-code Support interworking with old code\n")); fprintf (file, _(" --[no-]leading-underscore Set explicit symbol underscore prefix mode\n")); - fprintf (file, _(" --insert-timestamp Use a real timestamp rather than zero.\n")); - fprintf (file, _(" This makes binaries non-deterministic\n")); + fprintf (file, _(" --strip-timestamp Strip real timestamp\n")); + fprintf (file, _(" This makes binaries deterministic but\n")); + fprintf (file, _(" breaks bound import compatibility.\n")); #ifdef DLL_SUPPORT fprintf (file, _(" --add-stdcall-alias Export symbols with and without @nn\n")); fprintf (file, _(" --disable-stdcall-fixup Don't link _sym to _sym@nn\n")); @@ -718,8 +719,8 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_LEADING_UNDERSCORE: pep_leading_underscore = 1; break; - case OPTION_INSERT_TIMESTAMP: - insert_timestamp = TRUE; + case OPTION_STRIP_TIMESTAMP: + strip_timestamp = TRUE; break; #ifdef DLL_SUPPORT case OPTION_OUT_DEF: @@ -1428,7 +1429,7 @@ gld_${EMULATION_NAME}_after_open (void) pe_data (link_info.output_bfd)->pe_opthdr = pep; pe_data (link_info.output_bfd)->dll = init[DLLOFF].value; pe_data (link_info.output_bfd)->real_flags |= real_flags; - pe_data (link_info.output_bfd)->insert_timestamp = insert_timestamp; + pe_data (link_info.output_bfd)->strip_timestamp = strip_timestamp; /* At this point we must decide whether to use long section names in the output or not. If the user hasn't explicitly specified diff --git a/ld/ld.texinfo b/ld/ld.texinfo index e3d0469..977648e 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -2663,11 +2663,10 @@ The driver uses the MS Windows Driver Model. @item --tsaware The image is Terminal Server aware. -@kindex --insert-timestamp -@item --insert-timestamp -Insert a real timestamp into the image, rather than the default value -of zero. This will result in a slightly different results with each -invocation, which could be helpful for distributing unique images. +@kindex --strip-timestamp +@item --strip-timestamp +Strip real timestamp from the image. This could be helpful for distributing +unique images, but will fail to be loaded if bound to another image. @end table @c man end diff --git a/ld/pe-dll.c b/ld/pe-dll.c index d38f30d..ba6f22d 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1184,7 +1184,7 @@ fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED) memset (edata_d, 0, edata_sz); - if (pe_data (abfd)->insert_timestamp) + if (!pe_data (abfd)->strip_timestamp) H_PUT_32 (abfd, time (0), edata_d + 4); if (pe_def_file->version_major != -1)