Index: objcopy.c =================================================================== RCS file: /cvs/src/src/binutils/objcopy.c,v retrieving revision 1.51 diff -c -3 -p -r1.51 objcopy.c *** objcopy.c 27 Jun 2003 08:01:28 -0000 1.51 --- objcopy.c 4 Jul 2003 21:18:19 -0000 *************** static struct section_add *add_sections; *** 224,229 **** --- 224,233 ---- This should be the filename to store in the .gnu_debuglink section. */ static const char * gnu_debuglink_filename = NULL; + /* If non zero the argument to --set-debuglink-timestamp. + This should be the value to store in the .gnu_debuglink_timestamp */ + static unsigned long int gnu_debuglink_timestamp; + /* Whether to convert debugging information. */ static bfd_boolean convert_debugging = FALSE; *************** static char *prefix_alloc_sections_strin *** 286,291 **** --- 290,296 ---- #define OPTION_FORMATS_INFO (OPTION_PREFIX_ALLOC_SECTIONS + 1) #define OPTION_ADD_GNU_DEBUGLINK (OPTION_FORMATS_INFO + 1) #define OPTION_ONLY_KEEP_DEBUG (OPTION_ADD_GNU_DEBUGLINK + 1) + #define OPTION_SET_DEBUGLINK_TIMESTAMP (OPTION_ONLY_KEEP_DEBUG + 1) /* Options to handle if running as "strip". */ *************** static struct option copy_options[] = *** 371,376 **** --- 376,382 ---- {"set-start", required_argument, 0, OPTION_SET_START}, {"srec-len", required_argument, 0, OPTION_SREC_LEN}, {"srec-forceS3", no_argument, 0, OPTION_SREC_FORCES3}, + {"set-debuglink-timestamp", required_argument, 0, OPTION_SET_DEBUGLINK_TIMESTAMP}, {"strip-all", no_argument, 0, 'S'}, {"strip-debug", no_argument, 0, 'g'}, {"strip-unneeded", no_argument, 0, OPTION_STRIP_UNNEEDED}, *************** copy_object (ibfd, obfd) *** 1133,1138 **** --- 1139,1145 ---- long symcount; asection **osections = NULL; asection * gnu_debuglink_section = NULL; + asection * gnu_debuglink_timestamp_section = NULL; bfd_size_type *gaps = NULL; bfd_size_type max_gap = 0; long symsize; *************** copy_object (ibfd, obfd) *** 1258,1263 **** --- 1265,1280 ---- RETURN_NONFATAL (gnu_debuglink_filename); } } + else if (gnu_debuglink_timestamp) { + gnu_debuglink_timestamp_section = + bfd_create_gnu_debuglink_timestamp_section (obfd); + + if (gnu_debuglink_timestamp_section == NULL) + { + fprintf (stderr, "UGG A\n"); + RETURN_NONFATAL ("Unable to create gnu_debuglink_timestamp section"); + } + } if (gap_fill_set || pad_to_set) { *************** copy_object (ibfd, obfd) *** 1421,1434 **** if (gnu_debuglink_filename != NULL) { ! if (! bfd_fill_in_gnu_debuglink_section ! (obfd, gnu_debuglink_section, gnu_debuglink_filename)) { fprintf (stderr, "UGG 2\n"); RETURN_NONFATAL (gnu_debuglink_filename); } } if (gap_fill_set || pad_to_set) { bfd_byte *buf; --- 1438,1462 ---- if (gnu_debuglink_filename != NULL) { ! if (! bfd_fill_in_gnu_debuglink_section (obfd, gnu_debuglink_section, ! gnu_debuglink_filename, ! gnu_debuglink_timestamp)) { fprintf (stderr, "UGG 2\n"); RETURN_NONFATAL (gnu_debuglink_filename); } } + if (gnu_debuglink_timestamp_section) + { + if (! bfd_fill_in_gnu_debuglink_timestamp_section + (obfd, gnu_debuglink_timestamp_section, gnu_debuglink_timestamp)) + { + fprintf (stderr, "UGG 3\n"); + RETURN_NONFATAL ("Unable to fill gnu_debuglink_timestamp section"); + } + } + if (gap_fill_set || pad_to_set) { bfd_byte *buf; *************** copy_main (argc, argv) *** 2458,2463 **** --- 2486,2495 ---- case OPTION_ADD_GNU_DEBUGLINK: gnu_debuglink_filename = optarg; + break; + + case OPTION_SET_DEBUGLINK_TIMESTAMP: + gnu_debuglink_timestamp = atoi(optarg); break; case 'K':