Hi there,
>
> Simply submit the patches to this mailing list. Please, put
> the patches in the body (no attachement), so that it is easier
> to comment them.
>
I'll take this as an invitation to post the current patch (against
changeset 330) for the recently discussed cross compilation support for
mingw32msvc.
Relevant changes:
- Added --AS and --LD options to ghdl1 for explicit asm/linker specification
- *_FOR_TARGET defines introduced
Compiling the cross ghdl for mingw32-mvsc can be a bit of a bitch
(depending on preinstalled support) and isn't fully automated yet, so
for now it will remain a rather undocumented multi stage procedure.
Cheers,
- Martin
--
diff -r 6de9ed66d019 ortho/gcc/Makefile.inc
--- a/ortho/gcc/Makefile.inc Sat Feb 01 04:43:41 2014 +0100
+++ b/ortho/gcc/Makefile.inc Sun Feb 02 16:56:41 2014 +0100
@@ -31,16 +31,16 @@
AGCC_DEPS := $(AGCC_LOCAL_OBJS)
AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
- $(AGCC_GCCOBJ_DIR)gcc/toplev.o \
- $(AGCC_GCCOBJ_DIR)gcc/vec.o \
- $(AGCC_GCCOBJ_DIR)gcc/attribs.o \
- $(AGCC_GCCOBJ_DIR)gcc/libbackend.a \
- $(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
- $(AGCC_GCCOBJ_DIR)libiberty/libiberty.a
+ $(AGCC_GCCOBJ_DIR)/gcc/toplev.o \
+ $(AGCC_GCCOBJ_DIR)/gcc/vec.o \
+ $(AGCC_GCCOBJ_DIR)/gcc/attribs.o \
+ $(AGCC_GCCOBJ_DIR)/gcc/libbackend.a \
+ $(AGCC_GCCOBJ_DIR)/libcpp/libcpp.a \
+ $(AGCC_GCCOBJ_DIR)/libiberty/libiberty.a
ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
- $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
- $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
+ $(AGCC_GCCOBJ_DIR)/gcc/gtype-vhdl.h \
+ $(AGCC_GCCOBJ_DIR)/gcc/gt-vhdl-ortho-lang.h
$(COMPILER) -c -o $@ $< $(AGCC_CFLAGS) $(INCLUDES)
agcc-clean: force
diff -r 6de9ed66d019 translate/gcc/Make-lang.in
--- a/translate/gcc/Make-lang.in Sat Feb 01 04:43:41 2014 +0100
+++ b/translate/gcc/Make-lang.in Sun Feb 02 16:56:41 2014 +0100
@@ -48,6 +48,10 @@
"GHDL_ADAFLAGS=$(GHDL_ADAFLAGS)" \
"GNATMAKE=$(GNATMAKE)" \
"GNATBIND=$(GNATBIND)" \
+ "GNATMAKE_FOR_TARGET=$(GNATMAKE_FOR_TARGET)" \
+ "GNATBIND_FOR_TARGET=$(GNATBIND_FOR_TARGET)" \
+ "ADAC=$(TARGET_CC)" \
+ "GRT_TARGET_CC=$(TARGET_CC)" \
"CFLAGS=$(CFLAGS)" \
"VHDL_LIB_DIR=$(VHDL_LIB_DIR)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
@@ -95,8 +99,6 @@
vhdl.all.build:
vhdl.all.cross:
- @echo "No support for building vhdl cross-compiler"
- exit 1
vhdl.start.encap:
vhdl.rest.encap:
@@ -124,11 +126,23 @@
vhdl.install-plugin:
-# Install the driver program as ghdl.
+GHDL_INSTALL_NAME = $(shell echo ghdl$(exeext) | \
+ sed '$(program_transform_name)')
+
+GNATMAKE_FOR_TARGET = $(shell echo gnatmake | \
+ sed '$(program_transform_name)')
+
+GNATBIND_FOR_TARGET = $(shell echo gnatbind | \
+ sed '$(program_transform_name)')
+
+TARGET_CC = $(shell echo gcc | \
+ sed '$(program_transform_name)')
+
+# Install the driver program as ghdl or $(CROSS)-ghdl.
vhdl.install-common: ghdl$(exeext)
-mkdir $(DESTDIR)$(bindir)
-$(RM) $(DESTDIR)$(bindir)/ghdl$(exeext)
- $(INSTALL_PROGRAM) ghdl$(exeext) $(DESTDIR)$(bindir)/ghdl$(exeext)
+ $(INSTALL_PROGRAM) ghdl$(exeext)
$(DESTDIR)$(bindir)/$(GHDL_INSTALL_NAME)
# Install the library
$(MAKE_IN_VHDL) install-ghdllib
diff -r 6de9ed66d019 translate/gcc/Makefile.in
--- a/translate/gcc/Makefile.in Sat Feb 01 04:43:41 2014 +0100
+++ b/translate/gcc/Makefile.in Sun Feb 02 16:56:41 2014 +0100
@@ -80,7 +80,7 @@
X_ADAFLAGS =
T_ADAFLAGS =
-ADAC = $(CC)
+ADAC ?= $(CC)
ECHO = echo
CHMOD = chmod
@@ -122,8 +122,8 @@
# We don't use cross-make. Instead we use the tools from the build tree,
# if they are available.
# program_transform_name and objdir are set by configure.in.
-program_transform_name =
-objdir = .
+# program_transform_name =
+# objdir = .
target=@target@
target_alias=@target_alias@
@@ -197,7 +197,8 @@
LIB93_DIR:=./lib/v93
LIB87_DIR:=./lib/v87
LIBSRC_DIR:=$(srcdir)/libraries
-ANALYZE=../ghdl -a --GHDL1=../ghdl1 --ieee=none
+ANALYZE=../ghdl -a --GHDL1=../ghdl1 --ieee=none \
+ --AS=$(AS_FOR_TARGET) --LD=$(LD_FOR_TARGET)
$(LIB93_DIR) $(LIB87_DIR):
$(srcdir)/../../mkinstalldirs $@
@@ -223,7 +224,7 @@
GHDL1=../ghdl1
GRTSRCDIR=$(srcdir)/grt
-GRT_RANLIB=$(RANLIB)
+GRT_RANLIB=$(RANLIB_FOR_TARGET)
####grt Makefile.inc
@@ -269,7 +270,8 @@
PDIR=`pwd` && cd $(DESTDIR)$(VHDL_LIB_DIR) && \
$(MAKE) -f $$PDIR/Makefile REL_DIR=../../.. \
LIBSRC_DIR="src" LIB93_DIR=lib/v93 LIB87_DIR=lib/v87 \
- ANALYZE="$$PDIR/../ghdl -a --GHDL1=$$PDIR/../ghdl1 --ieee=none" \
+ ANALYZE="$$PDIR/../ghdl -a --GHDL1=$$PDIR/../ghdl1 --ieee=none \
+ --AS=$(AS_FOR_TARGET) --LD=$(LD_FOR_TARGET) -O" \
std.v93 std.v87 ieee.v93 ieee.v87 synopsys.v93 synopsys.v87 mentor.v93
# Copy std_standard (this is done after libraries, since they remove dirs).
$(INSTALL_DATA) std87_standard.o \
diff -r 6de9ed66d019 translate/ghdldrv/ghdldrv.adb
--- a/translate/ghdldrv/ghdldrv.adb Sat Feb 01 04:43:41 2014 +0100
+++ b/translate/ghdldrv/ghdldrv.adb Sun Feb 02 16:56:41 2014 +0100
@@ -40,11 +40,13 @@
package body Ghdldrv is
-- Name of the tools used.
+ Assembler_Cmd : String_Access := null;
+ Linker_Cmd : String_Access := null;
Compiler_Cmd : String_Access := null;
Post_Processor_Cmd : String_Access := null;
- Assembler_Cmd : constant String := "as";
- Linker_Cmd : constant String := "gcc";
-
+ Default_Assembler_Cmd : constant String := "as";
+ Default_Linker_Cmd : constant String := "gcc";
+
-- Path of the tools.
Compiler_Path : String_Access;
Post_Processor_Path : String_Access;
@@ -506,6 +508,12 @@
procedure Set_Tools_Name
is
begin
+ if Assembler_Cmd = null then
+ Assembler_Cmd := new String'(Default_Assembler_Cmd);
+ end if;
+ if Linker_Cmd = null then
+ Linker_Cmd := new String'(Default_Linker_Cmd);
+ end if;
-- Set tools name.
if Compiler_Cmd = null then
case Compile_Kind is
@@ -537,9 +545,9 @@
end if;
end if;
if Compile_Kind >= Compile_Gcc then
- Assembler_Path := Locate_Exec_On_Path (Assembler_Cmd);
+ Assembler_Path := Locate_Exec_On_Path (Assembler_Cmd.all);
if Assembler_Path = null and not Flag_Asm then
- Tool_Not_Found (Assembler_Cmd);
+ Tool_Not_Found (Assembler_Cmd.all);
end if;
end if;
Linker_Path := Locate_Exec_On_Path (Linker_Cmd);
@@ -613,6 +621,12 @@
elsif Opt'Length > 8 and then Opt (1 .. 8) = "--GHDL1=" then
Compiler_Cmd := new String'(Opt (9 .. Opt'Last));
Res := Option_Ok;
+ elsif Opt'Length > 5 and then Opt (1 .. 5) = "--LD=" then
+ Linker_Cmd := new String'(Opt (6 .. Opt'Last));
+ Res := Option_Ok;
+ elsif Opt'Length > 5 and then Opt (1 .. 5) = "--AS=" then
+ Assembler_Cmd := new String'(Opt (6 .. Opt'Last));
+ Res := Option_Ok;
elsif Opt = "-S" then
Flag_Asm := True;
Res := Option_Ok;
@@ -693,6 +707,8 @@
Disp_Long_Help (Command_Lib (Cmd));
Put_Line (" -v Be verbose");
Put_Line (" --GHDL1=PATH Set the path of the ghdl1 compiler");
+ Put_Line (" --AS=PATH explicitely specify assembler");
+ Put_Line (" --LD=PATH explicitely specify linker");
Put_Line (" -S Do not assemble");
Put_Line (" -o FILE Set the name of the output file");
-- Put_Line (" -m32 Generate 32bit code on 64bit machines");
@@ -747,10 +763,10 @@
end if;
if Compile_Kind >= Compile_Gcc then
Put ("assembler command: ");
- Put_Line (Assembler_Cmd);
+ Put_Line (Assembler_Cmd.all);
end if;
Put ("linker command: ");
- Put_Line (Linker_Cmd);
+ Put_Line (Linker_Cmd.all);
Put ("command line prefix (--PREFIX): ");
if Prefix_Path = null then
diff -r 6de9ed66d019 translate/grt/Makefile.inc
--- a/translate/grt/Makefile.inc Sat Feb 01 04:43:41 2014 +0100
+++ b/translate/grt/Makefile.inc Sun Feb 02 16:56:41 2014 +0100
@@ -86,6 +86,9 @@
ifeq ($(filter-out i%86 mingw32,$(arch) $(osys)),)
GRT_TARGET_OBJS=win32.o clock.o
endif
+ifeq ($(filter-out i%86 mingw32msvc,$(arch) $(osys)),)
+ GRT_TARGET_OBJS=win32.o clock.o
+endif
# Doesn't work for unknown reasons.
#ifeq ($(filter-out i%86 cygwin,$(arch) $(osys)),)
# GRT_TARGET_OBJS=win32.o clock.o
@@ -106,6 +109,15 @@
GRT_EXTRA_LIB+=-lpthread
endif
+GNATMAKE ?= gnatmake
+GNATBIND ?= gnatbind
+
+GNATMAKE_FOR_TARGET ?= $(GNATMAKE)
+GNATBIND_FOR_TARGET ?= $(GNATBIND)
+
+GRT_TARGET_CC ?= $(CC)
+
+
GRT_ARCH?=None
# Configuration pragmas.
@@ -118,14 +130,14 @@
libgrt.a: $(GRT_ADD_OBJS) run-bind.o main.o grt-files # grt-arch.ads
$(RM) -f $@
- $(AR) rcv $@ `sed -e "/^-/d" < grt-files` $(GRT_ADD_OBJS) \
+ $(AR_FOR_TARGET) rcv $@ `sed -e "/^-/d" < grt-files` $(GRT_ADD_OBJS) \
run-bind.o main.o
$(GRT_RANLIB) $@
run-bind.adb: grt-force
- gnatmake -c $(GNATFLAGS) -aI$(GRTSRCDIR) $(GRT_PRAGMA_FLAG) \
+ $(GNATMAKE_FOR_TARGET) -c $(GNATFLAGS) -aI$(GRTSRCDIR)
$(GRT_PRAGMA_FLAG) \
ghdl_main $(GRT_ADAFLAGS) -cargs $(GRT_FLAGS)
- gnatbind -Lgrt_ -o run-bind.adb -n ghdl_main.ali
+ $(GNATBIND_FOR_TARGET) -Lgrt_ -o run-bind.adb -n ghdl_main.ali
#system.ads:
# sed -e "/Configurable_Run_Time/s/False/True/" \
@@ -139,49 +151,49 @@
$(GRT_ADACOMPILE)
i386.o: $(GRTSRCDIR)/config/i386.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
chkstk.o: $(GRTSRCDIR)/config/chkstk.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
sparc.o: $(GRTSRCDIR)/config/sparc.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
ppc.o: $(GRTSRCDIR)/config/ppc.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
ia64.o: $(GRTSRCDIR)/config/ia64.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
amd64.o: $(GRTSRCDIR)/config/amd64.S
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
linux.o: $(GRTSRCDIR)/config/linux.c
- $(CC) -c $(GRT_FLAGS) $(GRT_CFLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) $(GRT_CFLAGS) -o $@ $<
win32.o: $(GRTSRCDIR)/config/win32.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
win32thr.o: $(GRTSRCDIR)/config/win32thr.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
pthread.o: $(GRTSRCDIR)/config/pthread.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
times.o : $(GRTSRCDIR)/config/times.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
clock.o : $(GRTSRCDIR)/config/clock.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
grt-cbinding.o: $(GRTSRCDIR)/grt-cbinding.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
grt-cvpi.o: $(GRTSRCDIR)/grt-cvpi.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
grt-cthreads.o: $(GRTSRCDIR)/grt-cthreads.c
- $(CC) -c $(GRT_FLAGS) -o $@ $<
+ $(GRT_TARGET_CC) -c $(GRT_FLAGS) -o $@ $<
grt-disp-config:
@echo "target: $(target)"
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss