Merge branch 'default' into kernigh-linuxppc
This merges several fixes and improvements from upstream. This
includes commit 5f6a773
to turn off qemuppc. I see several failing
tests from qemuppc; this merge will hide the test failures.
This commit is contained in:
commit
d6e9eac785
21
.travis.yml
21
.travis.yml
|
@ -1,16 +1,29 @@
|
|||
language: c
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
-
|
||||
os: linux
|
||||
sudo: false
|
||||
dist: trusty
|
||||
compiler: gcc
|
||||
-
|
||||
os: linux
|
||||
sudo: false
|
||||
dist: trusty
|
||||
compiler: clang
|
||||
# -
|
||||
# os: osx
|
||||
# env: HOMEBREW_NO_AUTO_UPDATE=1
|
||||
# compiler: clang
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- ed
|
||||
- qemu-user
|
||||
|
||||
git:
|
||||
depth: 10
|
||||
language: c
|
||||
script:
|
||||
- make PREFIX=/tmp/acki
|
||||
- make PREFIX=/tmp/acki +ack
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ vars.plats = {
|
|||
"linuxppc",
|
||||
"osx386",
|
||||
"osxppc",
|
||||
"qemuppc",
|
||||
--"qemuppc",
|
||||
"pc86",
|
||||
"rpi",
|
||||
}
|
||||
vars.plats_with_tests = {
|
||||
"linux386",
|
||||
"linuxppc",
|
||||
"qemuppc",
|
||||
--"qemuppc",
|
||||
"pc86",
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,7 @@ definerule("cprogram",
|
|||
commands = {
|
||||
type="strings",
|
||||
default={
|
||||
"$(CC) -o %{outs[1]} -Wl,--start-group %{ins} -Wl,--end-group"
|
||||
"$(CC) -o %{outs[1]} %{ins} %{ins}"
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
|
@ -522,7 +522,7 @@ scanstring()
|
|||
yylval.integer= genemlabel();
|
||||
C_rom_dlb((label)i,(arith)0);
|
||||
C_rom_icon("9999",(arith)BEMINTSIZE);
|
||||
C_rom_icon(itoa(length),(arith)BEMINTSIZE);
|
||||
C_rom_icon(myitoa(length),(arith)BEMINTSIZE);
|
||||
}
|
||||
#ifdef YYDEBUG
|
||||
if (yydebug) print("STRVALUE found\n");
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
@ -71,13 +72,5 @@ extern int dataused;
|
|||
extern Linerecord *currline;
|
||||
|
||||
|
||||
extern char *itoa();
|
||||
extern char *myitoa();
|
||||
extern char *salloc();
|
||||
|
||||
extern char *strcpy();
|
||||
extern char *strcat();
|
||||
#if __STDC__
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
extern char *malloc();
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,7 @@ cprogram {
|
|||
matching(filenamesof("+llgen"), "%.c$"),
|
||||
},
|
||||
deps = {
|
||||
"./*.h",
|
||||
"+llgen",
|
||||
"+tokentab_h",
|
||||
"h+emheaders",
|
||||
|
|
|
@ -670,7 +670,7 @@ gendata()
|
|||
C_df_dnam("datfdes");
|
||||
C_rom_dnam("datfname",(arith)0);
|
||||
C_rom_cst((arith)1);
|
||||
C_rom_cst((arith)(itoa(strlen(datfname))));
|
||||
C_rom_cst((arith)(myitoa(strlen(datfname))));
|
||||
C_df_dnam("dattdes");
|
||||
C_rom_dnam("dattyp",(arith)0);
|
||||
C_rom_cst((arith)1);
|
||||
|
|
|
@ -69,7 +69,7 @@ illegalcmd()
|
|||
|
||||
|
||||
|
||||
char *itoa(i)
|
||||
char *myitoa(i)
|
||||
int i;
|
||||
{
|
||||
static char buf[30];
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
extern char *bts2str();
|
||||
extern char *symbol2str();
|
||||
extern char *strchr();
|
||||
|
||||
int stat_number = 9999; /* static scope number */
|
||||
struct outdef OutDef;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
extern struct idf *GetIdentifier();
|
||||
extern int InputLevel;
|
||||
struct repl *ReplaceList; /* list of currently active macros */
|
||||
extern char *strcat(), *strcpy();
|
||||
|
||||
void macro2buffer();
|
||||
void getactuals();
|
||||
|
|
|
@ -30,7 +30,6 @@ int LexSave = 0; /* last character read by GetChar */
|
|||
extern int InputLevel; /* # of current macro expansions */
|
||||
|
||||
extern char *string_token();
|
||||
extern char *strcpy();
|
||||
extern arith char_constant();
|
||||
#define FLG_ESEEN 0x01 /* possibly a floating point number */
|
||||
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include "replace.h"
|
||||
|
||||
extern char *GetIdentifier();
|
||||
extern char *strcpy();
|
||||
extern char *strcat();
|
||||
extern int InputLevel;
|
||||
struct repl *ReplaceList; /* list of currently active macros */
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ normalrule {
|
|||
}
|
||||
}
|
||||
|
||||
for _, f in ipairs(filenamesof("./*.H")) do
|
||||
local name = replace(basename(f), "%.H$", "")
|
||||
for _, f in ipairs(filenamesof("./*.xh")) do
|
||||
local name = replace(basename(f), "%.xh$", "")
|
||||
normalrule {
|
||||
name = name.."_h",
|
||||
ins = {
|
||||
|
@ -46,8 +46,8 @@ for _, f in ipairs(filenamesof("./*.H")) do
|
|||
}
|
||||
end
|
||||
|
||||
for _, f in ipairs(filenamesof("./*.C")) do
|
||||
local name = replace(basename(f), "%.C$", "")
|
||||
for _, f in ipairs(filenamesof("./*.xc")) do
|
||||
local name = replace(basename(f), "%.xc$", "")
|
||||
normalrule {
|
||||
name = name.."_c",
|
||||
ins = {
|
||||
|
@ -65,8 +65,8 @@ normalrule {
|
|||
name = "next_c",
|
||||
ins = {
|
||||
"./make.next",
|
||||
"./*.H",
|
||||
"./*.C",
|
||||
"./*.xh",
|
||||
"./*.xc",
|
||||
},
|
||||
outleaves = { "next.c" },
|
||||
commands = {
|
||||
|
|
|
@ -19,7 +19,7 @@ struct f_info file_info;
|
|||
#include <inp_pkg.body>
|
||||
|
||||
|
||||
AtEoIF()
|
||||
int AtEoIF(void)
|
||||
{
|
||||
/* Make the unstacking of input streams noticable to the
|
||||
lexical analyzer
|
||||
|
@ -28,7 +28,7 @@ AtEoIF()
|
|||
return 1;
|
||||
}
|
||||
|
||||
AtEoIT()
|
||||
int AtEoIT(void)
|
||||
{
|
||||
/* Make the end of the text noticable
|
||||
*/
|
||||
|
|
|
@ -19,11 +19,6 @@ Implementation modules and program modules must reside in files having a
|
|||
.PP
|
||||
The name of the file in which a definition module is stored must be the same as
|
||||
the module-name, apart from the extension.
|
||||
Also, in most Unix systems filenames are only 14 characters long.
|
||||
So, given an IMPORT declaration for a module called "LongModulName",
|
||||
the compiler will try to open a file called "LongModulN.def".
|
||||
The requirement does not hold for implementation or program modules,
|
||||
but is certainly recommended.
|
||||
.SH CALLING THE COMPILER
|
||||
The easiest way to do this is to let the \fIack\fR(1) program do it.
|
||||
So, to compile a program module "prog.mod", just call
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
/* $Id$ */
|
||||
|
||||
#include <string.h>
|
||||
#include <alloc.h>
|
||||
|
||||
#include "input.h"
|
||||
|
@ -27,8 +28,6 @@ int nDEF, mDEF;
|
|||
struct file_list *CurrentArg;
|
||||
extern int err_occurred;
|
||||
extern int Roption;
|
||||
extern char *strrchr();
|
||||
extern char *strcpy(), *strcat();
|
||||
|
||||
char *
|
||||
basename(s)
|
||||
|
|
|
@ -355,7 +355,7 @@ void zgt(lab) int lab; { C_zgt((label) lab); }
|
|||
void zlt(lab) int lab; { C_zlt((label) lab); }
|
||||
void zne(lab) int lab; { C_zne((label) lab); }
|
||||
|
||||
char *itoa(i) long i;
|
||||
char *myitoa(i) long i;
|
||||
{
|
||||
static char a[sizeof(long)*3];
|
||||
sprint(a, "%ld", i);
|
||||
|
@ -364,7 +364,7 @@ char *itoa(i) long i;
|
|||
|
||||
void rom(size, c) int size; long c;
|
||||
{
|
||||
C_rom_icon(itoa(c), (arith) size);
|
||||
C_rom_icon(myitoa(c), (arith) size);
|
||||
}
|
||||
|
||||
void lin()
|
||||
|
|
|
@ -31,8 +31,8 @@ normalrule {
|
|||
}
|
||||
}
|
||||
|
||||
for _, f in ipairs(filenamesof("./*.H")) do
|
||||
local name = replace(basename(f), "%.H$", "")
|
||||
for _, f in ipairs(filenamesof("./*.xh")) do
|
||||
local name = replace(basename(f), "%.xh$", "")
|
||||
normalrule {
|
||||
name = name.."_h",
|
||||
ins = {
|
||||
|
@ -46,8 +46,8 @@ for _, f in ipairs(filenamesof("./*.H")) do
|
|||
}
|
||||
end
|
||||
|
||||
for _, f in ipairs(filenamesof("./*.C")) do
|
||||
local name = replace(basename(f), "%.C$", "")
|
||||
for _, f in ipairs(filenamesof("./*.xc")) do
|
||||
local name = replace(basename(f), "%.xc$", "")
|
||||
normalrule {
|
||||
name = name.."_c",
|
||||
ins = {
|
||||
|
@ -65,8 +65,8 @@ normalrule {
|
|||
name = "next_c",
|
||||
ins = {
|
||||
"./make.next",
|
||||
"./*.H",
|
||||
"./*.C",
|
||||
"./*.xh",
|
||||
"./*.xc",
|
||||
},
|
||||
outleaves = { "next.c" },
|
||||
commands = {
|
||||
|
|
|
@ -363,7 +363,8 @@ char *path, *tail;
|
|||
if ((dir = getenv("TMPDIR")) == NULL)
|
||||
dir = tmp_dir;
|
||||
sprintf(path, "%s/%s", dir, tail);
|
||||
return(ffcreat(mktemp(path)));
|
||||
close(mkstemp(path));
|
||||
return(ffcreat(path));
|
||||
}
|
||||
|
||||
/* ---------- Error handling ---------- */
|
||||
|
|
|
@ -4,5 +4,9 @@
|
|||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef _MODULES_H_EM_LABEL_H
|
||||
#define _MODULES_H_EM_LABEL_H
|
||||
|
||||
typedef unsigned int label;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <em_path.h>
|
||||
#include <alloc.h>
|
||||
#include "insert.h"
|
||||
|
@ -134,8 +135,6 @@ C_findpart(part)
|
|||
return p;
|
||||
}
|
||||
|
||||
extern char *strcpy(), *strcat(), *mktemp();
|
||||
|
||||
static
|
||||
swttmp()
|
||||
{
|
||||
|
@ -146,7 +145,8 @@ swttmp()
|
|||
|
||||
strcpy(p, C_tmpdir);
|
||||
strcat(p, "/CodeXXXXXX");
|
||||
C_tmpfile = mktemp(p);
|
||||
close(mkstemp(p));
|
||||
C_tmpfile = p;
|
||||
if (! sys_open(p, OP_WRITE, &C_old_ofp)) {
|
||||
C_failed();
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ mkpart(part)
|
|||
*/
|
||||
register Part *p = C_findpart(part);
|
||||
register int index = part % TABSIZ;
|
||||
|
||||
|
||||
if (p != 0) {
|
||||
/* multiple defined part ... */
|
||||
C_internal_error();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inserted file.
|
||||
*/
|
||||
int
|
||||
AtEoIF()
|
||||
AtEoIF(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
inserted text.
|
||||
*/
|
||||
int
|
||||
AtEoIT()
|
||||
AtEoIT(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
A default one is provided, which does nothing.
|
||||
AtEoIF() : this routine is called at the end of an inserted file.
|
||||
A default one is provided, which does nothing.
|
||||
|
||||
|
||||
Imported objects are:
|
||||
INP_NPUSHBACK, INP_READ_IN_ONE, INP_TYPE, INP_VAR,
|
||||
routines from the "alloc" package, routines from the "storage"
|
||||
|
@ -110,7 +110,7 @@ INP_rdfile(fd, fn, size, pbuf)
|
|||
int rsize;
|
||||
|
||||
if (
|
||||
(*size = sys_filesize(fn)) < 0
|
||||
((*size = sys_filesize(fn))) < 0
|
||||
||
|
||||
((unsigned) (*size + 1) != (*size + 1))
|
||||
||
|
||||
|
@ -140,7 +140,7 @@ _PROTOTYPE(INP_PRIVATE char * INP_pbuf, (void));
|
|||
INP_PRIVATE char *
|
||||
INP_pbuf()
|
||||
{
|
||||
register struct INP_i_buf *ib =
|
||||
register struct INP_i_buf *ib =
|
||||
(struct INP_i_buf *) malloc(sizeof(struct INP_i_buf));
|
||||
|
||||
if (!ib) return 0;
|
||||
|
@ -164,7 +164,7 @@ INP_push_bh()
|
|||
{
|
||||
register struct INP_buffer_header *bh;
|
||||
|
||||
if (bh = INP_head) {
|
||||
if ((bh = INP_head)) {
|
||||
bh->bh_ipp = _ipp;
|
||||
#ifdef INP_TYPE
|
||||
bh->bh_i = INP_VAR;
|
||||
|
@ -247,10 +247,10 @@ INP_mk_filename(dir, file, newname)
|
|||
if (!dst) return 0;
|
||||
*newname = dst;
|
||||
if (*dir) {
|
||||
while (*dst++ = *dir++) ;
|
||||
while ((*dst++ = *dir++)) ;
|
||||
*(dst-1) = '/';
|
||||
}
|
||||
while (*dst++ = *file++);
|
||||
while ((*dst++ = *file++));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -278,13 +278,13 @@ InsertFile(filnam, table, result)
|
|||
if (!sys_open(filnam, OP_READ, &fd)) return 0;
|
||||
}
|
||||
else {
|
||||
while (*table) {
|
||||
while (*table) {
|
||||
/* look in the directory table */
|
||||
if (!INP_mk_filename(*table++, filnam, &newfn)) {
|
||||
return 0;
|
||||
}
|
||||
if (sys_open(newfn, OP_READ, &fd)) {
|
||||
/* free filnam ??? NO we don't know
|
||||
/* free filnam ??? NO we don't know
|
||||
where it comes from!
|
||||
*/
|
||||
filnam = newfn;
|
||||
|
@ -378,7 +378,7 @@ loadbuf()
|
|||
*--de = *--so;
|
||||
}
|
||||
#endif
|
||||
if ( INP_rdblock(bh->bh_fd, bh->bh_text, &(bh->bh_size))
|
||||
if ( INP_rdblock(bh->bh_fd, bh->bh_text, &(bh->bh_size))
|
||||
&&
|
||||
bh->bh_size > 0
|
||||
) {
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <local.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <out.h>
|
||||
#include <ranlib.h>
|
||||
#include <arch.h>
|
||||
|
|
|
@ -36,7 +36,7 @@ void rd_sect(struct outsect *s, unsigned int c);
|
|||
void rd_outsect(int sectno);
|
||||
void rd_emit(char *b, long c);
|
||||
void rd_relo(struct outrelo *r, unsigned int c);
|
||||
void rd_rew_relo(struct outhead *head);
|
||||
void rd_rew_relos(struct outhead *head);
|
||||
void rd_name(struct outname *n, unsigned int c);
|
||||
void rd_string(char *s, long c);
|
||||
int rd_arhdr(int fd, struct ar_hdr *a);
|
||||
|
|
|
@ -40,9 +40,7 @@ static long rd_base;
|
|||
static int sectionnr;
|
||||
|
||||
static void
|
||||
OUTREAD(p, b, n)
|
||||
char *b;
|
||||
long n;
|
||||
OUTREAD(int p, char* b, long n)
|
||||
{
|
||||
register long l = outseek[p];
|
||||
|
||||
|
@ -59,8 +57,7 @@ OUTREAD(p, b, n)
|
|||
* Open the output file according to the chosen strategy.
|
||||
*/
|
||||
int
|
||||
rd_open(f)
|
||||
char *f;
|
||||
rd_open(char* f)
|
||||
{
|
||||
|
||||
if ((outfile = open(f, 0)) < 0)
|
||||
|
@ -71,7 +68,7 @@ rd_open(f)
|
|||
static int offcnt;
|
||||
|
||||
int
|
||||
rd_fdopen(fd)
|
||||
rd_fdopen(int fd)
|
||||
{
|
||||
register int i;
|
||||
|
||||
|
@ -89,7 +86,7 @@ rd_fdopen(fd)
|
|||
}
|
||||
|
||||
void
|
||||
rd_close()
|
||||
rd_close(void)
|
||||
{
|
||||
|
||||
close(outfile);
|
||||
|
@ -97,21 +94,20 @@ rd_close()
|
|||
}
|
||||
|
||||
int
|
||||
rd_fd()
|
||||
rd_fd(void)
|
||||
{
|
||||
return outfile;
|
||||
}
|
||||
|
||||
void
|
||||
rd_ohead(head)
|
||||
register struct outhead *head;
|
||||
rd_ohead(struct outhead* head)
|
||||
{
|
||||
register long off;
|
||||
|
||||
OUTREAD(PARTEMIT, (char *) head, (long) SZ_HEAD);
|
||||
{
|
||||
register char *c = (char *) head + (SZ_HEAD-4);
|
||||
|
||||
|
||||
head->oh_nchar = get4(c);
|
||||
c -= 4; head->oh_nemit = get4(c);
|
||||
c -= 2; head->oh_nname = uget2(c);
|
||||
|
@ -134,8 +130,7 @@ rd_ohead(head)
|
|||
}
|
||||
|
||||
void
|
||||
rd_rew_relos(head)
|
||||
register struct outhead *head;
|
||||
rd_rew_relos(struct outhead* head)
|
||||
{
|
||||
register long off = OFF_RELO(*head) + rd_base;
|
||||
|
||||
|
@ -143,9 +138,7 @@ rd_rew_relos(head)
|
|||
}
|
||||
|
||||
void
|
||||
rd_sect(sect, cnt)
|
||||
register struct outsect *sect;
|
||||
register unsigned int cnt;
|
||||
rd_sect(struct outsect* sect, unsigned int cnt)
|
||||
{
|
||||
register char *c = (char *) sect + cnt * SZ_SECT;
|
||||
|
||||
|
@ -166,7 +159,7 @@ rd_sect(sect, cnt)
|
|||
}
|
||||
|
||||
void
|
||||
rd_outsect(s)
|
||||
rd_outsect(int s)
|
||||
{
|
||||
OUTSECT(s);
|
||||
sectionnr = s;
|
||||
|
@ -176,18 +169,14 @@ rd_outsect(s)
|
|||
* We don't have to worry about byte order here.
|
||||
*/
|
||||
void
|
||||
rd_emit(emit, cnt)
|
||||
char *emit;
|
||||
long cnt;
|
||||
rd_emit(char* emit, long cnt)
|
||||
{
|
||||
OUTREAD(PARTEMIT, emit, cnt);
|
||||
offset[sectionnr] += cnt;
|
||||
}
|
||||
|
||||
void
|
||||
rd_relo(relo, cnt)
|
||||
register struct outrelo *relo;
|
||||
register unsigned int cnt;
|
||||
rd_relo(struct outrelo* relo, unsigned int cnt)
|
||||
{
|
||||
|
||||
OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO);
|
||||
|
@ -206,9 +195,7 @@ rd_relo(relo, cnt)
|
|||
}
|
||||
|
||||
void
|
||||
rd_name(name, cnt)
|
||||
register struct outname *name;
|
||||
register unsigned int cnt;
|
||||
rd_name(struct outname* name, unsigned int cnt)
|
||||
{
|
||||
|
||||
OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME);
|
||||
|
@ -227,19 +214,15 @@ rd_name(name, cnt)
|
|||
}
|
||||
|
||||
void
|
||||
rd_string(addr, len)
|
||||
char *addr;
|
||||
long len;
|
||||
rd_string(char* addr, long len)
|
||||
{
|
||||
|
||||
|
||||
OUTREAD(PARTCHAR, addr, len);
|
||||
}
|
||||
|
||||
#ifdef SYMDBUG
|
||||
void
|
||||
rd_dbug(buf, size)
|
||||
char *buf;
|
||||
long size;
|
||||
rd_dbug(char* buf, long size)
|
||||
{
|
||||
OUTREAD(PARTDBUG, buf, size);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
*/
|
||||
/* $Id$ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "system.h"
|
||||
|
||||
int
|
||||
|
@ -12,7 +14,6 @@ sys_lock(path)
|
|||
{
|
||||
char buf[1024];
|
||||
char *tmpf = ".lockXXXXXX";
|
||||
char *strrchr(), *strcpy(), *mktemp();
|
||||
char *p;
|
||||
int ok, fd;
|
||||
|
||||
|
@ -23,8 +24,7 @@ sys_lock(path)
|
|||
}
|
||||
else
|
||||
strcpy(buf, tmpf);
|
||||
mktemp(buf);
|
||||
if ((fd = creat(buf, 0)) < 0)
|
||||
if ((fd = mkstemp(buf)) < 0)
|
||||
return 0;
|
||||
close(fd);
|
||||
ok = (link(buf, path) == 0);
|
||||
|
|
|
@ -25,7 +25,7 @@ return installable {
|
|||
map = {
|
||||
["$(PLATDEP)/linuxppc/as"] = "+as",
|
||||
["$(PLATDEP)/linuxppc/ncg"] = "+ncg",
|
||||
["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
|
||||
--["$(PLATDEP)/linuxppc/mcg"] = "+mcg",
|
||||
["$(PLATDEP)/linuxppc/top"] = "+top",
|
||||
["$(PLATIND)/descr/linuxppc"] = "./descr",
|
||||
"util/amisc+aelflod-pkg",
|
||||
|
|
|
@ -57,7 +57,6 @@ libpath(s) string s; {
|
|||
register string p;
|
||||
register length;
|
||||
p_mem alloc();
|
||||
string strcpy(), strcat();
|
||||
|
||||
char* libdir = getenv("LLGEN_LIB_DIR");
|
||||
if (!libdir)
|
||||
|
|
|
@ -37,7 +37,6 @@ extern fatal();
|
|||
extern comfatal();
|
||||
extern copyfile();
|
||||
extern void install();
|
||||
extern char *mktemp();
|
||||
extern char *sbrk();
|
||||
|
||||
main(argc,argv) register string argv[]; {
|
||||
|
@ -164,8 +163,8 @@ main(argc,argv) register string argv[]; {
|
|||
nc_rec_file = libpath ("nc_rec");
|
||||
}
|
||||
#endif
|
||||
mktemp(f_temp);
|
||||
mktemp(f_pars);
|
||||
close(mkstemp(f_temp));
|
||||
close(mkstemp(f_pars));
|
||||
if ((fact = fopen(f_temp,"w")) == NULL) {
|
||||
fputs("Cannot create temporary\n",stderr);
|
||||
exit(1);
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
char temp_name[] = "/tmp/sXXXXXX";
|
||||
char *tname;
|
||||
char *mktemp();
|
||||
FILE *fopen();
|
||||
FILE *tf;
|
||||
struct outhead buf;
|
||||
int readerror, writeerror;
|
||||
|
@ -31,12 +29,12 @@ char **argv;
|
|||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
tname = mktemp(temp_name);
|
||||
close(mkstemp(temp_name));
|
||||
while(--argc) {
|
||||
if ((status = strip(argv[argc])) > 1)
|
||||
break;
|
||||
}
|
||||
unlink(tname);
|
||||
unlink(temp_name);
|
||||
exit(status);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,10 +106,9 @@ char *progname;
|
|||
|
||||
char temp_buf[32];
|
||||
char *temp_arch = &temp_buf[0];
|
||||
extern char *mktemp();
|
||||
extern char *ctime();
|
||||
|
||||
void do_object();
|
||||
void do_object(int f, long size);
|
||||
void write_symdef();
|
||||
void add();
|
||||
|
||||
|
@ -184,7 +183,7 @@ register int mode;
|
|||
magic = rd_unsigned2(fd);
|
||||
if (magic != AALMAG && magic != ARMAG)
|
||||
error(TRUE, "%s is not in ar format\n", name);
|
||||
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
@ -206,7 +205,7 @@ char *argv[];
|
|||
|
||||
if (argc < 3)
|
||||
usage();
|
||||
|
||||
|
||||
for (ptr = argv[1]; *ptr; ptr++) {
|
||||
switch (*ptr) {
|
||||
case 't' :
|
||||
|
@ -268,7 +267,7 @@ char *argv[];
|
|||
|
||||
if (app_fl + ex_fl + del_fl + rep_fl + show_fl + pr_fl != 1)
|
||||
usage();
|
||||
|
||||
|
||||
if (u_fl && ! rep_fl)
|
||||
usage();
|
||||
|
||||
|
@ -277,7 +276,7 @@ char *argv[];
|
|||
|| app_fl
|
||||
#endif
|
||||
) {
|
||||
mktemp(temp_arch);
|
||||
close(mkstemp(temp_arch));
|
||||
}
|
||||
#ifdef AAL
|
||||
tab = (struct ranlib *) malloc(512 * sizeof(struct ranlib));
|
||||
|
@ -289,7 +288,7 @@ char *argv[];
|
|||
|
||||
signal(SIGINT, catch);
|
||||
get(argc, argv);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -678,7 +677,7 @@ write_symdef()
|
|||
}
|
||||
|
||||
/*
|
||||
* Return whether the bytes in `buf' form a good object header.
|
||||
* Return whether the bytes in `buf' form a good object header.
|
||||
* The header is put in `headp'.
|
||||
*/
|
||||
int
|
||||
|
@ -689,9 +688,7 @@ is_outhead(headp)
|
|||
return !BADMAGIC(*headp) && headp->oh_nname != 0;
|
||||
}
|
||||
|
||||
void
|
||||
do_object(f, size)
|
||||
long size;
|
||||
void do_object(int f, long size)
|
||||
{
|
||||
struct outhead headbuf;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include "defs.h"
|
||||
|
||||
|
@ -56,10 +57,6 @@ char *rassoc;
|
|||
short **derives;
|
||||
char *nullable;
|
||||
|
||||
extern char *mktemp();
|
||||
extern char *getenv();
|
||||
|
||||
|
||||
done(k)
|
||||
int k;
|
||||
{
|
||||
|
@ -253,9 +250,9 @@ create_file_names()
|
|||
text_file_name[len + 5] = 't';
|
||||
union_file_name[len + 5] = 'u';
|
||||
|
||||
mktemp(action_file_name);
|
||||
mktemp(text_file_name);
|
||||
mktemp(union_file_name);
|
||||
close(mkstemp(action_file_name));
|
||||
close(mkstemp(text_file_name));
|
||||
close(mkstemp(union_file_name));
|
||||
|
||||
len = strlen(file_prefix);
|
||||
|
||||
|
|
|
@ -58,10 +58,7 @@ static const struct
|
|||
#define MAXARGS 1024 /* mar # of args */
|
||||
#define NTEMPS 4 /* # of temporary files; not tunable */
|
||||
|
||||
extern char* mktemp();
|
||||
extern char* strcpy(), *strcat();
|
||||
extern char* strrchr();
|
||||
|
||||
static char tmpbase[] = TMP_DIR "/ego.XXXXXX";
|
||||
static char ddump[128] = TMP_DIR; /* data label dump file */
|
||||
static char pdump[128] = TMP_DIR; /* procedure name dump file */
|
||||
static char tmpbufs[NTEMPS * 2][128] = {
|
||||
|
@ -119,6 +116,8 @@ cleanup()
|
|||
if (pdump[0] != '\0')
|
||||
(void)unlink(pdump);
|
||||
}
|
||||
|
||||
(void)unlink(tmpbase);
|
||||
}
|
||||
|
||||
/*VARARGS1*/
|
||||
|
@ -204,9 +203,8 @@ new_outfiles()
|
|||
char** dst = &phargs[NTEMPS + 1];
|
||||
|
||||
if (!Bindex)
|
||||
{
|
||||
Bindex = strrchr(tmpbufs[0], 'B') - tmpbufs[0];
|
||||
}
|
||||
Bindex = strlen(tmpbufs[0]) - 2;
|
||||
|
||||
for (i = 1; i <= NTEMPS; i++)
|
||||
{
|
||||
*dst = tmpbufs[tmpindex];
|
||||
|
@ -284,7 +282,7 @@ static void
|
|||
phargs[argc++] = "-M";
|
||||
phargs[argc++] = descr_file;
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<nphase_args; i++)
|
||||
phargs[argc++] = phase_args[i];
|
||||
|
||||
|
@ -407,25 +405,25 @@ int main(int argc, char* argv[])
|
|||
fatal("no correct -P flag given");
|
||||
}
|
||||
|
||||
close(mkstemp(tmpbase));
|
||||
strcpy(ddump, tmpbase);
|
||||
strcpy(pdump, tmpbase);
|
||||
strcpy(tmpbufs[0], tmpbase);
|
||||
|
||||
if (keeptemps)
|
||||
{
|
||||
(void)strcpy(ddump, ".");
|
||||
(void)strcpy(pdump, ".");
|
||||
(void)strcpy(tmpbufs[0], ".");
|
||||
}
|
||||
(void)strcat(ddump, "/ego.dd.XXXXXX");
|
||||
(void)mktemp(ddump);
|
||||
(void)strcat(pdump, "/ego.pd.XXXXXX");
|
||||
(void)mktemp(pdump);
|
||||
(void)strcat(ddump, "dd");
|
||||
(void)strcat(pdump, "pd");
|
||||
|
||||
(void)strcat(tmpbufs[0], "/ego.XXXXXX");
|
||||
(void)mktemp(tmpbufs[0]);
|
||||
(void)strcat(tmpbufs[0], ".A.BB");
|
||||
for (i = 2 * NTEMPS - 1; i >= 1; i--)
|
||||
{
|
||||
(void)strcat(tmpbufs[0], "A.BB");
|
||||
for (i=1; i<(2 * NTEMPS); i++)
|
||||
(void)strcpy(tmpbufs[i], tmpbufs[0]);
|
||||
}
|
||||
i = strrchr(tmpbufs[0], 'A') - tmpbufs[0];
|
||||
|
||||
i = strlen(tmpbufs[0]) - 4;
|
||||
tmpbufs[0][i] = 'p';
|
||||
tmpbufs[NTEMPS + 0][i] = 'p';
|
||||
tmpbufs[1][i] = 'd';
|
||||
|
@ -434,6 +432,7 @@ int main(int argc, char* argv[])
|
|||
tmpbufs[NTEMPS + 2][i] = 'l';
|
||||
tmpbufs[3][i] = 'b';
|
||||
tmpbufs[NTEMPS + 3][i] = 'b';
|
||||
|
||||
run_phase(IC);
|
||||
run_phase(CF);
|
||||
while (*Ophase)
|
||||
|
|
|
@ -26,8 +26,6 @@ prc_p prochash[NPROCHASH];
|
|||
num_p numhash[NNUMHASH];
|
||||
char *lastname;
|
||||
|
||||
extern char *strcpy();
|
||||
|
||||
#define newsym() (sym_p) newstruct(sym)
|
||||
#define newprc() (prc_p) newstruct(prc)
|
||||
#define newnum() (num_p) newstruct(num)
|
||||
|
|
|
@ -334,10 +334,10 @@ char* argv[];
|
|||
strcat(ccname, "/ego.i2.XXXXXX");
|
||||
strcat(sname, "/ego.i3.XXXXXX");
|
||||
strcat(cname2, "/ego.i4.XXXXXX");
|
||||
mktemp(cname);
|
||||
mktemp(ccname);
|
||||
mktemp(sname);
|
||||
mktemp(cname2);
|
||||
close(mkstemp(cname));
|
||||
close(mkstemp(ccname));
|
||||
close(mkstemp(sname));
|
||||
close(mkstemp(cname2));
|
||||
pass1(files->lname_in, files->bname_in, cname); /* grep calls, analyse procedures */
|
||||
space = total_size * space / 100;
|
||||
pass2(cname, space); /* select calls to be expanded */
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Vern Paxson.
|
||||
*
|
||||
*
|
||||
* The United States Government has rights in this work pursuant
|
||||
* to contract no. DE-AC03-76SF00098 between the United States
|
||||
* Department of Energy and the University of California.
|
||||
|
@ -38,6 +38,7 @@ static char rcsid[] =
|
|||
#endif
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "flexdef.h"
|
||||
|
||||
static char flex_version[] = "2.3";
|
||||
|
@ -394,7 +395,7 @@ char **argv;
|
|||
|
||||
{
|
||||
int i, sawcmpflag;
|
||||
char *arg, *flex_gettime(), *mktemp();
|
||||
char *arg, *flex_gettime();
|
||||
|
||||
printstats = syntaxerror = trace = spprdflt = interactive = caseins = false;
|
||||
backtrack_report = performance_report = ddebug = fulltbl = fullspd = false;
|
||||
|
@ -611,7 +612,7 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */
|
|||
#else
|
||||
(void) strcpy( temp_action_file_name, "flexXXXXXX.tmp" );
|
||||
#endif
|
||||
(void) mktemp( temp_action_file_name );
|
||||
close(mkstemp(temp_action_file_name));
|
||||
|
||||
action_file_name = temp_action_file_name;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@ static char rcsid[] = "$Id$";
|
|||
|
||||
#define ENDLIB ((long)0)
|
||||
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
static struct ar_hdr arhdr;
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,6 +10,7 @@ static char rcsid[] = "$Id$";
|
|||
* led - linkage editor for ACK assemblers output format
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
@ -298,6 +299,7 @@ static uint32_t sect_base[MAXSECT];
|
|||
static char lignmap[MAXSECT / WIDTH];
|
||||
static uint32_t sect_lign[MAXSECT];
|
||||
|
||||
/*
|
||||
/*
|
||||
* Set the alignment of section `sectno' to `lign', if this doesn't
|
||||
* conflict with earlier alignment.
|
||||
|
@ -305,6 +307,8 @@ static uint32_t sect_lign[MAXSECT];
|
|||
static void
|
||||
setlign(int sectno, uint32_t lign)
|
||||
{
|
||||
extern bool setbit();
|
||||
|
||||
if (setbit(sectno, lignmap) && sect_lign[sectno] != lign)
|
||||
fatal("section has different alignments");
|
||||
if (lign == (long)0)
|
||||
|
@ -319,6 +323,8 @@ setlign(int sectno, uint32_t lign)
|
|||
static void
|
||||
setbase(int sectno, uint32_t base)
|
||||
{
|
||||
extern bool setbit();
|
||||
|
||||
if (setbit(sectno, basemap) && sect_base[sectno] != base)
|
||||
fatal("section has different bases");
|
||||
sect_base[sectno] = base;
|
||||
|
|
|
@ -25,15 +25,17 @@ static char rcsid[] = "$Id$";
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <out.h>
|
||||
#include "const.h"
|
||||
#include "assert.h"
|
||||
#include "debug.h"
|
||||
#include "memory.h"
|
||||
#include "object.h"
|
||||
|
||||
static copy_down();
|
||||
static copy_up();
|
||||
static free_saved_moduls();
|
||||
static void copy_down(struct memory* mem, ind_t dist);
|
||||
static void copy_up(struct memory* mem, ind_t dist);
|
||||
static void free_saved_moduls(void);
|
||||
|
||||
struct memory mems[NMEMS];
|
||||
|
||||
|
@ -45,8 +47,7 @@ ind_t core_position = (ind_t)0; /* Index of current module. */
|
|||
static char *BASE;
|
||||
static ind_t refused;
|
||||
|
||||
sbreak(incr)
|
||||
ind_t incr;
|
||||
static int sbreak(ind_t incr)
|
||||
{
|
||||
unsigned int inc;
|
||||
|
||||
|
@ -69,12 +70,11 @@ sbreak(incr)
|
|||
* Initialize some pieces of core. We hope that this will be our last
|
||||
* real allocation, meaning we've made the right choices.
|
||||
*/
|
||||
init_core()
|
||||
void init_core(void)
|
||||
{
|
||||
register char *base;
|
||||
register ind_t total_size;
|
||||
register struct memory *mem;
|
||||
extern char *sbrk();
|
||||
|
||||
#include "mach.h"
|
||||
#define ALIGN 8 /* minimum alignment for pieces */
|
||||
|
@ -175,9 +175,7 @@ extern int passnumber;
|
|||
* enough bytes, the first or the second time.
|
||||
*/
|
||||
static bool
|
||||
compact(piece, incr, flag)
|
||||
register int piece;
|
||||
register ind_t incr;
|
||||
compact(int piece, ind_t incr, int flag)
|
||||
#define NORMAL 0
|
||||
#define FREEZE 1
|
||||
#define FORCED 2
|
||||
|
@ -315,10 +313,8 @@ compact(piece, incr, flag)
|
|||
* overlap with the old area, but we do not want to overwrite them before they
|
||||
* are copied.
|
||||
*/
|
||||
static
|
||||
copy_down(mem, dist)
|
||||
register struct memory *mem;
|
||||
ind_t dist;
|
||||
static void
|
||||
copy_down(struct memory* mem, ind_t dist)
|
||||
{
|
||||
register char *old;
|
||||
register char *new;
|
||||
|
@ -338,10 +334,7 @@ copy_down(mem, dist)
|
|||
* overlap with the old area, but we do not want to overwrite them before they
|
||||
* are copied.
|
||||
*/
|
||||
static
|
||||
copy_up(mem, dist)
|
||||
register struct memory *mem;
|
||||
ind_t dist;
|
||||
static void copy_up(struct memory* mem, ind_t dist)
|
||||
{
|
||||
register char *old;
|
||||
register char *new;
|
||||
|
@ -364,10 +357,7 @@ static int alloctype = NORMAL;
|
|||
* how many times the area is moved, because of another allocate, this offset
|
||||
* remains valid.
|
||||
*/
|
||||
ind_t
|
||||
alloc(piece, size)
|
||||
int piece;
|
||||
register long size;
|
||||
ind_t alloc(int piece, long size)
|
||||
{
|
||||
register ind_t incr = 0;
|
||||
ind_t left = mems[piece].mem_left;
|
||||
|
@ -405,9 +395,7 @@ alloc(piece, size)
|
|||
* attempt fails, release the space occupied by other pieces and try again.
|
||||
*/
|
||||
ind_t
|
||||
hard_alloc(piece, size)
|
||||
register int piece;
|
||||
register long size;
|
||||
hard_alloc(int piece, long size)
|
||||
{
|
||||
register ind_t ret;
|
||||
register int i;
|
||||
|
@ -452,8 +440,8 @@ hard_alloc(piece, size)
|
|||
* at the start of the piece allocated for module contents, thereby
|
||||
* overwriting the saved modules, and release its space.
|
||||
*/
|
||||
static
|
||||
free_saved_moduls()
|
||||
static void
|
||||
free_saved_moduls(void)
|
||||
{
|
||||
register ind_t size;
|
||||
register char *old, *new;
|
||||
|
@ -473,8 +461,8 @@ free_saved_moduls()
|
|||
* The piece of memory with index `piece' is no longer needed.
|
||||
* We take care that it can be used by compact() later, if needed.
|
||||
*/
|
||||
dealloc(piece)
|
||||
register int piece;
|
||||
void
|
||||
dealloc(int piece)
|
||||
{
|
||||
/*
|
||||
* Some pieces need their memory throughout the program.
|
||||
|
@ -499,9 +487,7 @@ core_alloc(piece, size)
|
|||
return address(piece, off);
|
||||
}
|
||||
|
||||
core_free(piece, p)
|
||||
int piece;
|
||||
char *p;
|
||||
void core_free(int piece, char* p)
|
||||
{
|
||||
char *q = address(piece, mems[piece].mem_full);
|
||||
|
||||
|
@ -553,7 +539,7 @@ freeze_core()
|
|||
* To transform the various pieces of the output in core to the file format,
|
||||
* we must order the bytes in the unsigned shorts and longs as ACK prescribes.
|
||||
*/
|
||||
write_bytes()
|
||||
void write_bytes(void)
|
||||
{
|
||||
unsigned short nsect;
|
||||
long offchar;
|
||||
|
@ -611,10 +597,7 @@ write_bytes()
|
|||
}
|
||||
}
|
||||
|
||||
namecpy(name, nname, offchar)
|
||||
register struct outname *name;
|
||||
register unsigned nname;
|
||||
register long offchar;
|
||||
void namecpy(struct outname* name, unsigned nname, long offchar)
|
||||
{
|
||||
while (nname--) {
|
||||
if (name->on_foff)
|
||||
|
|
|
@ -38,5 +38,10 @@ extern struct memory mems[];
|
|||
#define int_align(sz) (((sz)+(sizeof(int)-1))&~(int)(sizeof(int)-1))
|
||||
|
||||
extern ind_t core_position;
|
||||
extern ind_t hard_alloc();
|
||||
extern ind_t alloc();
|
||||
extern void init_core(void);
|
||||
extern ind_t hard_alloc(int piece, long size);
|
||||
extern ind_t alloc(int piece, long size);
|
||||
extern void dealloc(int piece);
|
||||
extern void core_free(int piece, char* p);
|
||||
extern void write_bytes(void);
|
||||
extern void namecpy(struct outname* name, unsigned nname, long offchar);
|
||||
|
|
|
@ -68,8 +68,6 @@ savechar(piece, off)
|
|||
{
|
||||
register long len;
|
||||
register ind_t newoff;
|
||||
extern ind_t alloc();
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
if (off == (ind_t)0)
|
||||
return 0;
|
||||
|
|
|
@ -10,13 +10,17 @@ static char rcsid[] = "$Id$";
|
|||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#ifdef SYMDBUG
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#ifdef SYMDBUG
|
||||
#endif /* SYMDBUG */
|
||||
#include "arch.h"
|
||||
#include "out.h"
|
||||
#include "ranlib.h"
|
||||
#include "object.h"
|
||||
#include "const.h"
|
||||
#include "assert.h"
|
||||
#include "memory.h"
|
||||
|
@ -42,20 +46,21 @@ char *modulname; /* Name of object module. */
|
|||
long objectsize;
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
static long align();
|
||||
static long align(long size);
|
||||
static char *modulbase;
|
||||
static long modulsize();
|
||||
static scan_modul();
|
||||
static bool all_alloc();
|
||||
static bool direct_alloc();
|
||||
static bool indirect_alloc();
|
||||
static bool putemitindex();
|
||||
static bool putreloindex();
|
||||
static long modulsize(struct outhead* head);
|
||||
static void can_modul(void);
|
||||
static bool all_alloc(void);
|
||||
static bool direct_alloc(struct outhead* head);
|
||||
static bool indirect_alloc(struct outhead* head);
|
||||
static bool putemitindex(ind_t sectindex, ind_t emitoff, int allopiece);
|
||||
static bool putreloindex(ind_t relooff, long nrelobytes);
|
||||
#ifdef SYMDBUG
|
||||
static bool putdbugindex();
|
||||
static bool putdbugindex(ind_t dbugoff, long ndbugbytes);
|
||||
#endif /* SYMDBUG */
|
||||
static get_indirect();
|
||||
static read_modul();
|
||||
static void get_indirect(struct outhead* head, struct outsect* sect);
|
||||
static void read_modul(void);
|
||||
static void scan_modul(void);
|
||||
|
||||
/*
|
||||
* Open the file with name `filename' (if necessary) and examine the first
|
||||
|
@ -117,16 +122,13 @@ getfile(filename)
|
|||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
closefile(filename)
|
||||
char *filename;
|
||||
void closefile(char* filename)
|
||||
{
|
||||
if (passnumber == FIRST || !incore)
|
||||
close(infile);
|
||||
}
|
||||
|
||||
get_archive_header(archive_header)
|
||||
register struct ar_hdr *archive_header;
|
||||
void get_archive_header(struct ar_hdr* archive_header)
|
||||
{
|
||||
if (passnumber == FIRST || !incore) {
|
||||
rd_arhdr(infile, archive_header);
|
||||
|
@ -141,7 +143,7 @@ get_archive_header(archive_header)
|
|||
#endif /* SYMDBUG */
|
||||
}
|
||||
|
||||
get_modul()
|
||||
void get_modul(void)
|
||||
{
|
||||
if (passnumber == FIRST) {
|
||||
rd_fdopen(infile);
|
||||
|
@ -157,8 +159,8 @@ get_modul()
|
|||
* to keep everything in core is abandoned, but we will always put the header,
|
||||
* the section table, and the name and string table into core.
|
||||
*/
|
||||
static
|
||||
scan_modul()
|
||||
static void
|
||||
scan_modul(void)
|
||||
{
|
||||
bool space;
|
||||
struct outhead *head;
|
||||
|
@ -190,10 +192,9 @@ scan_modul()
|
|||
* this was possible.
|
||||
*/
|
||||
static bool
|
||||
all_alloc()
|
||||
all_alloc(void)
|
||||
{
|
||||
struct outhead head;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
if (hard_alloc(ALLOMODL, (long)sizeof(struct outhead)) == BADOFF)
|
||||
fatal("no space for module header");
|
||||
|
@ -218,8 +219,6 @@ direct_alloc(head)
|
|||
register struct outsect *sects;
|
||||
unsigned short nsect = head->oh_nsect;
|
||||
long size, rest;
|
||||
extern ind_t hard_alloc();
|
||||
extern ind_t alloc();
|
||||
|
||||
#ifdef SYMDBUG
|
||||
rest = nsect * sizeof(ind_t) + sizeof(ind_t) + sizeof(ind_t);
|
||||
|
@ -287,14 +286,10 @@ indirect_alloc(head)
|
|||
* `emitoff'.
|
||||
*/
|
||||
static bool
|
||||
putemitindex(sectindex, emitoff, allopiece)
|
||||
ind_t sectindex;
|
||||
ind_t emitoff;
|
||||
int allopiece;
|
||||
putemitindex(ind_t sectindex, ind_t emitoff, int allopiece)
|
||||
{
|
||||
long flen;
|
||||
ind_t emitindex;
|
||||
extern ind_t alloc();
|
||||
static long zeros[MAXSECT];
|
||||
register long zero = zeros[allopiece - ALLOEMIT];
|
||||
|
||||
|
@ -330,12 +325,9 @@ putemitindex(sectindex, emitoff, allopiece)
|
|||
* offset at `relooff'.
|
||||
*/
|
||||
static bool
|
||||
putreloindex(relooff, nrelobytes)
|
||||
ind_t relooff;
|
||||
long nrelobytes;
|
||||
putreloindex(ind_t relooff, long nrelobytes)
|
||||
{
|
||||
ind_t reloindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((reloindex = alloc(ALLORELO, nrelobytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(relooff) = reloindex;
|
||||
|
@ -348,12 +340,9 @@ putreloindex(relooff, nrelobytes)
|
|||
* Allocate space for debugging information and put the offset at `dbugoff'.
|
||||
*/
|
||||
static bool
|
||||
putdbugindex(dbugoff, ndbugbytes)
|
||||
ind_t relooff;
|
||||
long ndbugbytes;
|
||||
putdbugindex(ind_t dbugoff, long ndbugbytes)
|
||||
{
|
||||
ind_t dbugindex;
|
||||
extern ind_t alloc();
|
||||
|
||||
if ((dbugindex = alloc(ALLODBUG, ndbugbytes)) != BADOFF) {
|
||||
*(ind_t *)modulptr(dbugoff) = dbugindex;
|
||||
|
@ -367,12 +356,8 @@ putdbugindex(dbugoff, ndbugbytes)
|
|||
* Compute addresses and read in. Remember that the contents of the sections
|
||||
* and also the relocation table are accessed indirectly.
|
||||
*/
|
||||
static
|
||||
get_indirect(head, sect)
|
||||
struct outhead *head; /* not register! Won't compile on
|
||||
SCO Xenix 386 if it is!
|
||||
*/
|
||||
register struct outsect *sect;
|
||||
static void
|
||||
get_indirect(struct outhead* head, struct outsect* sect)
|
||||
{
|
||||
register ind_t *emitindex;
|
||||
register int nsect;
|
||||
|
@ -395,8 +380,7 @@ get_indirect(head, sect)
|
|||
/*
|
||||
* Set the file pointer at `pos'.
|
||||
*/
|
||||
seek(pos)
|
||||
long pos;
|
||||
void seek(long pos)
|
||||
{
|
||||
if (passnumber == FIRST || !incore)
|
||||
lseek(infile, pos, 0);
|
||||
|
@ -407,8 +391,7 @@ seek(pos)
|
|||
* is not. That's why we do it here. If we don't keep everything in core,
|
||||
* we give the space allocated for a module back.
|
||||
*/
|
||||
skip_modul(head)
|
||||
struct outhead *head;
|
||||
void skip_modul(struct outhead* head)
|
||||
{
|
||||
register ind_t skip = modulsize(head);
|
||||
|
||||
|
@ -425,8 +408,8 @@ skip_modul(head)
|
|||
/*
|
||||
* Read in what we need in pass 2, because we couldn't keep it in core.
|
||||
*/
|
||||
static
|
||||
read_modul()
|
||||
static void
|
||||
read_modul(void)
|
||||
{
|
||||
struct outhead *head;
|
||||
register struct outsect *sects;
|
||||
|
@ -436,7 +419,6 @@ read_modul()
|
|||
unsigned short nsect, nname;
|
||||
long size;
|
||||
long nchar;
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
assert(passnumber == SECOND);
|
||||
assert(!incore);
|
||||
|
@ -524,8 +506,7 @@ static unsigned short cnt_relos;
|
|||
static unsigned short relind;
|
||||
#define _RELSIZ 64
|
||||
|
||||
startrelo(head)
|
||||
register struct outhead *head;
|
||||
void startrelo(struct outhead* head)
|
||||
{
|
||||
ind_t reloindex;
|
||||
|
||||
|
@ -540,8 +521,7 @@ startrelo(head)
|
|||
}
|
||||
}
|
||||
|
||||
struct outrelo *
|
||||
nextrelo()
|
||||
struct outrelo* nextrelo(void)
|
||||
{
|
||||
static struct outrelo relobuf[_RELSIZ];
|
||||
|
||||
|
@ -615,8 +595,7 @@ getblk(totalsz, pblksz, sectindex)
|
|||
return (char *) 0;
|
||||
}
|
||||
|
||||
endemit(emit)
|
||||
char *emit;
|
||||
void endemit(char* emit)
|
||||
{
|
||||
core_free(ALLOMODL, emit);
|
||||
}
|
||||
|
|
|
@ -15,3 +15,12 @@
|
|||
#ifdef SYMDBUG
|
||||
#define OFF_DBUG(x) (OFF_CHAR(x) + (x).oh_nchar)
|
||||
#endif /* SYMDBUG */
|
||||
|
||||
extern void seek(long pos);
|
||||
extern void closefile(char* filename);
|
||||
extern void get_archive_header(struct ar_hdr* archive_header);
|
||||
extern void get_modul(void);
|
||||
extern void skip_modul(struct outhead* head);
|
||||
extern void startrelo(struct outhead* head);
|
||||
extern struct outrelo* nextrelo(void);
|
||||
extern void endemit(char* emit);
|
||||
|
|
|
@ -100,7 +100,6 @@ entername(name, hashval)
|
|||
register struct symbol *sym;
|
||||
struct outname *newname;
|
||||
extern ind_t savechar();
|
||||
extern ind_t hard_alloc();
|
||||
|
||||
debug("entername %s %d %x %x", modulptr((ind_t)name->on_foff), hashval, name->on_type, name->on_desc);
|
||||
savindex = savechar(ALLOGCHR, (ind_t)name->on_foff);
|
||||
|
|
|
@ -136,7 +136,7 @@ int main(int argc, char* argv[])
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
emitheader();
|
||||
registerterminals();
|
||||
|
||||
|
@ -1074,7 +1074,7 @@ static bool find_child_index(Tree node, const char* name, int* index, Tree* foun
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void emit_predicate_expr(Rule r, struct expr* p)
|
||||
{
|
||||
bool first = true;
|
||||
|
@ -1254,10 +1254,10 @@ static void emitinsndata(Rule rules)
|
|||
int index = 0;
|
||||
emit_input_regs(r->pattern, &index);
|
||||
}
|
||||
|
||||
|
||||
emit_output_constraints(r);
|
||||
emit_input_constraints(r);
|
||||
|
||||
|
||||
while (f)
|
||||
{
|
||||
char* data = strdup(f->data);
|
||||
|
@ -1276,10 +1276,10 @@ static void emitinsndata(Rule rules)
|
|||
{
|
||||
Tree node;
|
||||
int index = 0;
|
||||
Nonterm nt;
|
||||
|
||||
if (!find_child_index(r->pattern, label, &index, &node))
|
||||
label_not_found(r, label);
|
||||
Nonterm nt = node->op;
|
||||
|
||||
if (nt->kind == NONTERM)
|
||||
{
|
||||
if (nt->is_fragment)
|
||||
|
@ -1310,7 +1310,7 @@ static void emitinsndata(Rule rules)
|
|||
assert(f->data[1] == 0);
|
||||
print("%1data->emit_eoi();\n");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
print("%1data->emit_string(\"%s\");\n", f->data);
|
||||
}
|
||||
|
|
|
@ -57,13 +57,12 @@ flags(s) register char *s; {
|
|||
}
|
||||
|
||||
fileinit() {
|
||||
char *mktemp();
|
||||
short readshort();
|
||||
|
||||
if (readshort() != (short) sp_magic)
|
||||
error("wrong input file");
|
||||
if (Lflag) {
|
||||
outfile = fopen(mktemp(template),"w");
|
||||
outfile = fdopen(mkstemp(template),"w");
|
||||
if (outfile == NULL)
|
||||
error("can't create %s",template);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue