aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ndiscvt/ndiscvt.c
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>2005-02-19 07:37:01 +0000
committerBill Paul <wpaul@FreeBSD.org>2005-02-19 07:37:01 +0000
commit4771e0f35bc7ca05e98de843ca7c5f8d88b0d9ca (patch)
treeceebc0c440d337ce81211c20a78df58669e59070 /usr.sbin/ndiscvt/ndiscvt.c
parentd5128ab2af6cedd2779df83b9e0b235fea5ce18a (diff)
downloadsrc-4771e0f35bc7ca05e98de843ca7c5f8d88b0d9ca.tar.gz
src-4771e0f35bc7ca05e98de843ca7c5f8d88b0d9ca.zip
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.
Notes
Notes: svn path=/head/; revision=142075
Diffstat (limited to 'usr.sbin/ndiscvt/ndiscvt.c')
-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 b7a3d5c7db72..090f0834f660 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);