Skip to content

Commit

Permalink
Update to release v1.8f
Browse files Browse the repository at this point in the history
  • Loading branch information
mbitsnbites committed Jul 4, 2019
1 parent 244f8bb commit 1d8698e
Show file tree
Hide file tree
Showing 78 changed files with 3,071 additions and 927 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ set(vasm_sources
hugeint.c
cond.c
supp.c
dwarf.c
osdep.c
cpus/${VASM_CPU}/cpu.c
syntax/${VASM_SYNTAX}/syntax.c
output_test.c
Expand All @@ -26,6 +28,7 @@ set(vasm_sources
output_hunk.c
output_aout.c
output_tos.c
output_xfile.c
output_srec.c
)
set(vasm_exe vasm${VASM_CPU}_${VASM_SYNTAX})
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Unix
# Define CC, when no compiler with the name "cc" exists.

TARGET =
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CCOUT = -o
COPTS = -c -O2 $(OUTFMTS)
COPTS = -c -O2 -DUNIX $(OUTFMTS)

LD = $(CC)
LDOUT = $(CCOUT)
Expand Down
3 changes: 2 additions & 1 deletion Makefile.68k
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _os3
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +aos68k
CCOUT = -o
Expand Down
18 changes: 18 additions & 0 deletions Makefile.Cygwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Windows compiled with gcc

TARGET = _win32
TARGETEXTENSION = .exe
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = gcc
CCOUT = -o
COPTS = -c -O2 -D_WIN32 $(OUTFMTS)

LD = $(CC)
LDOUT = $(CCOUT)
LDFLAGS = -lm

RM = rm -f

include make.rules
3 changes: 2 additions & 1 deletion Makefile.Haiku
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET =
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = gcc
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.MOS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _mos
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +morphos
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.MiNT
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _MiNT
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +mint
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.OS4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _os4
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +aosppc
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.PUp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _pup
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +powerup
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.TOS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _TOS
TARGETEXTENSION = .ttp
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +tos
CCOUT = -o
Expand Down
3 changes: 2 additions & 1 deletion Makefile.WOS
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

TARGET = _wos
TARGETEXTENSION =
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

CC = vc +warpos
CCOUT = -o
Expand Down
6 changes: 4 additions & 2 deletions Makefile.Win32
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Windows
# Tested with Visual Studio 2017: works fine under the Developer Command Prompt for VS2017
# Tested with Visual Studio 2005 Express Edition: works fine
# Tested with Visual C++ Toolkit 2003: works fine, but needs an external make tool (nmake is not included)

TARGET = _win32
TARGETEXTENSION = .exe
OUTFMTS = /DOUTAOUT /DOUTBIN /DOUTELF /DOUTHUNK /DOUTSREC /DOUTTOS /DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL

# If Visual Studio is unable to find <windows.h> when compiling vlink, try enabling the two
# lines below, and point them to where you have installed the Win32 Platform SDK.
Expand All @@ -23,6 +25,6 @@ LD = link
LDOUT = /OUT:
LDFLAGS = /NOLOGO $(WIN32_PLATFORMSDK_LIB)

RM = del
RM = rem

include make.rules
6 changes: 4 additions & 2 deletions Makefile.Win32FromLinux
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

TARGET = _win32
TARGETEXTENSION = .exe
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ
OUTFMTS = -DOUTAOUT -DOUTBIN -DOUTELF -DOUTHUNK -DOUTSREC -DOUTTOS -DOUTVOBJ \
-DOUTXFIL


CC = /usr/bin/i586-mingw32msvc-gcc
#CC = /usr/bin/i586-mingw32msvc-gcc
CC = /usr/bin/i686-w64-mingw32-gcc
CCOUT = -o
COPTS = -c -O2 $(OUTFMTS)

Expand Down
70 changes: 65 additions & 5 deletions atom.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* atom.c - atomic objects from source */
/* (c) in 2010-2016 by Volker Barthelmann and Frank Wille */
/* (c) in 2010-2019 by Volker Barthelmann and Frank Wille */

#include "vasm.h"

Expand Down Expand Up @@ -148,6 +148,7 @@ sblock *new_sblock(expr *space,size_t size,expr *fill)
memset(sb->fill,0,MAXPADBYTES);
sb->relocs = 0;
sb->maxalignbytes = 0;
sb->flags = 0;
return sb;
}

Expand All @@ -156,11 +157,8 @@ static size_t space_size(sblock *sb,section *sec,taddr pc)
{
utaddr space=0;

if (eval_expr(sb->space_exp,&space,sec,pc) || !final_pass) {
if (eval_expr(sb->space_exp,&space,sec,pc) || !final_pass)
sb->space = space;
if ((utaddr)(pc+space) < (utaddr)pc)
general_error(45); /* illegal negative value */
}
else
general_error(30); /* expression must be constant */

Expand Down Expand Up @@ -446,6 +444,68 @@ atom *clone_atom(atom *a)
}


atom *add_data_atom(section *sec,size_t sz,taddr alignment,taddr c)
{
dblock *db = new_dblock();
atom *a;

db->size = sz;
db->data = mymalloc(sz);
if (sz > 1)
setval(BIGENDIAN,db->data,sz,c);
else
*(db->data) = c;

a = new_data_atom(db,alignment);
add_atom(sec,a);
return a;
}


void add_leb128_atom(section *sec,taddr c)
{
taddr b;

do {
b = c & 0x7f;
if ((c >>= 7) != 0)
b |= 0x80;
add_data_atom(sec,1,1,b);
} while (c != 0);
}


void add_sleb128_atom(section *sec,taddr c)
{
int done = 0;
taddr b;

do {
b = c & 0x7f;
c >>= 7; /* assumes arithmetic shifts! */
if ((c==0 && !(b&0x40)) || (c==-1 && (b&0x40)))
done = 1;
else
b |= 0x80;
add_data_atom(sec,1,1,b);
} while (!done);
}


atom *add_bytes_atom(section *sec,void *p,size_t sz)
{
dblock *db = new_dblock();
atom *a;

db->size = sz;
db->data = mymalloc(sz);
memcpy(db->data,p,sz);
a = new_data_atom(db,1);
add_atom(sec,a);
return a;
}


static atom *new_atom(int type,taddr align)
{
atom *new = mymalloc(sizeof(*new));
Expand Down
10 changes: 9 additions & 1 deletion atom.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* atom.h - atomic objects from source */
/* (c) in 2010-2016 by Volker Barthelmann and Frank Wille */
/* (c) in 2010-2019 by Volker Barthelmann and Frank Wille */

#ifndef ATOM_H
#define ATOM_H
Expand Down Expand Up @@ -53,7 +53,9 @@ struct sblock {
expr *fill_exp; /* copied to fill, when evaluated - may be NULL */
rlist *relocs;
taddr maxalignbytes;
uint32_t flags;
};
#define SPC_DATABSS 1 /* make sure no to allocate space in a data section */

typedef struct printexpr {
expr *print_exp;
Expand Down Expand Up @@ -119,6 +121,12 @@ void print_atom(FILE *,atom *);
void atom_printexpr(printexpr *,section *,taddr);
atom *clone_atom(atom *);

atom *add_data_atom(section *,size_t,taddr,taddr);
void add_leb128_atom(section *,taddr);
void add_sleb128_atom(section *,taddr);
atom *add_bytes_atom(section *,void *,size_t);
#define add_string_atom(s,p) add_bytes_atom(s,p,strlen(p)+1)

atom *new_inst_atom(instruction *);
atom *new_data_atom(dblock *,taddr);
atom *new_label_atom(symbol *);
Expand Down
Loading

0 comments on commit 1d8698e

Please sign in to comment.