This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[Ada] Add gnatdll support for -g option


Tested on GNU Linux/x86. 

  -Geert

2001-10-30  Pascal Obry <obry@gnat.com>

	* gnatdll.adb (Parse_Command_Line): handle -g option to be passed 
	to the binder and linker.
	Minor style fix.
	
	* mdll.ads: Fix layout.  Update copyright notice.

	* mdll.adb: Fix layout.  Update copyright notice.

*** gnatdll.adb	2000/06/28 21:22:09	1.6
--- gnatdll.adb	2001/10/13 12:44:00	1.7
***************
*** 8,14 ****
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1997-2000, Free Software Foundation, Inc.         --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
--- 8,14 ----
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1997-2001, Free Software Foundation, Inc.         --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
***************
*** 52,58 ****
     procedure Syntax;
     --  print out usage.
  
!    procedure Check (Filename : in String);
     --  check that filename exist.
  
     procedure Parse_Command_Line;
--- 52,58 ----
     procedure Syntax;
     --  print out usage.
  
!    procedure Check (Filename : String);
     --  check that filename exist.
  
     procedure Parse_Command_Line;
***************
*** 61,68 ****
     procedure Check_Context;
     --  check the context before runing any commands to build the library.
  
- 
- 
     Syntax_Error  : exception;
     Context_Error : exception;
  
--- 61,66 ----
***************
*** 98,104 ****
     Largs_Options : Argument_List_Access := Null_Argument_List_Access;
     Bargs_Options : Argument_List_Access := Null_Argument_List_Access;
  
- 
     type Build_Mode_State is (Import_Lib, Dynamic_Lib, Nil);
  
     Build_Mode             : Build_Mode_State := Nil;
--- 96,101 ----
***************
*** 111,141 ****
  
     procedure Syntax is
        use Text_IO;
     begin
!       Put_Line ("Usage : gnatdll [options] [list-of-files]");
        New_Line;
!       Put_Line
!         ("[list-of-files] a list of Ada libraries (.ali) and/or " &
           "foreign object files");
        New_Line;
!       Put_Line ("[options] can be");
!       Put_Line ("   -h       help - display this message");
!       Put_Line ("   -v       verbose");
!       Put_Line ("   -q       quiet");
!       Put_Line ("   -k       remove @nn suffix from exported names");
!       Put_Line ("   -Idir    Specify source and object files search path");
! 
!       Put_Line ("   -l file  " &
!                 "file contains a list-of-files to be added to the library");
!       Put_Line ("   -e file  definition file containing exports");
!       Put_Line
!         ("   -d file  put objects in the relocatable dynamic library <file>");
!       Put_Line ("   -a[addr] build non-relocatable DLL at address <addr>");
!       Put_Line ("            if <addr> is not specified use " &
!                 Default_DLL_Address);
!       Put_Line ("   -n       no-import - do not create the import library");
!       Put_Line ("   -bargs   binder option");
!       Put_Line ("   -largs   linker (library builder) option");
     end Syntax;
  
     -----------
--- 108,140 ----
  
     procedure Syntax is
        use Text_IO;
+ 
+       procedure P (Str : in String) renames Text_IO.Put_Line;
+ 
     begin
!       P ("Usage : gnatdll [options] [list-of-files]");
        New_Line;
!       P ("[list-of-files] a list of Ada libraries (.ali) and/or " &
           "foreign object files");
        New_Line;
!       P ("[options] can be");
!       P ("   -h            Help - display this message");
!       P ("   -v            Verbose");
!       P ("   -q            Quiet");
!       P ("   -k            Remove @nn suffix from exported names");
!       P ("   -g            Generate debugging information");
!       P ("   -Idir         Specify source and object files search path");
!       P ("   -l file       File contains a list-of-files to be added to "
!          & "the library");
!       P ("   -e file       Definition file containing exports");
!       P ("   -d file       Put objects in the relocatable dynamic "
!          & "library <file>");
!       P ("   -a[addr]      Build non-relocatable DLL at address <addr>");
!       P ("                 if <addr> is not specified use "
!          & Default_DLL_Address);
!       P ("   -n            No-import - do not create the import library");
!       P ("   -bargs opts   opts are passed to the binder");
!       P ("   -largs opts   opts are passed to the linker");
     end Syntax;
  
     -----------
***************
*** 273,279 ****
        --  scan gnatdll switches
  
        loop
!          case Getopt ("h v q k a? d: e: l: n I:") is
  
              when ASCII.Nul =>
                 exit;
--- 272,278 ----
        --  scan gnatdll switches
  
        loop
!          case Getopt ("g h v q k a? d: e: l: n I:") is
  
              when ASCII.Nul =>
                 exit;
***************
*** 281,286 ****
--- 280,289 ----
              when 'h' =>
                 Help := True;
  
+             when 'g' =>
+                Gopts (G) := new String'("-g");
+                G := G + 1;
+ 
              when 'v' =>
                 --  verbose mode on.
  
***************
*** 501,508 ****
        case Build_Mode is
  
           when Import_Lib =>
!             MDLL.Build_Import_Library (To_String (Lib_Filename),
!                                        To_String (Def_Filename));
  
           when Dynamic_Lib =>
              MDLL.Build_Dynamic_Library
--- 504,512 ----
        case Build_Mode is
  
           when Import_Lib =>
!             MDLL.Build_Import_Library
!               (To_String (Lib_Filename),
!                To_String (Def_Filename));
  
           when Dynamic_Lib =>
              MDLL.Build_Dynamic_Library

*** mdll.ads	2000/06/28 21:22:24	1.5
--- mdll.ads	2001/10/13 12:44:20	1.6
***************
*** 8,14 ****
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1992-2000 Free Software Foundation, Inc.          --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
--- 8,14 ----
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
***************
*** 52,68 ****
  
     Kill_Suffix    : Boolean := False;
  
!    procedure Build_Dynamic_Library (Ofiles        : in Argument_List;
!                                     Afiles        : in Argument_List;
!                                     Options       : in Argument_List;
!                                     Bargs_Options : in Argument_List;
!                                     Largs_Options : in Argument_List;
!                                     Lib_Filename  : in String;
!                                     Def_Filename  : in String;
!                                     Lib_Address   : in String  := "";
!                                     Build_Import  : in Boolean := False;
!                                     Relocatable   : in Boolean := False);
!    --  build a DLL and the import library to link against the DLL.
     --  this function handles relocatable and non relocatable DLL.
     --  If the Afiles argument list contains some Ada units then it will
     --  generate the right adainit and adafinal and integrate it in the DLL.
--- 52,69 ----
  
     Kill_Suffix    : Boolean := False;
  
!    procedure Build_Dynamic_Library
!      (Ofiles        : Argument_List;
!       Afiles        : Argument_List;
!       Options       : Argument_List;
!       Bargs_Options : Argument_List;
!       Largs_Options : Argument_List;
!       Lib_Filename  : String;
!       Def_Filename  : String;
!       Lib_Address   : String  := "";
!       Build_Import  : Boolean := False;
!       Relocatable   : Boolean := False);
!    --  Build a DLL and the import library to link against the DLL.
     --  this function handles relocatable and non relocatable DLL.
     --  If the Afiles argument list contains some Ada units then it will
     --  generate the right adainit and adafinal and integrate it in the DLL.
***************
*** 70,77 ****
     --  provided) then it will not try to build a binder file. This is ok to
     --  build DLL containing no Ada code.
  
!    procedure Build_Import_Library (Lib_Filename : in String;
!                                    Def_Filename : in String);
     --  Build an import library (.a) from a definition files. An import library
     --  is needed to link against a DLL.
  
--- 71,79 ----
     --  provided) then it will not try to build a binder file. This is ok to
     --  build DLL containing no Ada code.
  
!    procedure Build_Import_Library
!      (Lib_Filename : String;
!       Def_Filename : String);
     --  Build an import library (.a) from a definition files. An import library
     --  is needed to link against a DLL.
  

*** mdll.adb	2000/06/28 21:23:11	1.4
--- mdll.adb	2001/10/13 12:44:23	1.5
***************
*** 8,14 ****
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1992-2000 Free Software Foundation, Inc.          --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
--- 8,14 ----
  --                                                                          --
  --                            $Revision$
  --                                                                          --
! --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
  --                                                                          --
  -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  -- terms of the  GNU General Public License as published  by the Free Soft- --
***************
*** 44,59 ****
     ---------------------------
  
     procedure Build_Dynamic_Library
!      (Ofiles        : in Argument_List;
!       Afiles        : in Argument_List;
!       Options       : in Argument_List;
!       Bargs_Options : in Argument_List;
!       Largs_Options : in Argument_List;
!       Lib_Filename  : in String;
!       Def_Filename  : in String;
!       Lib_Address   : in String  := "";
!       Build_Import  : in Boolean := False;
!       Relocatable   : in Boolean := False)
     is
  
        use type OS_Lib.Argument_List;
--- 44,59 ----
     ---------------------------
  
     procedure Build_Dynamic_Library
!      (Ofiles        : Argument_List;
!       Afiles        : Argument_List;
!       Options       : Argument_List;
!       Bargs_Options : Argument_List;
!       Largs_Options : Argument_List;
!       Lib_Filename  : String;
!       Def_Filename  : String;
!       Lib_Address   : String  := "";
!       Build_Import  : Boolean := False;
!       Relocatable   : Boolean := False)
     is
  
        use type OS_Lib.Argument_List;
***************
*** 73,92 ****
  
        All_Options : constant Argument_List := Options & Largs_Options;
  
- 
        procedure Build_Reloc_DLL;
!       --  build a relocatable DLL with only objects file specified.
        --  this use the well known 5 steps build. (see GNAT User's Guide).
  
        procedure Ada_Build_Reloc_DLL;
!       --  build a relocatable DLL with Ada code.
        --  this use the well known 5 steps build. (see GNAT User's Guide).
  
        procedure Build_Non_Reloc_DLL;
!       --  build a non relocatable DLL containing no Ada code.
  
        procedure Ada_Build_Non_Reloc_DLL;
!       --  build a non relocatable DLL with Ada code.
  
        ---------------------
        -- Build_Reloc_DLL --
--- 73,91 ----
  
        All_Options : constant Argument_List := Options & Largs_Options;
  
        procedure Build_Reloc_DLL;
!       --  Build a relocatable DLL with only objects file specified.
        --  this use the well known 5 steps build. (see GNAT User's Guide).
  
        procedure Ada_Build_Reloc_DLL;
!       --  Build a relocatable DLL with Ada code.
        --  this use the well known 5 steps build. (see GNAT User's Guide).
  
        procedure Build_Non_Reloc_DLL;
!       --  Build a non relocatable DLL containing no Ada code.
  
        procedure Ada_Build_Non_Reloc_DLL;
!       --  Build a non relocatable DLL with Ada code.
  
        ---------------------
        -- Build_Reloc_DLL --
***************
*** 94,100 ****
  
        procedure Build_Reloc_DLL is
  
!          --  objects plus the export table (.exp) file
  
           Objects_Exp_File : OS_Lib.Argument_List
             := Exp_File'Unchecked_Access & Ofiles;
--- 93,99 ----
  
        procedure Build_Reloc_DLL is
  
!          --  Objects plus the export table (.exp) file
  
           Objects_Exp_File : OS_Lib.Argument_List
             := Exp_File'Unchecked_Access & Ofiles;
***************
*** 111,117 ****
              end if;
           end if;
  
!          --  1) build base file with objects files.
  
           Tools.Gcc (Output_File => Jnk_File,
                      Files       => Ofiles,
--- 110,116 ----
              end if;
           end if;
  
!          --  1) Build base file with objects files.
  
           Tools.Gcc (Output_File => Jnk_File,
                      Files       => Ofiles,
***************
*** 119,132 ****
                      Base_File   => Bas_File,
                      Build_Lib   => True);
  
!          --  2) build exp from base file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => False);
  
!          --  3) build base file with exp file and objects files.
  
           Tools.Gcc (Output_File => Jnk_File,
                      Files       => Objects_Exp_File,
--- 118,131 ----
                      Base_File   => Bas_File,
                      Build_Lib   => True);
  
!          --  2) Build exp from base file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => False);
  
!          --  3) Build base file with exp file and objects files.
  
           Tools.Gcc (Output_File => Jnk_File,
                      Files       => Objects_Exp_File,
***************
*** 134,147 ****
                      Base_File   => Bas_File,
                      Build_Lib   => True);
  
!          --  4) build new exp from base file and the lib file (.a)
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  5) build the dynamic library
  
           Tools.Gcc (Output_File => Dll_File,
                      Files       => Objects_Exp_File,
--- 133,146 ----
                      Base_File   => Bas_File,
                      Build_Lib   => True);
  
!          --  4) Build new exp from base file and the lib file (.a)
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  5) Build the dynamic library
  
           Tools.Gcc (Output_File => Dll_File,
                      Files       => Objects_Exp_File,
***************
*** 177,183 ****
              end if;
           end if;
  
!          --  1) build base file with objects files.
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
--- 176,182 ----
              end if;
           end if;
  
!          --  1) Build base file with objects files.
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
***************
*** 191,204 ****
                              Params);
           end;
  
!          --  2) build exp from base file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => False);
  
!          --  3) build base file with exp file and objects files.
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
--- 190,203 ----
                              Params);
           end;
  
!          --  2) Build exp from base file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => False);
  
!          --  3) Build base file with exp file and objects files.
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
***************
*** 215,228 ****
                              Params);
           end;
  
!          --  4) build new exp from base file and the lib file (.a)
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  5) build the dynamic library
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
--- 214,227 ----
                              Params);
           end;
  
!          --  4) Build new exp from base file and the lib file (.a)
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Base_File    => Bas_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  5) Build the dynamic library
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
***************
*** 268,280 ****
              end if;
           end if;
  
!          --  build exp table and the lib .a file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  build the DLL
  
           Tools.Gcc (Output_File => Dll_File,
                      Files       => Exp_File'Unchecked_Access & Ofiles,
--- 267,279 ----
              end if;
           end if;
  
!          --  Build exp table and the lib .a file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  Build the DLL
  
           Tools.Gcc (Output_File => Dll_File,
                      Files       => Exp_File'Unchecked_Access & Ofiles,
***************
*** 293,299 ****
        -- Ada_Build_Non_Reloc_DLL --
        -----------------------------
  
!       --  build a non relocatable DLL with Ada code.
  
        procedure Ada_Build_Non_Reloc_DLL is
        begin
--- 292,298 ----
        -- Ada_Build_Non_Reloc_DLL --
        -----------------------------
  
!       --  Build a non relocatable DLL with Ada code.
  
        procedure Ada_Build_Non_Reloc_DLL is
        begin
***************
*** 309,321 ****
              end if;
           end if;
  
!          --  build exp table and the lib .a file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  build the DLL
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
--- 308,320 ----
              end if;
           end if;
  
!          --  Build exp table and the lib .a file.
  
           Tools.Dlltool (Def_File, Dll_File, Lib_File,
                          Exp_Table    => Exp_File,
                          Build_Import => Build_Import);
  
!          --  Build the DLL
  
           Tools.Gnatbind (Afiles, Options & Bargs_Options);
  
***************
*** 363,373 ****
     -- Build_Import_Library --
     --------------------------
  
!    procedure Build_Import_Library (Lib_Filename : in String;
!                                    Def_Filename : in String) is
  
!       procedure Build_Import_Library (Def_Base_Filename : in String);
!       --  build an import library.
        --  this is to build only a .a library to link against a DLL.
  
        Base_Filename : constant String := MDLL.Files.Ext_To (Lib_Filename);
--- 362,374 ----
     -- Build_Import_Library --
     --------------------------
  
!    procedure Build_Import_Library
!      (Lib_Filename : String;
!       Def_Filename : String)
!    is
  
!       procedure Build_Import_Library (Def_Base_Filename : String);
!       --  Build an import library.
        --  this is to build only a .a library to link against a DLL.
  
        Base_Filename : constant String := MDLL.Files.Ext_To (Lib_Filename);
***************
*** 376,382 ****
        -- Build_Import_Library --
        --------------------------
  
!       procedure Build_Import_Library (Def_Base_Filename : in String) is
  
           Def_File : String renames Def_Filename;
           Dll_File : constant String := Def_Base_Filename & ".dll";
--- 377,383 ----
        -- Build_Import_Library --
        --------------------------
  
!       procedure Build_Import_Library (Def_Base_Filename : String) is
  
           Def_File : String renames Def_Filename;
           Dll_File : constant String := Def_Base_Filename & ".dll";
***************
*** 395,401 ****
        end Build_Import_Library;
  
     begin
!       --  if the library has the form lib<name>.a then the def file should
        --  be <name>.def and the DLL to link against <name>.dll
        --  this is a Windows convention and we try as much as possible to
        --  follow the platform convention.
--- 396,402 ----
        end Build_Import_Library;
  
     begin
!       --  If the library has the form lib<name>.a then the def file should
        --  be <name>.def and the DLL to link against <name>.dll
        --  this is a Windows convention and we try as much as possible to
        --  follow the platform convention.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]