https://gcc.gnu.org/g:2e0b086f8403e00da964d44039c667d5b1806070
commit r15-6861-g2e0b086f8403e00da964d44039c667d5b1806070 Author: Pascal Obry <o...@adacore.com> Date: Fri Jan 10 18:56:55 2025 +0100 ada: Fix relocatable DLL creation with gnatdll 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. Diff: --- gcc/ada/gnatdll.adb | 8 +------- gcc/ada/mdll.adb | 13 +++++-------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/gcc/ada/gnatdll.adb b/gcc/ada/gnatdll.adb index 8881fc91ab4d..0faf79f361b4 100644 --- a/gcc/ada/gnatdll.adb +++ b/gcc/ada/gnatdll.adb @@ -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); diff --git a/gcc/ada/mdll.adb b/gcc/ada/mdll.adb index 281f6a97e5ff..64350ff2ec3b 100644 --- a/gcc/ada/mdll.adb +++ b/gcc/ada/mdll.adb @@ -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);