On Sat, 2005-12-03 at 14:59 +0100, [EMAIL PROTECTED] wrote:
> I am not against it. However, I don't own an x86_64, so I won't do it now.
> If you want to try, do not hesitate!
Here you go. This patch adds the driver changes necessary to pass the
correct command line options to various build steps. In -m32 mode, the
libraries are expected in /usr/lib*/gcc/*/4.0.2/32 instead
of /usr/lib*/gcc/*/4.0.2, just like gcc does it.
Right now the necessary libraries are not built, so for now you have to
copy over the library binaries from an i386 machine (and use tar to
preserve the dates, ghdl is pretty picky about file dates ;-))
Tom
--- ghdldrv.adb.jnx 2005-12-03 17:30:40.000000000 +0100
+++ ghdldrv.adb 2005-12-03 18:50:54.000000000 +0100
@@ -307,7 +307,7 @@
Dir (1 .. Dir_Len) := Line (2 .. L);
else
if Line (1) = '@' then
- File := new String'(Prefix_Path.all & Line (2 .. L));
+ File := new String'(Get_Machine_Path_Prefix & Line (2 .. L));
else
if To_Obj then
File := new String'(Dir (1 .. Dir_Len)
@@ -614,6 +614,11 @@
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 +674,7 @@
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 +733,7 @@
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 +879,7 @@
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 +898,7 @@
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);
--- ghdllocal.adb.jnx 2005-12-03 17:48:05.000000000 +0100
+++ ghdllocal.adb 2005-12-03 18:24:42.000000000 +0100
@@ -42,6 +42,8 @@
Flag_Create_Default_Config : Boolean := True;
+ Flag_32bit : Boolean := False;
+
procedure Finish_Compilation
(Unit : Iir_Design_Unit; Main : Boolean := False)
is
@@ -125,6 +127,9 @@
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 +174,19 @@
end case;
end Get_Version_Path;
+ function Get_Machine_Path_Prefix return String is
+ begin
+ if Flag_32bit then
+ return Prefix_Path(1 .. Prefix_Path'Last-9) & "32" & Directory_Separator & Prefix_Path(Prefix_Path'Last-8 .. Prefix_Path'Last);
+ end if;
+ return Prefix_Path.all;
+ 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 +195,9 @@
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.
--- ghdllocal.ads.jnx 2005-12-03 18:45:50.000000000 +0100
+++ ghdllocal.ads 2005-12-03 18:46:38.000000000 +0100
@@ -72,6 +72,9 @@
-- 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);