Commit a73dfb97 authored by PoroCYon's avatar PoroCYon Committed by PoroCYon
Browse files

fix stupid 32-bit compilation failure

parent 5b262ffc
......@@ -32,14 +32,14 @@ CXXFLAGS += -m$(BITS)
LIBS=-lc
ASFLAGS += -DUSE_INTERP
ASFLAGS += -DUSE_INTERP -DALIGN_STACK
NASM ?= nasm
PYTHON3 ?= python3
all: $(BINDIR)/hello $(BINDIR)/sdl
LIBS += -lSDL2 -lGL
LIBS += -lX11 #-lSDL2 -lGL
clean:
@$(RM) -vrf $(OBJDIR) $(BINDIR)
......@@ -57,15 +57,15 @@ $(OBJDIR)/%.o: $(TESTDIR)/%.c $(OBJDIR)/
$(OBJDIR)/%.start.o: $(OBJDIR)/%.o $(OBJDIR)/crt1.o
$(LD) $(LDFLAGS) -r -o "$@" $^
$(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.start.o
$(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.o
$(PYTHON3) ./smol.py $(LIBS) "$<" "$@"
$(OBJDIR)/stub.%.o: $(OBJDIR)/symbols.%.asm $(SRCDIR)/header32.asm \
$(SRCDIR)/loader32.asm
$(NASM) $(ASFLAGS) $< -o $@
$(BINDIR)/%: $(OBJDIR)/%.start.o $(OBJDIR)/stub.%.o $(BINDIR)/
$(LD) -Map=$(BINDIR)/$*.map $(LDFLAGS_) $(OBJDIR)/$*.start.o $(OBJDIR)/stub.$*.o -o "$@"
$(BINDIR)/%: $(OBJDIR)/%.o $(OBJDIR)/stub.%.o $(BINDIR)/
$(LD) -Map=$(BINDIR)/$*.map $(LDFLAGS_) $(OBJDIR)/$*.o $(OBJDIR)/stub.$*.o -o "$@"
.PHONY: all clean
......@@ -9,11 +9,11 @@ def output_x86(libraries, outf):
shorts = { l: l.split('.', 1)[0].lower().replace('-', '_') for l in libraries }
outf.write('%include "header32.asm"\n')
outf.write('.dynamic.needed:\n')
outf.write('dynamic.needed:\n')
for library in libraries:
outf.write('dd 1;DT_NEEDED\n')
outf.write('dd (_symbols.{} - _symbols)\n'.format(shorts[library]))
outf.write('.dynamic.end:\n')
outf.write('dynamic.end:\n')
# if needgot:
# outf.write('global _GLOBAL_OFFSET_TABLE_\n')
......
......@@ -60,10 +60,10 @@ header:
%endif
.segments.dynamic:
dd PT_DYNAMIC ; {e_phnum: 2, e_shentsize: 0}, p_type
dd (.dynamic - header) ; {e_shnum: <junk>, e_shstrnd: <junk>}, p_offset
dd .dynamic, 0 ; p_vaddr, p_paddr
dd (.dynamic.end - .dynamic) ; p_filesz
dd (.dynamic.end - .dynamic) ; p_memsz
dd (dynamic - header) ; {e_shnum: <junk>, e_shstrnd: <junk>}, p_offset
dd dynamic, 0 ; p_vaddr, p_paddr
dd (dynamic.end - dynamic) ; p_filesz
dd (dynamic.end - dynamic) ; p_memsz
dd 0, 0 ; p_flags, p_align
%ifndef USE_NX
.segments.load:
......@@ -84,11 +84,11 @@ header:
%endif
global _DYNAMIC
_DYNAMIC:
.dynamic:
.dynamic.strtab:
dynamic:
dynamic.strtab:
dd DT_STRTAB ; d_tag
dd _symbols ; d_un.d_ptr
.dynamic.symtab:
dynamic.symtab:
; this is required to be present or ld.so will crash, but it can be bogus
dd DT_SYMTAB ; d_tag: 6 = DT_SYMTAB
dd 0 ; d_un.d_ptr
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment