]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix relocatable DLL creation with gnatdll
authorPascal Obry <obry@adacore.com>
Fri, 10 Jan 2025 17:56:55 +0000 (18:56 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 13 Jan 2025 10:53:00 +0000 (11:53 +0100)
gcc/ada/ChangeLog:

* mdll.adb: For the created DLL to be relocatable we do not want to use
the base file name when calling gnatdll.
* gnatdll.adb: Removes option -d which is not working anymore. And
when using a truly relocatable DLL the base-address has no real
meaning. Also reword the usage string for -d as we do not want to
specify relocatable as gnatdll can be used to create both
relocatable and non relocatable DLL.

gcc/ada/gnatdll.adb
gcc/ada/mdll.adb

index 8881fc91ab4db93dee52872868ff4cbf1ec9721f..0faf79f361b46318b9f55e3be2e0414d91837ba4 100644 (file)
@@ -134,10 +134,8 @@ procedure Gnatdll is
       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 "
+      P ("   -d file       Put objects in the dynamic "
          & "library <file>");
-      P ("   -b addr       Set base address for the relocatable DLL");
-      P ("                 default address is " & Default_DLL_Address);
       P ("   -a[addr]      Build non-relocatable DLL at address <addr>");
       P ("                 if <addr> is not specified use "
          & Default_DLL_Address);
@@ -315,10 +313,6 @@ procedure Gnatdll is
 
                Must_Build_Relocatable := False;
 
-            when 'b' =>
-               DLL_Address := To_Unbounded_String (Parameter);
-               Must_Build_Relocatable := True;
-
             when 'e' =>
                Def_Filename := To_Unbounded_String (Parameter);
 
index 281f6a97e5ffea686c4ed34d66120a5f59037c05..64350ff2ec3b52286805dd495ed1246c3ef19660 100644 (file)
@@ -77,10 +77,7 @@ package body MDLL is
       Bas_Opt  : aliased String := "-Wl,--base-file," & Bas_File;
       Lib_Opt  : aliased String := "-mdll";
       Out_Opt  : aliased String := "-o";
-      Adr_Opt  : aliased String :=
-                   (if Relocatable
-                    then ""
-                    else "-Wl,--image-base=" & Lib_Address);
+      Adr_Opt  : aliased String := "-Wl,--image-base=" & Lib_Address;
       Map_Opt  : aliased String := "-Wl,-Map," & Lib_Filename & ".map";
 
       L_Afiles : Argument_List := Afiles;
@@ -133,7 +130,7 @@ package body MDLL is
          --  2) Build exp from base file
 
          Utl.Dlltool (Def_File, Dll_File, Lib_File,
-                      Base_File    => Bas_File,
+                      Base_File    => (if Relocatable then "" else Bas_File),
                       Exp_Table    => Exp_File,
                       Build_Import => False);
 
@@ -148,7 +145,7 @@ package body MDLL is
          --  4) Build new exp from base file and the lib file (.a)
 
          Utl.Dlltool (Def_File, Dll_File, Lib_File,
-                      Base_File    => Bas_File,
+                      Base_File    => (if Relocatable then "" else Bas_File),
                       Exp_Table    => Exp_File,
                       Build_Import => Build_Import);
 
@@ -223,7 +220,7 @@ package body MDLL is
          --  2) Build exp from base file
 
          Utl.Dlltool (Def_File, Dll_File, Lib_File,
-                      Base_File    => Bas_File,
+                      Base_File    => (if Relocatable then "" else Bas_File),
                       Exp_Table    => Exp_File,
                       Build_Import => False);
 
@@ -247,7 +244,7 @@ package body MDLL is
          --  4) Build new exp from base file and the lib file (.a)
 
          Utl.Dlltool (Def_File, Dll_File, Lib_File,
-                      Base_File    => Bas_File,
+                      Base_File    => (if Relocatable then "" else Bas_File),
                       Exp_Table    => Exp_File,
                       Build_Import => Build_Import);