Use LD for linking mips binaries, not CC.
Fix a few incompatibilities in C sources.
This commit is contained in:
@@ -12,7 +12,7 @@ CFLAGS += -DNUM_SYMS_CACHE=50 -Wall -Werror
|
|||||||
all: adb
|
all: adb
|
||||||
|
|
||||||
adb: $(OBJS)
|
adb: $(OBJS)
|
||||||
${CC} ${LDFLAGS} -o adb.elf $(OBJS) ${LIBS}
|
${LD} ${LDFLAGS} -o adb.elf $(OBJS) ${LIBS}
|
||||||
${OBJDUMP} -S adb.elf > adb.dis
|
${OBJDUMP} -S adb.elf > adb.dis
|
||||||
${SIZE} adb.elf
|
${SIZE} adb.elf
|
||||||
${ELF2AOUT} adb.elf $@ && rm adb.elf
|
${ELF2AOUT} adb.elf $@ && rm adb.elf
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ MANSRC = chown.8
|
|||||||
all: chown $(MAN)
|
all: chown $(MAN)
|
||||||
|
|
||||||
chown: ${OBJS}
|
chown: ${OBJS}
|
||||||
${CC} ${LDFLAGS} -o chown.elf ${OBJS} ${LIBS}
|
${LD} ${LDFLAGS} -o chown.elf ${OBJS} ${LIBS}
|
||||||
${OBJDUMP} -S chown.elf > chown.dis
|
${OBJDUMP} -S chown.elf > chown.dis
|
||||||
${SIZE} chown.elf
|
${SIZE} chown.elf
|
||||||
${ELF2AOUT} chown.elf $@ && rm chown.elf
|
${ELF2AOUT} chown.elf $@ && rm chown.elf
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Linker script for user executables.
|
* Linker script for user executables.
|
||||||
*/
|
*/
|
||||||
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
|
/* OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
|
||||||
"elf32-littlemips")
|
"elf32-littlemips")
|
||||||
OUTPUT_ARCH(mips)
|
OUTPUT_ARCH(mips) */
|
||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
|
|
||||||
/* Required by Microchip C32 linker */
|
/* Required by Microchip C32 linker */
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ int
|
|||||||
feof(fp)
|
feof(fp)
|
||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
{
|
{
|
||||||
return feof(fp);
|
return (fp->_flag & _IOEOF) != 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ int
|
|||||||
ferror(fp)
|
ferror(fp)
|
||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
{
|
{
|
||||||
return ferror(fp);
|
return (fp->_flag & _IOERR) != 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ int
|
|||||||
fileno(fp)
|
fileno(fp)
|
||||||
register FILE *fp;
|
register FILE *fp;
|
||||||
{
|
{
|
||||||
return fileno(fp);
|
return fp->_file;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
int _flsbuf(c, iop)
|
int _flsbuf(unsigned char c, register FILE *iop)
|
||||||
unsigned char c;
|
|
||||||
register FILE *iop;
|
|
||||||
{
|
{
|
||||||
register char *base;
|
register char *base;
|
||||||
register int n, rn;
|
register int n, rn;
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ set_ch(win, y, x, ch)
|
|||||||
/*
|
/*
|
||||||
* This routine adds the character to the current position
|
* This routine adds the character to the current position
|
||||||
*/
|
*/
|
||||||
int waddch(win, c)
|
int waddch(WINDOW *win, char c)
|
||||||
WINDOW *win;
|
|
||||||
char c;
|
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int newx;
|
int newx;
|
||||||
|
|||||||
@@ -11,9 +11,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
box(win, vert, hor)
|
box(WINDOW *win, char vert, char hor)
|
||||||
WINDOW *win;
|
|
||||||
char vert, hor;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int endy, endx;
|
int endy, endx;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ plod(cnt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
*/
|
*/
|
||||||
j = outcol - destcol;
|
j = outcol - destcol;
|
||||||
/*
|
/*
|
||||||
* If we will later need a \n which will turn into a \r\n by
|
* 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.
|
* the system or the terminal, then don't bother to try to \r.
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
TOPSRC = $(shell cd ../..; pwd)
|
TOPSRC = $(shell cd ../..; pwd)
|
||||||
include $(TOPSRC)/target.mk
|
include $(TOPSRC)/target.mk
|
||||||
|
|
||||||
CFLAGS += ${DEFS}
|
CFLAGS += ${DEFS} -Werror
|
||||||
|
|
||||||
SRCS = login.c logout.c logwtmp.c
|
SRCS = login.c logout.c logwtmp.c
|
||||||
OBJS = login.o logout.o logwtmp.o
|
OBJS = login.o logout.o logwtmp.o
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int ttyslot(void);
|
||||||
|
|
||||||
void
|
void
|
||||||
login(ut)
|
login(ut)
|
||||||
|
|||||||
@@ -18,11 +18,15 @@
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#include <string.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
typedef struct utmp UTMP;
|
typedef struct utmp UTMP;
|
||||||
|
|
||||||
|
int
|
||||||
logout(line)
|
logout(line)
|
||||||
register char *line;
|
register char *line;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,10 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void
|
||||||
logwtmp(line, name, host)
|
logwtmp(line, name, host)
|
||||||
char *line, *name, *host;
|
char *line, *name, *host;
|
||||||
{
|
{
|
||||||
@@ -30,7 +33,8 @@ logwtmp(line, name, host)
|
|||||||
time_t time();
|
time_t time();
|
||||||
char *strncpy();
|
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;
|
return;
|
||||||
if (!fstat(fd, &buf)) {
|
if (!fstat(fd, &buf)) {
|
||||||
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
|
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ MANSRC = vmf.3
|
|||||||
|
|
||||||
CTAGS = ctags
|
CTAGS = ctags
|
||||||
#DEFS = -DNOSCCS
|
#DEFS = -DNOSCCS
|
||||||
#CFLAGS = -O $(DEFS)
|
CFLAGS = -O -Werror
|
||||||
TAGSFILE = tags
|
TAGSFILE = tags
|
||||||
|
|
||||||
all: ../libvmf.a $(MAN)
|
all: ../libvmf.a $(MAN)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
* been reduced to two write() statements.
|
* been reduced to two write() statements.
|
||||||
* 3.0 08Sep93 5. Polish it up for use in 'ld.c' (2.11BSD).
|
* 3.0 08Sep93 5. Polish it up for use in 'ld.c' (2.11BSD).
|
||||||
* Release into the Public Domain.
|
* Release into the Public Domain.
|
||||||
* --------------------------------------------------
|
* --------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <vmf.h>
|
#include <vmf.h>
|
||||||
@@ -20,12 +20,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Choose ONE and only one of the following swap policies
|
* Choose ONE and only one of the following swap policies
|
||||||
*/
|
*/
|
||||||
/* #define LRU /* Least Recently Used */
|
// #define LRU /* Least Recently Used */
|
||||||
/* #define PERC 3 /* Percolation */
|
// #define PERC 3 /* Percolation */
|
||||||
#define LRS /* Least Recently Swapped */
|
#define LRS /* Least Recently Swapped */
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
@@ -107,13 +109,13 @@ vmmapseg(vspace, segno)
|
|||||||
/* look for segment in memory */
|
/* look for segment in memory */
|
||||||
for (s = (struct vseg *)seghead[0].fwd;
|
for (s = (struct vseg *)seghead[0].fwd;
|
||||||
s->s_segno != segno || s->s_vspace != vspace;
|
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)
|
if (s == (struct vseg *)seghead)
|
||||||
{ /* not in memory */
|
{ /* not in memory */
|
||||||
int status;
|
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)
|
s = (struct vseg *)s->s_link.back)
|
||||||
{
|
{
|
||||||
if (s == (struct vseg *)seghead)
|
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)
|
if (lseek(v->v_fd, file_address, L_SET) == -1L)
|
||||||
return(-2);
|
return(-2);
|
||||||
|
|
||||||
switch ((*iofunc)(v->v_fd, seg->s_cinfo, BYTESPERSEG))
|
switch ((*iofunc)(v->v_fd, seg->s_cinfo, BYTESPERSEG))
|
||||||
{
|
{
|
||||||
case BYTESPERSEG:
|
case BYTESPERSEG:
|
||||||
return(0);
|
return(0);
|
||||||
@@ -330,9 +332,9 @@ vmclose(vs)
|
|||||||
vmflush();
|
vmflush();
|
||||||
/* invalidate all segments associated with that file */
|
/* invalidate all segments associated with that file */
|
||||||
for (s = (struct vseg *)seghead[0].fwd; s != (struct vseg *)seghead;
|
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_segno = NOSEGNO;
|
||||||
s->s_vspace = NULL;
|
s->s_vspace = NULL;
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ ifeq ($(LLVMBIN),)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
CC = $(LLVMBIN)clang -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
|
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
|
-Wno-builtin-requires-header
|
||||||
CXX = $(LLVMBIN)clang++ -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
|
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
|
LD = $(LLVMBIN)ld.lld -m elf32ltsmip
|
||||||
AR = $(LLVMBIN)llvm-ar
|
AR = $(LLVMBIN)llvm-ar
|
||||||
RANLIB = $(LLVMBIN)llvm-ranlib
|
RANLIB = $(LLVMBIN)llvm-ranlib
|
||||||
@@ -57,10 +57,9 @@ TAGSFILE = tags
|
|||||||
MANROFF = nroff -man -h -Tascii
|
MANROFF = nroff -man -h -Tascii
|
||||||
ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout
|
ELF2AOUT = $(TOPSRC)/tools/elf2aout/elf2aout
|
||||||
|
|
||||||
CFLAGS = -Os
|
CFLAGS = -Os -nostdinc
|
||||||
|
|
||||||
LDFLAGS = -N -nostartfiles -fno-dwarf2-cfi-asm -T$(TOPSRC)/src/elf32-mips.ld \
|
LDFLAGS = -T$(TOPSRC)/src/elf32-mips.ld $(TOPSRC)/src/crt0.o -L$(TOPSRC)/src
|
||||||
$(TOPSRC)/src/crt0.o -L$(TOPSRC)/src
|
|
||||||
LIBS = -lc
|
LIBS = -lc
|
||||||
|
|
||||||
# Enable mips16e instruction set by default
|
# Enable mips16e instruction set by default
|
||||||
|
|||||||
Reference in New Issue
Block a user