Re: [AD] ASM Porting

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


OK, I finally got the chance to work on a quick (and ugly!) hack with this and
I think I got it working.  Right now I can't test to see if it re-assembles
correctly for various reasons, but here it is if you're feeling lucky.  :)
You need to replace the appropriate part of the makefile with this.  (You
might also need to monkey around with the last few lines of the sed script to
get name exporting quite right, since I don't know Watcom's rules for
prefixing underscores on function names.)

$(OBJ_DIR)/%.obj: %.s
 gcc $(GCC2WATCOM) $(SFLAGS) -I. -I./include -x assembler-with-cpp -o
$(OBJ_DIR)/$*.oa -c $<
 objdump --source $(OBJ_DIR)/$*.oa > $(OBJ_DIR)/$*.lst

 echo [BITS 32] > $(OBJ_DIR)/$*.asm
 echo [SECTION code use32] >> $(OBJ_DIR)/$*.asm
 sed -e "s/[0-9a-f ]\{4\}: \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\)
\([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\) / db
0x\1,0x\2,0x\3,0x\4,0x\5 ; /" \
  -e "s/[0-9a-f ]\{4\}: \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\)
\([0-9a-f]\{2\}\)/ db 0x\1,0x\2,0x\3,0x\4 ; /" \
  -e "s/[0-9a-f ]\{4\}: \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\)/
db 0x\1,0x\2,0x\3 ; /" \
  -e "s/[0-9a-f ]\{4\}: \([0-9a-f]\{2\}\) \([0-9a-f]\{2\}\)/ db 0x\1,0x\2 ; /"
\
  -e "s/[0-9a-f ]\{4\}: \([0-9a-f]\{2\}\)/ db 0x\1 ; /" \
  -e "s/[0-9a-f ]\{8\} <_\([0-9a-zA-Z_. ]*\)>:/global _\1\n_\1:/" \
  -e "s/[0-9a-f ]\{8\} <\([0-9a-zA-Z_. ]*\)>:/\1:/" \
  -e "1,5d" \
  $(OBJ_DIR)/$*.lst >> $(OBJ_DIR)/$*.asm
 nasm -f obj -o $(OBJ_DIR)/$*.obj $(OBJ_DIR)/$*.asm

Greg Hackmann wrote:

> I've been trying to look for a workaround (I'm trying to build Allegro
> under Borland C++Builder, which like Watcom uses the OMF file format
> rather than DJGPP's COFF), but I haven't had much time recently because of
> schoolwork.  I tried to use objdump combined with att2intl, but some of
> the opcodes don't disassemble properly.  (For example, some of the cmpl's
> disassemble as cmpl 0x0, $something which obviously isn't right.)  So when
> I get some time I'm going to try to use the objdump source to make a quick
> hack that disassembles everything into opcodes (.db xxx, xxx, xxx etc.)
> plus the labels and see how NASM takes to that.
>
> Charles-Warren Wardlaw wrote:
>
> > Hello again,
> >
> > With the recent difficulties I've encountered trying to compile the
> > Watcom library, I've been wondering: has the idea to use NASM been
> > reconsidered as an alternative to the current method?  I know that,
> > originally, Shawn didn't want the library to be dependent on tools
> > outside of the bare-bones DJGPP distribution, but since SED is a
> > separate addon package (and build problems for ports aren't limited to
> > me), is this argument still valid?
> >
> > - Charles Wardlaw



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/