Skip to content

Commit

Permalink
[cmds] Get hostdisasm working again
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Nov 24, 2024
1 parent 1d539e5 commit 874c23f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion elkscmd/Applications
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,6 @@ basic/basic :basic :1200k
advent/advent :other :1440c
advent/advent.db ::lib/advent.db :other :1440c
debug/disasm :other :1440k
debug/nm :other :1440c
debug/nm86 :other :1440c
debug/system.sym ::lib/system.sym :other :1440c
debug/testsym :other :1440c
6 changes: 3 additions & 3 deletions elkscmd/debug/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*.o
disasm
nm86
nm
opcodes
testsym
disasm
hostdisasm
opcodes
hostnm
8 changes: 4 additions & 4 deletions elkscmd/debug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ LDFLAGS += -maout-symtab

###############################################################################

PRGS = testsym disasm nm opcodes
PRGS = testsym disasm nm86 opcodes

HOSTPRGS = nm86 hostdisasm
HOSTPRGS = hostnm86 hostdisasm
HOSTCFLAGS += -I. -I$(TOPDIR)/elks/include
SYMS_C = $(TOPDIR)/libc/debug/syms.c

Expand All @@ -35,7 +35,7 @@ testsym: testsym.o
disasm: dis.o disasm.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

nm: nm86.o
nm86: nm86.o
$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)

system.sym:
Expand All @@ -54,7 +54,7 @@ dis.o: dis.c
nm86.o: nm86.c
$(CC) $(CFLAGS) $(NOINSTFLAGS) -c -o $*.o $<

nm86: nm86.c $(SYMS_C)
hostnm86: nm86.c $(SYMS_C)
$(HOSTCC) $(HOSTCFLAGS) -D__far= -o $@ $^

hostdisasm: dis.c disasm.c $(SYMS_C)
Expand Down
6 changes: 5 additions & 1 deletion elkscmd/debug/disasm.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* ELKS disassembler header file */

#define noinstrument __attribute__((no_instrument_function))
#ifdef __ELKS__
#include <sys/cdefs.h>
#else
#define noinstrument
#endif

/* to be defined by caller of disasm() */
char * noinstrument getsymbol(int seg, int offset);
Expand Down
2 changes: 1 addition & 1 deletion libc/ia16.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile include for ia16-elf-gcc build

INCLUDES=-I$(TOPDIR)/include -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include
DEFINES=-D__LIBC__
DEFINES=-D__LIBC__ -D__ELKS__
LIBOBJS=$(OBJS)

INCS=$(INCLUDES)
Expand Down
4 changes: 4 additions & 0 deletions libc/include/debug/instrument.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* ELKS stack trace and instrumentation functions library */
/* Jan 2023 Greg Haerr */
#ifdef __ELKS__
#include <sys/cdefs.h>
#else
#define noinstrument
#endif

/* calc_push_count returns */
#define BP_PUSHED 0x0100
Expand Down
4 changes: 4 additions & 0 deletions libc/include/debug/syms.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* ELKS symbol table support */
#ifdef __ELKS__
#include <sys/cdefs.h>
#else
#define noinstrument
#endif

/* symbol table format
* | byte type | word address | byte symbol length | symbol |
Expand Down
2 changes: 1 addition & 1 deletion libc/watcom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ endif

INCLUDES = -I$(TOPDIR)/libc/include -I$(TOPDIR)/elks/include
INCLUDES += -I$(WATCOM)/h
DEFINES = -D__LIBC__
DEFINES = -D__LIBC__ -D__ELKS__
LIBOBJS=$(OBJS:.o=.obj)

include $(TOPDIR)/libc/watcom.model
Expand Down

0 comments on commit 874c23f

Please sign in to comment.