diff options
author | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2005-12-10 17:08:01 +0000 |
---|---|---|
committer | gingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7> | 2005-12-10 17:08:01 +0000 |
commit | 632952160f9a7e5a9b4bb7bdd99ae76b3ec0e96a (patch) | |
tree | 8d3d25dd5ede4ac0c1ed7a0cb4bb914ea90d6e87 /translate | |
parent | 54ee7a02a6b3d622545aceff27cf43eeefb883f4 (diff) | |
download | ghdl-632952160f9a7e5a9b4bb7bdd99ae76b3ec0e96a.tar.gz ghdl-632952160f9a7e5a9b4bb7bdd99ae76b3ec0e96a.tar.bz2 ghdl-632952160f9a7e5a9b4bb7bdd99ae76b3ec0e96a.zip |
-m32 flag added, general substitution in .lst file
Diffstat (limited to 'translate')
-rw-r--r-- | translate/ghdldrv/Makefile | 4 | ||||
-rw-r--r-- | translate/ghdldrv/ghdldrv.adb | 40 | ||||
-rw-r--r-- | translate/ghdldrv/ghdllocal.adb | 20 | ||||
-rw-r--r-- | translate/ghdldrv/ghdllocal.ads | 3 | ||||
-rw-r--r-- | translate/ghdldrv/ghdlmain.adb | 2 |
5 files changed, 53 insertions, 16 deletions
diff --git a/translate/ghdldrv/Makefile b/translate/ghdldrv/Makefile index e9b38f469..2549362cd 100644 --- a/translate/ghdldrv/Makefile +++ b/translate/ghdldrv/Makefile @@ -36,7 +36,7 @@ GRTSRCDIR=../grt include $(GRTSRCDIR)/Makefile.inc ghdl_mcode: default_pathes.ads $(GRT_ADD_OBJS) mmap_binding.o force - gnatmake -aI../../ortho/mcode $(GNATFLAGS) ghdl_mcode $(GNAT_BARGS) -largs mmap_binding.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(GRT_EXTRA_LIB) -Wl,--version-script=$(GRTSRCDIR)/grt.ver -Wl,--export-dynamic + gnatmake -aI../../ortho/mcode $(GNATFLAGS) ghdl_mcode $(GNAT_BARGS) -largs mmap_binding.o $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) mmap_binding.o: ../../ortho/mcode/mmap_binding.c $(CC) -c -g -o $@ $< @@ -103,7 +103,7 @@ install.standard: $(LIB93_DIR)/std/std_standard.o \ $(LIB87_DIR)/std/std_standard.o make-lib-links: - cd ../lib; ln -sf ../grt/grt.lst .; ln -sf ../grt/libgrt.a . + cd ../lib; ln -sf $(GRTSRCDIR)/grt.lst .; ln -sf $(GRTSRCDIR)/libgrt.a .; ln -sf $(GRTSRCDIR)/grt.ver . install.all: install.v87 install.v93 install.standard install.mcode: install.v87 install.v93 diff --git a/translate/ghdldrv/ghdldrv.adb b/translate/ghdldrv/ghdldrv.adb index 5b9b8adbb..14e61299a 100644 --- a/translate/ghdldrv/ghdldrv.adb +++ b/translate/ghdldrv/ghdldrv.adb @@ -272,6 +272,20 @@ package body Ghdldrv is use System; use Ada.Characters.Latin_1; + -- Replace the first '@' with the machine path. + function Substitute (Str : String) return String + is + begin + for I in Str'Range loop + if Str (I) = '@' then + return Str (Str'First .. I - 1) + & Get_Machine_Path_Prefix + & Str (I + 1 .. Str'Last); + end if; + end loop; + return Str; + end Substitute; + Dir : String (1 .. max_path_len); Dir_Len : Natural; Line : String (1 .. max_path_len); @@ -306,16 +320,12 @@ package body Ghdldrv is Dir_Len := L - 1; Dir (1 .. Dir_Len) := Line (2 .. L); else - if Line (1) = '@' then - File := new String'(Prefix_Path.all & Line (2 .. L)); + if To_Obj then + File := new String'(Dir (1 .. Dir_Len) + & Get_Base_Name (Line (1 .. L)) + & Get_Object_Suffix.all); else - if To_Obj then - File := new String'(Dir (1 .. Dir_Len) - & Get_Base_Name (Line (1 .. L)) - & Get_Object_Suffix.all); - else - File := new String'(Line (1 .. L)); - end if; + File := new String'(Substitute (Line (1 .. L))); end if; Filelist.Increment_Last; @@ -614,6 +624,11 @@ package body Ghdldrv is Output_File := new String'(Arg); Res := Option_Arg; end if; + elsif Option = "-m32" then + Add_Argument (Compiler_Args, new String'("-m32")); + Add_Argument (Assembler_Args, new String'("--32")); + Add_Argument (Linker_Args, new String'("-m32")); + Decode_Option (Command_Lib (Cmd), Option, Arg, Res); elsif Option'Length > 4 and then Option (2) = 'W' and then Option (4) = ',' then @@ -669,6 +684,7 @@ package body Ghdldrv is Put_Line (" --GHDL1=PATH Set the path of the ghdl1 compiler"); 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"); Put_Line (" -WX,OPTION Pass OPTION to X, where X is one of"); Put_Line (" c: compiler, a: assembler, l: linker"); Put_Line (" -g[XX] Pass debugging option to the compiler"); @@ -727,7 +743,7 @@ package body Ghdldrv is Put_Line (Linker_Cmd); Setup_Libraries (False); Put ("library directory: "); - Put_Line (Prefix_Path.all); + Put_Line (Get_Machine_Path_Prefix); Locate_Tools; Put ("compiler path: "); Put_Line (Compiler_Path.all); @@ -873,7 +889,7 @@ package body Ghdldrv is Add_File_List (Filelist_Name.all, True); end if; Last_File := Filelist.Last; - Add_File_List (Prefix_Path.all & "grt" & List_Suffix, False); + Add_File_List (Get_Machine_Path_Prefix & "grt" & List_Suffix, False); -- call the linker declare @@ -892,7 +908,7 @@ package body Ghdldrv is P := P + 3; if Add_Std then Std_File := new - String'(Prefix_Path.all + String'(Get_Machine_Path_Prefix & Get_Version_Path & Directory_Separator & "std" & Directory_Separator & "std_standard" & Get_Object_Suffix.all); diff --git a/translate/ghdldrv/ghdllocal.adb b/translate/ghdldrv/ghdllocal.adb index 3abd5559f..4a9f62f5a 100644 --- a/translate/ghdldrv/ghdllocal.adb +++ b/translate/ghdldrv/ghdllocal.adb @@ -42,6 +42,9 @@ package body Ghdllocal is Flag_Create_Default_Config : Boolean := True; + -- If TRUE, generate 32bits code on 64bits machines. + Flag_32bit : Boolean := False; + procedure Finish_Compilation (Unit : Iir_Design_Unit; Main : Boolean := False) is @@ -125,6 +128,9 @@ package body Ghdllocal is elsif Option = "--ieee=standard" then Flag_Ieee := Lib_Standard; Res := Option_Ok; + elsif Option = "-m32" then + Flag_32bit := True; + Res := Option_Ok; elsif Option'Length >= 2 and then (Option (2) = 'g' or Option (2) = 'O') then @@ -169,11 +175,20 @@ package body Ghdllocal is end case; end Get_Version_Path; + function Get_Machine_Path_Prefix return String is + begin + if Flag_32bit then + return Prefix_Path.all & "32" & Directory_Separator; + else + return Prefix_Path.all; + end if; + end Get_Machine_Path_Prefix; + procedure Add_Library_Path (Name : String) is begin Libraries.Add_Library_Path - (Prefix_Path.all & Get_Version_Path & Directory_Separator + (Get_Machine_Path_Prefix & Get_Version_Path & Directory_Separator & Name & Directory_Separator); end Add_Library_Path; @@ -182,6 +197,9 @@ package body Ghdllocal is begin if Prefix_Path = null then Prefix_Path := new String'(Default_Pathes.Prefix); + else + -- assume the user has set the correct path, so do not insert 32 + Flag_32bit := False; end if; -- Add pathes for predefined libraries. diff --git a/translate/ghdldrv/ghdllocal.ads b/translate/ghdldrv/ghdllocal.ads index e1c2baa42..817cc8fd5 100644 --- a/translate/ghdldrv/ghdllocal.ads +++ b/translate/ghdldrv/ghdllocal.ads @@ -72,6 +72,9 @@ package Ghdllocal is -- Used to search Std and IEEE libraries. function Get_Version_Path return String; + -- Get Prefix_Path, but with 32 added if -m32 is requested + function Get_Machine_Path_Prefix return String; + -- Setup standard libaries path. If LOAD is true, then load them now. procedure Setup_Libraries (Load : Boolean); diff --git a/translate/ghdldrv/ghdlmain.adb b/translate/ghdldrv/ghdlmain.adb index 717e4fc4b..fa6f757c5 100644 --- a/translate/ghdldrv/ghdlmain.adb +++ b/translate/ghdldrv/ghdlmain.adb @@ -136,7 +136,7 @@ package body Ghdlmain is ("To display the options of a GHDL program, run your program"); Put_Line (" with the --help option."); Put_Line ("Please, refer to the GHDL manual for more information."); - Put_Line ("Report bugs to <ghdl@free.fr>."); + Put_Line ("Report bugs on http://gna.org/projects/ghdl"); elsif Args'Length = 1 then C := Find_Command (Args (1).all); if C = null then |