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) ...@@ -32,14 +32,14 @@ CXXFLAGS += -m$(BITS)
LIBS=-lc LIBS=-lc
ASFLAGS += -DUSE_INTERP ASFLAGS += -DUSE_INTERP -DALIGN_STACK
NASM ?= nasm NASM ?= nasm
PYTHON3 ?= python3 PYTHON3 ?= python3
all: $(BINDIR)/hello $(BINDIR)/sdl all: $(BINDIR)/hello $(BINDIR)/sdl
LIBS += -lSDL2 -lGL LIBS += -lX11 #-lSDL2 -lGL
clean: clean:
@$(RM) -vrf $(OBJDIR) $(BINDIR) @$(RM) -vrf $(OBJDIR) $(BINDIR)
...@@ -57,15 +57,15 @@ $(OBJDIR)/%.o: $(TESTDIR)/%.c $(OBJDIR)/ ...@@ -57,15 +57,15 @@ $(OBJDIR)/%.o: $(TESTDIR)/%.c $(OBJDIR)/
$(OBJDIR)/%.start.o: $(OBJDIR)/%.o $(OBJDIR)/crt1.o $(OBJDIR)/%.start.o: $(OBJDIR)/%.o $(OBJDIR)/crt1.o
$(LD) $(LDFLAGS) -r -o "$@" $^ $(LD) $(LDFLAGS) -r -o "$@" $^
$(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.start.o $(OBJDIR)/symbols.%.asm: $(OBJDIR)/%.o
$(PYTHON3) ./smol.py $(LIBS) "$<" "$@" $(PYTHON3) ./smol.py $(LIBS) "$<" "$@"
$(OBJDIR)/stub.%.o: $(OBJDIR)/symbols.%.asm $(SRCDIR)/header32.asm \ $(OBJDIR)/stub.%.o: $(OBJDIR)/symbols.%.asm $(SRCDIR)/header32.asm \
$(SRCDIR)/loader32.asm $(SRCDIR)/loader32.asm
$(NASM) $(ASFLAGS) $< -o $@ $(NASM) $(ASFLAGS) $< -o $@
$(BINDIR)/%: $(OBJDIR)/%.start.o $(OBJDIR)/stub.%.o $(BINDIR)/ $(BINDIR)/%: $(OBJDIR)/%.o $(OBJDIR)/stub.%.o $(BINDIR)/
$(LD) -Map=$(BINDIR)/$*.map $(LDFLAGS_) $(OBJDIR)/$*.start.o $(OBJDIR)/stub.$*.o -o "$@" $(LD) -Map=$(BINDIR)/$*.map $(LDFLAGS_) $(OBJDIR)/$*.o $(OBJDIR)/stub.$*.o -o "$@"
.PHONY: all clean .PHONY: all clean
...@@ -9,11 +9,11 @@ def output_x86(libraries, outf): ...@@ -9,11 +9,11 @@ def output_x86(libraries, outf):
shorts = { l: l.split('.', 1)[0].lower().replace('-', '_') for l in libraries } shorts = { l: l.split('.', 1)[0].lower().replace('-', '_') for l in libraries }
outf.write('%include "header32.asm"\n') outf.write('%include "header32.asm"\n')
outf.write('.dynamic.needed:\n') outf.write('dynamic.needed:\n')
for library in libraries: for library in libraries:
outf.write('dd 1;DT_NEEDED\n') outf.write('dd 1;DT_NEEDED\n')
outf.write('dd (_symbols.{} - _symbols)\n'.format(shorts[library])) outf.write('dd (_symbols.{} - _symbols)\n'.format(shorts[library]))
outf.write('.dynamic.end:\n') outf.write('dynamic.end:\n')
# if needgot: # if needgot:
# outf.write('global _GLOBAL_OFFSET_TABLE_\n') # outf.write('global _GLOBAL_OFFSET_TABLE_\n')
......
...@@ -60,10 +60,10 @@ header: ...@@ -60,10 +60,10 @@ header:
%endif %endif
.segments.dynamic: .segments.dynamic:
dd PT_DYNAMIC ; {e_phnum: 2, e_shentsize: 0}, p_type dd PT_DYNAMIC ; {e_phnum: 2, e_shentsize: 0}, p_type
dd (.dynamic - header) ; {e_shnum: <junk>, e_shstrnd: <junk>}, p_offset dd (dynamic - header) ; {e_shnum: <junk>, e_shstrnd: <junk>}, p_offset
dd .dynamic, 0 ; p_vaddr, p_paddr dd dynamic, 0 ; p_vaddr, p_paddr
dd (.dynamic.end - .dynamic) ; p_filesz dd (dynamic.end - dynamic) ; p_filesz
dd (.dynamic.end - .dynamic) ; p_memsz dd (dynamic.end - dynamic) ; p_memsz
dd 0, 0 ; p_flags, p_align dd 0, 0 ; p_flags, p_align
%ifndef USE_NX %ifndef USE_NX
.segments.load: .segments.load:
...@@ -84,11 +84,11 @@ header: ...@@ -84,11 +84,11 @@ header:
%endif %endif
global _DYNAMIC global _DYNAMIC
_DYNAMIC: _DYNAMIC:
.dynamic: dynamic:
.dynamic.strtab: dynamic.strtab:
dd DT_STRTAB ; d_tag dd DT_STRTAB ; d_tag
dd _symbols ; d_un.d_ptr 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 ; 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 DT_SYMTAB ; d_tag: 6 = DT_SYMTAB
dd 0 ; d_un.d_ptr 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