diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/default_pathes.ads.in | 1 | ||||
-rw-r--r-- | src/ghdldrv/ghdldrv.adb | 51 | ||||
-rw-r--r-- | src/ortho/llvm-nodebug/ortho_code_main35.adb | 6 | ||||
-rw-r--r-- | src/ortho/llvm-nodebug/ortho_code_main39.adb | 6 | ||||
-rw-r--r-- | src/ortho/llvm/ortho_code_main.adb | 6 | ||||
-rw-r--r-- | src/vhdl/disp_vhdl.adb | 3 | ||||
-rw-r--r-- | src/vhdl/sem.adb | 6 | ||||
-rw-r--r-- | src/vhdl/sem_assocs.adb | 1 | ||||
-rw-r--r-- | src/vhdl/sem_decls.adb | 1 |
9 files changed, 67 insertions, 14 deletions
diff --git a/src/ghdldrv/default_pathes.ads.in b/src/ghdldrv/default_pathes.ads.in index a7c3d15f7..8b0801e13 100644 --- a/src/ghdldrv/default_pathes.ads.in +++ b/src/ghdldrv/default_pathes.ads.in @@ -39,4 +39,5 @@ package Default_Pathes is Shared_Library_Extension : constant String := "@SOEXT@"; + Default_Pie : constant Boolean := "@default_pie@" = String'("yes"); end Default_Pathes; diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb index 082d1db57..ae8e510f3 100644 --- a/src/ghdldrv/ghdldrv.adb +++ b/src/ghdldrv/ghdldrv.adb @@ -41,8 +41,8 @@ package body Ghdldrv is -- Name of the tools used. Compiler_Cmd : String_Access := null; Post_Processor_Cmd : String_Access := null; - Assembler_Cmd : constant String := "as"; - Linker_Cmd : constant String := "gcc"; + Assembler_Cmd : String_Access := null; + Linker_Cmd : String_Access := null; -- Path of the tools. Compiler_Path : String_Access; @@ -63,6 +63,9 @@ package body Ghdldrv is -- "-quiet" option. Dash_Quiet : constant String_Access := new String'("-quiet"); + -- "-fpic" option. + Dash_Fpic : constant String_Access := new String'("-fpic"); + -- True if --post is present. Flag_Postprocess : Boolean := False; @@ -162,7 +165,7 @@ package body Ghdldrv is declare P : Natural; Nbr_Args : constant Natural := - Last (Compiler_Args) + Options'Length + 4; + Last (Compiler_Args) + Options'Length + 5; Args : Argument_List (1 .. Nbr_Args); begin P := 0; @@ -191,6 +194,20 @@ package body Ghdldrv is end case; end if; + -- Add -fpic for gcc/llvm. + if not Flag_Postprocess + and then Default_Pathes.Default_Pie + then + case Backend is + when Backend_Gcc + | Backend_Llvm => + P := P + 1; + Args (P) := Dash_Fpic; + when Backend_Mcode => + null; + end case; + end if; + -- Object file (or assembly file). Args (P + 1) := Dash_o; if Flag_Postprocess then @@ -409,7 +426,7 @@ package body Ghdldrv is raise Option_Error; end Tool_Not_Found; - -- Set the compiler command according to the configuration (and swicthes). + -- Set the compiler command according to the configuration (and switches). procedure Set_Tools_Name is begin -- Set tools name. @@ -430,6 +447,12 @@ package body Ghdldrv is if Post_Processor_Cmd = null then Post_Processor_Cmd := new String'(Default_Pathes.Post_Processor); end if; + if Assembler_Cmd = null then + Assembler_Cmd := new String'("as"); + end if; + if Linker_Cmd = null then + Linker_Cmd := new String'("gcc"); + end if; end Set_Tools_Name; function Locate_Exec_Tool (Toolname : String) return String_Access is @@ -489,9 +512,9 @@ package body Ghdldrv is -- Assembler. case Backend is when Backend_Gcc => - 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; when Backend_Llvm | Backend_Mcode => @@ -499,9 +522,9 @@ package body Ghdldrv is end case; -- Linker. - Linker_Path := Locate_Exec_On_Path (Linker_Cmd); + Linker_Path := Locate_Exec_On_Path (Linker_Cmd.all); if Linker_Path = null then - Tool_Not_Found (Linker_Cmd); + Tool_Not_Found (Linker_Cmd.all); end if; end Locate_Tools; @@ -570,6 +593,12 @@ package body Ghdldrv is 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) = "--AS=" then + Assembler_Cmd := new String'(Opt (6 .. Opt'Last)); + Res := Option_Ok; + elsif Opt'Length > 7 and then Opt (1 .. 7) = "--LINK=" then + Linker_Cmd := new String'(Opt (8 .. Opt'Last)); + Res := Option_Ok; elsif Opt = "-S" then Flag_Asm := True; Res := Option_Ok; @@ -649,6 +678,8 @@ package body Ghdldrv is 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=as Use as for the assembler"); + Put_Line (" --LINK=gcc Use gcc for the linker driver"); 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"); @@ -705,13 +736,13 @@ package body Ghdldrv is case Backend is when Backend_Gcc => Put ("assembler command: "); - Put_Line (Assembler_Cmd); + Put_Line (Assembler_Cmd.all); when Backend_Llvm | Backend_Mcode => null; end case; Put ("linker command: "); - Put_Line (Linker_Cmd); + Put_Line (Linker_Cmd.all); Put_Line ("default lib prefix: " & Default_Pathes.Lib_Prefix); New_Line; diff --git a/src/ortho/llvm-nodebug/ortho_code_main35.adb b/src/ortho/llvm-nodebug/ortho_code_main35.adb index 61b836369..bb5458b49 100644 --- a/src/ortho/llvm-nodebug/ortho_code_main35.adb +++ b/src/ortho/llvm-nodebug/ortho_code_main35.adb @@ -62,7 +62,7 @@ procedure Ortho_Code_Main35 is CPU : constant Cstring := Empty_Cstring; Features : constant Cstring := Empty_Cstring; - Reloc : constant RelocMode := RelocDefault; + Reloc : RelocMode := RelocDefault; function To_String (C : Cstring) return String is function Strlen (C : Cstring) return Natural; @@ -117,6 +117,10 @@ begin Optimization := CodeGenLevelDefault; elsif Arg = "-O3" then Optimization := CodeGenLevelAggressive; + elsif Arg = "-fpic" or Arg = "-fPIC" then + Reloc := RelocPIC; + elsif Arg = "-fno-pic" then + Reloc := RelocStatic; elsif Arg = "--emit-llvm" then Output_Kind := Output_Llvm; elsif Arg = "--emit-bc" then diff --git a/src/ortho/llvm-nodebug/ortho_code_main39.adb b/src/ortho/llvm-nodebug/ortho_code_main39.adb index d1e84b6e3..11e52220e 100644 --- a/src/ortho/llvm-nodebug/ortho_code_main39.adb +++ b/src/ortho/llvm-nodebug/ortho_code_main39.adb @@ -62,7 +62,7 @@ procedure Ortho_Code_Main39 is CPU : constant Cstring := Empty_Cstring; Features : constant Cstring := Empty_Cstring; - Reloc : constant RelocMode := RelocDefault; + Reloc : RelocMode := RelocDefault; function To_String (C : Cstring) return String is function Strlen (C : Cstring) return Natural; @@ -117,6 +117,10 @@ begin Optimization := CodeGenLevelDefault; elsif Arg = "-O3" then Optimization := CodeGenLevelAggressive; + elsif Arg = "-fpic" or Arg = "-fPIC" then + Reloc := RelocPIC; + elsif Arg = "-fno-pic" then + Reloc := RelocStatic; elsif Arg = "--emit-llvm" then Output_Kind := Output_Llvm; elsif Arg = "--emit-bc" then diff --git a/src/ortho/llvm/ortho_code_main.adb b/src/ortho/llvm/ortho_code_main.adb index 5558a8bbe..56c869ad1 100644 --- a/src/ortho/llvm/ortho_code_main.adb +++ b/src/ortho/llvm/ortho_code_main.adb @@ -70,7 +70,7 @@ procedure Ortho_Code_Main is CPU : constant Cstring := Empty_Cstring; Features : constant Cstring := Empty_Cstring; - Reloc : constant RelocMode := RelocDefault; + Reloc : RelocMode := RelocDefault; function To_String (C : Cstring) return String is function Strlen (C : Cstring) return Natural; @@ -125,6 +125,10 @@ begin Optimization := CodeGenLevelDefault; elsif Arg = "-O3" then Optimization := CodeGenLevelAggressive; + elsif Arg = "-fpic" or Arg = "-fPIC" then + Reloc := RelocPIC; + elsif Arg = "-fno-pic" then + Reloc := RelocStatic; elsif Arg = "--emit-llvm" then Output_Kind := Output_Llvm; elsif Arg = "--emit-bc" then diff --git a/src/vhdl/disp_vhdl.adb b/src/vhdl/disp_vhdl.adb index 291214af6..ba72e4673 100644 --- a/src/vhdl/disp_vhdl.adb +++ b/src/vhdl/disp_vhdl.adb @@ -2346,7 +2346,8 @@ package body Disp_Vhdl is when Iir_Kind_Association_Element_Open => Put ("open"); when Iir_Kind_Association_Element_Package - | Iir_Kind_Association_Element_Type => + | Iir_Kind_Association_Element_Type + | Iir_Kind_Association_Element_Subprogram => Disp_Name (Get_Actual (El)); when others => Conv := Get_In_Conversion (El); diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb index b89e1f005..39916bb76 100644 --- a/src/vhdl/sem.adb +++ b/src/vhdl/sem.adb @@ -1479,6 +1479,12 @@ package body Sem is when Iir_Kinds_Monadic_Operator => return Are_Trees_Equal (Get_Operand (Left), Get_Operand (Right)); + when Iir_Kind_Function_Call => + return Are_Trees_Equal (Get_Prefix (Left), Get_Prefix (Right)) + and then + Are_Trees_Chain_Equal (Get_Parameter_Association_Chain (Left), + Get_Parameter_Association_Chain (Right)); + when Iir_Kind_Access_Type_Definition | Iir_Kind_Record_Type_Definition | Iir_Kind_Array_Type_Definition diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index 6708355b9..f8620182c 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -1941,6 +1941,7 @@ package body Sem_Assocs is end case; Set_Named_Entity (Actual, Res); + Xrefs.Xref_Name (Actual); Set_Use_Flag (Res, True); end Sem_Association_Subprogram; diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb index 9fac6d50e..8d3c15587 100644 --- a/src/vhdl/sem_decls.adb +++ b/src/vhdl/sem_decls.adb @@ -489,6 +489,7 @@ package body Sem_Decls is procedure Sem_Interface_Subprogram_Declaration (Inter : Iir) is begin Sem_Subprogram_Specification (Inter); + Xref_Decl (Inter); end Sem_Interface_Subprogram_Declaration; procedure Sem_Interface_Chain (Interface_Chain: Iir; |