• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版617cd5714278da0e0c57cce0f2f0c748f821788d (tree)
时间1991-03-27 05:52:21
作者Steve Chamberlain <steve@cygn...>
CommiterSteve Chamberlain

Log Message

Now returns correct status.

更改概述

差异

--- a/binutils/copy.c
+++ b/binutils/copy.c
@@ -203,38 +203,36 @@ bfd *obfd;
203203 }
204204
205205 static
206-boolean
206+void
207207 copy_file(input_filename, output_filename)
208208 char *input_filename;
209209 char *output_filename;
210210 {
211- bfd *ibfd;
211+ bfd *ibfd;
212212
213+ ibfd = bfd_openr(input_filename, input_target);
214+ if (ibfd == NULL)
215+ bfd_fatal(input_filename);
213216
214- ibfd = bfd_openr(input_filename, input_target);
215- if (ibfd == NULL)
216- bfd_fatal(input_filename);
217+ if (bfd_check_format(ibfd, bfd_object)) {
218+ bfd * obfd = bfd_openw(output_filename, output_target);
219+ if (obfd == NULL)
220+ bfd_fatal(output_filename);
217221
218- if (bfd_check_format(ibfd, bfd_object)) {
219- bfd * obfd = bfd_openw(output_filename, output_target);
220- if (obfd == NULL)
221- bfd_fatal(output_filename);
222-
223- copy_object(ibfd, obfd);
224-
225- if (!bfd_close(obfd))
226- bfd_fatal(output_filename);
222+ copy_object(ibfd, obfd);
227223
228- if (!bfd_close(ibfd))
229- bfd_fatal(input_filename);
230- }
231- else if (bfd_check_format(ibfd, bfd_archive)) {
232- bfd * obfd = bfd_openw(output_filename, output_target);
233- if (obfd == NULL)
234- bfd_fatal(output_filename);
224+ if (!bfd_close(obfd))
225+ bfd_fatal(output_filename);
235226
236- copy_archive(ibfd, obfd);
237- }
227+ if (!bfd_close(ibfd))
228+ bfd_fatal(input_filename);
229+ }
230+ else if (bfd_check_format(ibfd, bfd_archive)) {
231+ bfd * obfd = bfd_openw(output_filename, output_target);
232+ if (obfd == NULL)
233+ bfd_fatal(output_filename);
234+ copy_archive(ibfd, obfd);
235+ }
238236 }
239237
240238
@@ -313,13 +311,17 @@ copy_sections(ibfd, isection, obfd)
313311 if (size == 0)
314312 return;
315313
316- if (get_reloc_upper_bound(ibfd, isection) != 0) {
314+ if (strip == false && get_reloc_upper_bound(ibfd, isection) != 0) {
317315 relpp = (arelent **) xmalloc(get_reloc_upper_bound(ibfd, isection));
318316
319317 relcount = bfd_canonicalize_reloc(ibfd, isection, relpp, sympp);
320318
321319 bfd_set_reloc(obfd, osection, relpp, relcount);
322320 }
321+ else {
322+ bfd_set_reloc(obfd, osection, (arelent **)NULL, 0);
323+ }
324+
323325
324326 if (bfd_get_section_flags(ibfd, isection) & SEC_HAS_CONTENTS) {
325327 memhunk = (unsigned char *) xmalloc(size);
@@ -338,73 +340,67 @@ main(argc, argv)
338340 int argc;
339341 char *argv[];
340342 {
341- int i;
342-
343-
344- program_name = argv[0];
345-
346- if (strcmp(program_name,"strip") == 0) {
347- strip = true;
348- }
349-
350- for (i = 1; i < argc; i++)
351- {
352- if (argv[i][0] == '-') {
353- switch (argv[i][1]) {
354- case 'v':
355- verbose = true;
356- break;
357- case 'b':
358- i++;
359- input_target = output_target = argv[i];
360- break;
361- case 'S':
362- strip = true;
363- break;
364- case 's':
365- i++;
366- input_target = argv[i];
367- break;
368- case 'd':
369- i++;
370- output_target = argv[i];
371- break;
372- default:
373- usage();
374- }
375- }
376- else {
377- if (input_filename) {
378- output_filename = argv[i];
379- }
380- else {
381- input_filename = argv[i];
382- }
383- }
343+ int i;
344+
345+ program_name = argv[0];
346+
347+ if (strcmp(program_name,"strip") == 0) {
348+ strip = true;
349+ }
350+
351+ for (i = 1; i < argc; i++)
352+ {
353+ if (argv[i][0] == '-') {
354+ switch (argv[i][1]) {
355+ case 'v':
356+ verbose = true;
357+ break;
358+ case 'b':
359+ i++;
360+ input_target = output_target = argv[i];
361+ break;
362+ case 'S':
363+ strip = true;
364+ break;
365+ case 's':
366+ i++;
367+ input_target = argv[i];
368+ break;
369+ case 'd':
370+ i++;
371+ output_target = argv[i];
372+ break;
373+ default:
374+ usage();
384375 }
385-
386- if (input_filename == (char *) NULL)
387- usage();
388-
389- if (output_target == (char *) NULL)
390- output_target = input_target;
391-
392- /* If there is no destination file then create a temp and rename
393- the result into the input */
394-
395- if (output_filename == (char *)NULL) {
396- char * tmpname = make_tempname(input_filename);
397- if (copy_file(input_filename, tmpname)) {
398- output_filename = input_filename;
399- rename(tmpname, input_filename);
400- return 0;
376+ }
377+ else {
378+ if (input_filename) {
379+ output_filename = argv[i];
401380 }
402- }
403- else if (copy_file(input_filename, output_filename))
404- {
405- return 0;
381+ else {
382+ input_filename = argv[i];
406383 }
384+ }
385+ }
386+
387+ if (input_filename == (char *) NULL)
388+ usage();
389+
390+ if (output_target == (char *) NULL)
391+ output_target = input_target;
407392
393+ /* If there is no destination file then create a temp and rename
394+ the result into the input */
408395
396+ if (output_filename == (char *)NULL) {
397+ char * tmpname = make_tempname(input_filename);
398+ copy_file(input_filename, tmpname);
399+ output_filename = input_filename;
400+ rename(tmpname, input_filename);
401+ }
402+ else {
403+ copy_file(input_filename, output_filename);
404+ }
409405 return 1;
410406 }