Skip to content

Commit

Permalink
mcode: add support for x86-64
Browse files Browse the repository at this point in the history
  • Loading branch information
gingold-adacore committed Jan 6, 2016
1 parent 955e964 commit b5797a5
Show file tree
Hide file tree
Showing 44 changed files with 4,079 additions and 1,689 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ GHDL_MCODE_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir
ghdl_mcode: GRT_FLAGS+=-DWITH_GNAT_RUN_TIME
ghdl_mcode: $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \
memsegs_c.o chkstk.o force
$(GNATMAKE) -o $@ $(GHDL_MCODE_INCFLAGS) $(GNATFLAGS) ghdl_jit.adb $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB))
$(GNATMAKE) -o $@ $(GHDL_MCODE_INCFLAGS) $(GNATFLAGS) -gnatw.A ghdl_jit.adb $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB))

memsegs_c.o: $(srcdir)/src/ortho/mcode/memsegs_c.c
$(CC) -c $(OPT_FLAGS) -o $@ $<
Expand Down
23 changes: 17 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ echo "Build machine is: $build"

# For mcode, check that gcc emits i386
if test $backend = mcode; then
if ! $CC $CFLAGS -dumpmachine | grep -q "[3-6]86"; then
echo "WARNING: GHDL for mcode is supported only on x86 (32 bits)"
echo "continuing, but build failure expected (See the README)"
fi
gcc_machine=`$CC $CFLAGS -dumpmachine`
case "$gcc_machine" in
i[3-6]86*) mcode64="" ;;
x86_64*) mcode64="64" ;;
*)
mcode64=""
echo "WARNING: GHDL for mcode is supported only on x86"
echo "continuing, but build failure expected (See the README)"
;;
esac
if test "x$backtrace_lib" != x ; then
echo "WARNING: --with-backtrace-lib= ignored with mcode"
backtrace_lib=
Expand Down Expand Up @@ -205,16 +211,21 @@ fi
# Generate ortho_code-x86-flags
if test $backend = mcode; then
case "$build" in
*darwin*) ortho_flags="Flags_Macosx" ;;
*darwin*) ortho_flags="Flags_Macosx${mcode64}" ;;
*mingw32*) ortho_flags="Flags_Windows" ;;
*linux*) ortho_flags="Flags_Linux" ;;
*linux*) ortho_flags="Flags_Linux${mcode64}" ;;
*) echo "Unsupported $build build for mcode"; exit 1;;
esac
echo "Generate ortho_code-x86-flags.ads"
{
echo "with Ortho_Code.X86.$ortho_flags;"
echo "package Ortho_Code.X86.Flags renames Ortho_Code.X86.$ortho_flags;"
} > ortho_code-x86-flags.ads
echo "Generate elf_arch.ads"
{
echo "with Elf_Arch${mcode64:-32};"
echo "package Elf_Arch renames Elf_Arch${mcode64:-32};"
} > elf_arch.ads
fi

# Generate default_pathes.ads
Expand Down
6 changes: 4 additions & 2 deletions src/ortho/debug/ortho_debug-disp.adb
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,10 @@ package body Ortho_Debug.Disp is
while El /= O_Cnode_Null loop
Set_Mark;
Disp_Ident (El.E_Name);
Put (" = ");
Put (Image (El.E_Val));
if False then
Put (" = ");
Put (Image (El.E_Val));
end if;
El := El.E_Next;
exit when El = O_Cnode_Null;
Put (", ");
Expand Down
2 changes: 1 addition & 1 deletion src/ortho/mcode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ all: $(ortho_exec)

$(ortho_exec): $(ortho_srcdir)/mcode/ortho_mcode.ads memsegs_c.o force
$(GNATMAKE) -o $@ -g -aI$(ortho_srcdir)/mcode -aI$(ortho_srcdir) \
-aI$(ortho_srcdir)/.. $(GNAT_FLAGS) ortho_code_main \
-aI$(ortho_srcdir)/.. $(GNAT_FLAGS) -gnatw.A ortho_code_main \
-bargs -E -largs memsegs_c.o #-static

memsegs_c.o: $(ortho_srcdir)/mcode/memsegs_c.c
Expand Down

0 comments on commit b5797a5

Please sign in to comment.