summaryrefslogtreecommitdiff
path: root/sbin/modload/modload.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-11 11:46:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-11 11:46:10 +0000
commit18a9f196ff03d0aeb2d15a921f1bf85add4952bb (patch)
tree93c88092b4181bc16569dfdc98f23685c0ff315c /sbin/modload/modload.c
parent5eedbd00ef4cb4a9d8179b10b1f8140ccf0e1172 (diff)
support the binutils ld
Diffstat (limited to 'sbin/modload/modload.c')
-rw-r--r--sbin/modload/modload.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c
index 68099079c5f..cbc88f69863 100644
--- a/sbin/modload/modload.c
+++ b/sbin/modload/modload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modload.c,v 1.14 1997/08/24 08:07:02 downsj Exp $ */
+/* $OpenBSD: modload.c,v 1.15 1997/09/11 11:46:09 deraadt Exp $ */
/* $NetBSD: modload.c,v 1.13 1995/05/28 05:21:58 jtc Exp $ */
/*
@@ -69,6 +69,16 @@ int symtab = 1;
int quiet = 0;
int dounlink = 0;
+#if defined(__alpha) || defined(__mips)
+#define LDSYMTABLE "-R"
+#define LDTEXTSTART "-Ttext"
+#define LDSYMPREFIX ""
+#else
+#define LDSYMTABLE "-R"
+#define LDTEXTSTART "-Ttext"
+#define LDSYMPREFIX ""
+#endif
+
void
linkcmd(kernel, entry, outfile, address, object)
char *kernel, *entry, *outfile;
@@ -79,21 +89,20 @@ linkcmd(kernel, entry, outfile, address, object)
pid_t pid;
int status;
- snprintf(entrybuf, sizeof entrybuf, "_%s", entry);
+ snprintf(entrybuf, sizeof entrybuf, "%s%s", LDSYMPREFIX, entry);
snprintf(addrbuf, sizeof addrbuf, "%x", address);
if (debug)
- printf("%s -A %s -e %s -o %s -T %s %s\n",
- _PATH_LD, kernel, entrybuf, outfile,
- addrbuf, object);
-
+ printf("%s %s %s -e %s -o %s %s %s %s\n",
+ _PATH_LD, LDSYMTABLE, kernel, entrybuf,
+ outfile, LDTEXTSTART, addrbuf, object);
if ((pid = fork()) < 0)
err(18, "fork");
if(pid == 0) {
- execl(_PATH_LD, "ld", "-A", kernel, "-e", entrybuf, "-o",
- outfile, "-T", addrbuf, object, NULL);
+ execl(_PATH_LD, "ld", LDSYMTABLE, kernel, "-e", entrybuf, "-o",
+ outfile, LDTEXTSTART, addrbuf, object, NULL);
exit(128 + errno);
}
@@ -179,7 +188,7 @@ main(argc, argv)
struct stat stb;
u_int modsize; /* XXX */
u_int modentry; /* XXX */
- struct nlist nl, *nlp;
+ struct nlist *nlp;
int strtablen, numsyms;
struct lmc_loadbuf ldbuf;
@@ -501,7 +510,7 @@ main(argc, argv)
err(15, "error fetching module stats for post-install");
sprintf(id, "%d", sbuf.id);
sprintf(type, "0x%x", sbuf.type);
- sprintf(offset, "%d", sbuf.offset);
+ sprintf(offset, "%lx", sbuf.offset);
/*
* XXX
* The modload docs say that drivers can install bdevsw &