if (storage_needed == 0)
return NULL;
- symbol_table = (asymbol **) malloc (storage_needed);
- if (symbol_table == NULL) {
- perror("malloc");
- exit(1);
- }
+ symbol_table = xmalloc (storage_needed);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
}
symb = get_symbols(rel_bfd, &nsymb);
- relpp = (arelent **) malloc(relsize);
- if (relpp == NULL) {
- perror("malloc");
- exit(1);
- }
+ relpp = xmalloc(relsize);
relcount = bfd_canonicalize_reloc(rel_bfd, r, relpp, symb);
if (relcount <= 0) {
give an error by default, and
require `safe' relocations to be
enumberated explicitly?). */
- goto good_32bit_resolve_reloc;
+ goto good_32bit_resolved_reloc;
#endif
good_32bit_resolved_reloc:
if (bfd_big_endian (abs_bfd))
#ifdef TARGET_nios2
#define htoniosl(x) (x)
#define niostohl(x) (x)
- switch ((*p)->howto->type)
- {
case R_NIOS2_BFD_RELOC_32:
relocation_needed = 1;
pflags = (FLAT_NIOS2_R_32 << 28);
printf("Err: unexpected reloc type %s(%d)\n", q->howto->name, q->howto->type);
bad_relocs++;
continue;
- }
#endif /* TARGET_nios2 */
#ifdef TARGET_sparc
program = argv[0];
progname = argv[0];
+ xmalloc_set_program_name(program);
if (argc < 2)
usage();
use_resolved = 1;
break;
case 's':
- stack = atoi(optarg);
+ if (sscanf(optarg, "%i", &stack) != 1) {
+ fprintf(stderr, "%s invalid stack size %s\n", argv[0], optarg);
+ usage();
+ }
break;
case 'R':
rel_file = optarg;
exit (2);
}
- text = malloc(text_len);
- if (text == NULL) {
- perror("malloc");
- exit(1);
- }
+ text = xmalloc(text_len);
if (verbose)
printf("TEXT -> vma=0x%x len=0x%x\n", text_vma, text_len);
fprintf (stderr, "%s: no .data section", abs_file);
exit (2);
}
- data = malloc(data_len);
- if (data == NULL) {
- perror("malloc");
- exit(1);
- }
+ data = xmalloc(data_len);
if (verbose)
printf("DATA -> vma=0x%x len=0x%x\n", data_vma, data_len);
}
if (!ofile) {
- ofile = malloc(strlen(fname) + 5 + 1); /* 5 to add suffix */
- if (ofile == NULL) {
- perror("malloc");
- exit(1);
- }
+ ofile = xmalloc(strlen(fname) + 5 + 1); /* 5 to add suffix */
strcpy(ofile, fname);
strcat(ofile, ".bflt");
}