summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-02-19 07:37:01 +0000
committerwpaul <wpaul@FreeBSD.org>2005-02-19 07:37:01 +0000
commit2bf0bec3d5b7df87e84054e2c5c25914553691be (patch)
treeceebc0c440d337ce81211c20a78df58669e59070
parent5cbf47b7d15fd079636e1ad76d50c7d4ce8e3f08 (diff)
downloadFreeBSD-src-2bf0bec3d5b7df87e84054e2c5c25914553691be.zip
FreeBSD-src-2bf0bec3d5b7df87e84054e2c5c25914553691be.tar.gz
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.
-rw-r--r--usr.sbin/ndiscvt/ndiscvt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.sbin/ndiscvt/ndiscvt.c b/usr.sbin/ndiscvt/ndiscvt.c
index b7a3d5c..090f083 100644
--- a/usr.sbin/ndiscvt/ndiscvt.c
+++ b/usr.sbin/ndiscvt/ndiscvt.c
@@ -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);
OpenPOWER on IntegriCloud