From 5b6aee2a90b337856aa23fd24a4637f488929ed0 Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Mon, 13 Aug 2012 22:10:14 +0200 Subject: Import Dev86src-0.16.19.tar.gz --- ld/catimage.c | 23 ++++++++++++++--------- ld/dumps.c | 1 + ld/mkar.c | 1 + ld/objchop.c | 4 ++++ ld/type.h | 3 +++ ld/x86_aout.h | 7 +++++++ 6 files changed, 30 insertions(+), 9 deletions(-) (limited to 'ld') 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 +#ifdef __STDC__ +#include +#include +#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 #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 +#ifdef __STDC__ +#include +#include +#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 +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 */ -- cgit v1.2.1