summaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2012-08-13 22:10:14 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:48:50 +0200
commit5b6aee2a90b337856aa23fd24a4637f488929ed0 (patch)
tree10d49ef991ff9fa563f71a9fd022614ddeea5fe6 /ld
parentdddc44a59e3e393d5440a06e2b0535aeb1304f77 (diff)
downloaddev86-5b6aee2a90b337856aa23fd24a4637f488929ed0.tar.gz
Import Dev86src-0.16.19.tar.gzv0.16.19
Diffstat (limited to 'ld')
-rw-r--r--ld/catimage.c23
-rw-r--r--ld/dumps.c1
-rw-r--r--ld/mkar.c1
-rw-r--r--ld/objchop.c4
-rw-r--r--ld/type.h3
-rw-r--r--ld/x86_aout.h7
6 files changed, 30 insertions, 9 deletions
diff --git a/ld/catimage.c b/ld/catimage.c
index 7d5c7a0..1f5e160 100644
--- a/ld/catimage.c
+++ b/ld/catimage.c
@@ -21,6 +21,10 @@
*/
#include <stdio.h>
+#ifdef __STDC__
+#include <unistd.h>
+#include <stdlib.h>
+#endif
#include "x86_aout.h"
#ifndef __OUT_OK
@@ -144,18 +148,19 @@ long file_off;
int value;
{
char wbuf[4];
- if( file_off <= 0 ) return;
-
- printf("Patch at offset 0x%05lx = %04x\n", file_off, value);
+ if( file_off > 0 )
+ {
+ printf("Patch at offset 0x%05lx = %04x\n", file_off, value);
- wbuf[0] = value;
- wbuf[0] = (value>>8);
+ wbuf[0] = value;
+ wbuf[0] = (value>>8);
- if( fseek(ofd, file_off, 0) < 0 )
- fatal("Cannot seek to patch binary");
+ if( fseek(ofd, file_off, 0) < 0 )
+ fatal("Cannot seek to patch binary");
- if( fwrite(wbuf, 1, 2, ofd) != 2 )
- fatal("Error patching output file");
+ if( fwrite(wbuf, 1, 2, ofd) != 2 )
+ fatal("Error patching output file");
+ }
}
read_symtable()
diff --git a/ld/dumps.c b/ld/dumps.c
index 4732017..10879b7 100644
--- a/ld/dumps.c
+++ b/ld/dumps.c
@@ -2,6 +2,7 @@
/* Copyright (C) 1994 Bruce Evans */
+#include "syshead.h"
#include "const.h"
#include "obj.h"
#include "type.h"
diff --git a/ld/mkar.c b/ld/mkar.c
index 8c4eb5b..da91456 100644
--- a/ld/mkar.c
+++ b/ld/mkar.c
@@ -10,6 +10,7 @@
#include <malloc.h>
#endif
+#include "type.h"
#include "ar.h"
static struct ar_hdr arbuf;
diff --git a/ld/objchop.c b/ld/objchop.c
index 8defc13..c7631c1 100644
--- a/ld/objchop.c
+++ b/ld/objchop.c
@@ -1,5 +1,9 @@
#include <stdio.h>
+#ifdef __STDC__
+#include <unistd.h>
+#include <stdlib.h>
+#endif
#include "x86_aout.h"
#ifndef __OUT_OK
diff --git a/ld/type.h b/ld/type.h
index 950446f..5301b6f 100644
--- a/ld/type.h
+++ b/ld/type.h
@@ -171,3 +171,6 @@ void write_elks P((char *outfilename, bool_pt argsepid, bool_pt argbits32,
/* linksym.c */
void linksyms P((bool_pt argreloc_output));
+
+/* mkar.c */
+void ld86r P((int argc, char ** argv));
diff --git a/ld/x86_aout.h b/ld/x86_aout.h
index 45bf0c7..542a70d 100644
--- a/ld/x86_aout.h
+++ b/ld/x86_aout.h
@@ -13,8 +13,15 @@
typedef long Long;
#define __OUT_OK 1
#else
+/* Beware: this will probably allow some BE hosts to generate broken files. */
+#ifdef INT32_MAX
+#include <stdint.h>
+typedef int32_t Long;
+#define __OUT_OK 1
+#else
typedef char Long[4];
#endif
+#endif
struct exec { /* a.out header */
unsigned char a_magic[2]; /* magic number */