Fix a small bug in firmcvt: outfile must be strdup()ed.

Also, add conditional code to allow different invokations for objcopy
depending on whether we're compiled on an i386 arch or amd64 arch, so
that we can produce x86-64 object files on amd64.
This commit is contained in:
Bill Paul 2005-02-19 07:37:01 +00:00
parent d5128ab2af
commit 4771e0f35b

View File

@ -188,7 +188,12 @@ bincvt(char *sysfile, char *outfile, void *img, int fsize)
*strchr(outfile, '.') = '\0';
snprintf(sysbuf, sizeof(sysbuf),
#ifdef __i386__
"objcopy -I binary -O elf32-i386-freebsd -B i386 %s %s.o\n",
#endif
#ifdef __amd64__
"objcopy -I binary -O elf64-x86-64 -B i386 %s %s.o\n",
#endif
tname, outfile);
printf("%s", sysbuf);
system(sysbuf);
@ -218,11 +223,16 @@ firmcvt(char *firmfile)
char *basefile, *outfile, *ptr;
char sysbuf[1024];
outfile = basename(firmfile);
outfile = strdup(basename(firmfile));
basefile = strdup(outfile);
snprintf(sysbuf, sizeof(sysbuf),
#ifdef __i386__
"objcopy -I binary -O elf32-i386-freebsd -B i386 %s %s.o\n",
#endif
#ifdef __amd64__
"objcopy -I binary -O elf64-x86-64 -B i386 %s %s.o\n",
#endif
firmfile, outfile);
printf("%s", sysbuf);
system(sysbuf);