Use LD for linking mips binaries, not CC.

Fix a few incompatibilities in C sources.
This commit is contained in:
Serge
2022-05-25 19:23:39 -07:00
parent 00c4bf1ea1
commit d5002ad0ac
17 changed files with 40 additions and 33 deletions

View File

@@ -12,7 +12,7 @@ CFLAGS += -DNUM_SYMS_CACHE=50 -Wall -Werror
all: adb
adb: $(OBJS)
${CC} ${LDFLAGS} -o adb.elf $(OBJS) ${LIBS}
${LD} ${LDFLAGS} -o adb.elf $(OBJS) ${LIBS}
${OBJDUMP} -S adb.elf > adb.dis
${SIZE} adb.elf
${ELF2AOUT} adb.elf $@ && rm adb.elf

View File

@@ -10,7 +10,7 @@ MANSRC = chown.8
all: chown $(MAN)
chown: ${OBJS}
${CC} ${LDFLAGS} -o chown.elf ${OBJS} ${LIBS}
${LD} ${LDFLAGS} -o chown.elf ${OBJS} ${LIBS}
${OBJDUMP} -S chown.elf > chown.dis
${SIZE} chown.elf
${ELF2AOUT} chown.elf $@ && rm chown.elf

View File

@@ -1,9 +1,9 @@
/*
* Linker script for user executables.
*/
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
/* OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
"elf32-littlemips")
OUTPUT_ARCH(mips)
OUTPUT_ARCH(mips) */
ENTRY(_start)
/* Required by Microchip C32 linker */

View File

@@ -10,5 +10,5 @@ int
feof(fp)
register FILE *fp;
{
return feof(fp);
return (fp->_flag & _IOEOF) != 0;
}

View File

@@ -10,5 +10,5 @@ int
ferror(fp)
register FILE *fp;
{
return ferror(fp);
return (fp->_flag & _IOERR) != 0;
}

View File

@@ -10,5 +10,5 @@ int
fileno(fp)
register FILE *fp;
{
return fileno(fp);
return fp->_file;
}

View File

@@ -9,9 +9,7 @@
#include <sys/types.h>
#include <sys/stat.h>
int _flsbuf(c, iop)
unsigned char c;
register FILE *iop;
int _flsbuf(unsigned char c, register FILE *iop)
{
register char *base;
register int n, rn;

View File

@@ -37,9 +37,7 @@ set_ch(win, y, x, ch)
/*
* This routine adds the character to the current position
*/
int waddch(win, c)
WINDOW *win;
char c;
int waddch(WINDOW *win, char c)
{
int x, y;
int newx;

View File

@@ -11,9 +11,7 @@
*
*/
void
box(win, vert, hor)
WINDOW *win;
char vert, hor;
box(WINDOW *win, char vert, char hor)
{
int i;
int endy, endx;

View File

@@ -155,7 +155,7 @@ plod(cnt)
}
else
*/
j = outcol - destcol;
j = outcol - destcol;
/*
* If we will later need a \n which will turn into a \r\n by
* the system or the terminal, then don't bother to try to \r.

View File

@@ -17,7 +17,7 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
CFLAGS += ${DEFS}
CFLAGS += ${DEFS} -Werror
SRCS = login.c logout.c logwtmp.c
OBJS = login.o logout.o logwtmp.o

View File

@@ -19,6 +19,10 @@
#include <utmp.h>
#include <stdio.h>
#include <paths.h>
#include <fcntl.h>
#include <unistd.h>
int ttyslot(void);
void
login(ut)

View File

@@ -18,11 +18,15 @@
#include <sys/file.h>
#include <sys/time.h>
#include <strings.h>
#include <string.h>
#include <utmp.h>
#include <paths.h>
#include <fcntl.h>
#include <unistd.h>
typedef struct utmp UTMP;
int
logout(line)
register char *line;
{

View File

@@ -20,7 +20,10 @@
#include <sys/stat.h>
#include <utmp.h>
#include <paths.h>
#include <fcntl.h>
#include <unistd.h>
void
logwtmp(line, name, host)
char *line, *name, *host;
{
@@ -30,7 +33,8 @@ logwtmp(line, name, host)
time_t time();
char *strncpy();
if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0);
if (fd < 0)
return;
if (!fstat(fd, &buf)) {
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));

View File

@@ -15,7 +15,7 @@ MANSRC = vmf.3
CTAGS = ctags
#DEFS = -DNOSCCS
#CFLAGS = -O $(DEFS)
CFLAGS = -O -Werror
TAGSFILE = tags
all: ../libvmf.a $(MAN)

View File

@@ -10,7 +10,7 @@
* been reduced to two write() statements.
* 3.0 08Sep93 5. Polish it up for use in 'ld.c' (2.11BSD).
* Release into the Public Domain.
* --------------------------------------------------
* --------------------------------------------------
*/
#include <vmf.h>
@@ -20,12 +20,14 @@
#include <stdlib.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
/*
* Choose ONE and only one of the following swap policies
*/
/* #define LRU /* Least Recently Used */
/* #define PERC 3 /* Percolation */
// #define LRU /* Least Recently Used */
// #define PERC 3 /* Percolation */
#define LRS /* Least Recently Swapped */
#ifndef DEBUG
@@ -107,13 +109,13 @@ vmmapseg(vspace, segno)
/* look for segment in memory */
for (s = (struct vseg *)seghead[0].fwd;
s->s_segno != segno || s->s_vspace != vspace;
s = (struct vseg *)s->s_link.fwd)
s = (struct vseg *)s->s_link.fwd)
{
if (s == (struct vseg *)seghead)
{ /* not in memory */
int status;
for (s = (struct vseg *)s->s_link.back; s->s_lock_count != 0;
for (s = (struct vseg *)s->s_link.back; s->s_lock_count != 0;
s = (struct vseg *)s->s_link.back)
{
if (s == (struct vseg *)seghead)
@@ -196,7 +198,7 @@ swap(seg, iofunc) /* used only from this file */
if (lseek(v->v_fd, file_address, L_SET) == -1L)
return(-2);
switch ((*iofunc)(v->v_fd, seg->s_cinfo, BYTESPERSEG))
switch ((*iofunc)(v->v_fd, seg->s_cinfo, BYTESPERSEG))
{
case BYTESPERSEG:
return(0);
@@ -330,9 +332,9 @@ vmclose(vs)
vmflush();
/* invalidate all segments associated with that file */
for (s = (struct vseg *)seghead[0].fwd; s != (struct vseg *)seghead;
s = (struct vseg *)s->s_link.fwd)
s = (struct vseg *)s->s_link.fwd)
{
if (s->s_vspace == vs)
if (s->s_vspace == vs)
{
s->s_segno = NOSEGNO;
s->s_vspace = NULL;

View File

@@ -39,10 +39,10 @@ ifeq ($(LLVMBIN),)
endif
CC = $(LLVMBIN)clang -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
-nostdinc -fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include \
-fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include \
-Wno-builtin-requires-header
CXX = $(LLVMBIN)clang++ -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
-nostdinc -fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include
-fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include
LD = $(LLVMBIN)ld.lld -m elf32ltsmip
AR = $(LLVMBIN)llvm-ar
RANLIB = $(LLVMBIN)llvm-ranlib
@@ -57,10 +57,9 @@ TAGSFILE = tags
MANROFF = nroff -man -h -Tascii
ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout
CFLAGS = -Os
CFLAGS = -Os -nostdinc
LDFLAGS = -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \
$(TOPSRC)/src/crt0.o -L$(TOPSRC)/src
LDFLAGS = -T$(TOPSRC)/src/elf32-mips.ld $(TOPSRC)/src/crt0.o -L$(TOPSRC)/src
LIBS = -lc
# Enable mips16e instruction set by default