diff --git a/compiler/script.pas b/compiler/script.pas index b618e425bb..d61cb24f14 100644 --- a/compiler/script.pas +++ b/compiler/script.pas @@ -378,7 +378,11 @@ Procedure TAsmScriptUnix.AddLinkCommand (Const Command, Options, FileName : TCmd begin if FileName<>'' then Add('echo Linking '+ScriptFixFileName(FileName)); + Add('OFS=$IFS'); + Add('IFS="'); + Add('"'); Add(maybequoted(command)+' '+Options); + Add('IFS=$OFS'); Add('if [ $? != 0 ]; then DoExitLink '+ScriptFixFileName(FileName)+'; fi'); end; diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index 5559c8b1af..742d119f11 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -247,19 +247,22 @@ begin else LinkRes.Add('ld -o $1 -e 0 $2 $3 $4 $5 $6 $7 $8 $9\'); } - LinkRes.Add('-m elf_i386_be -shared -Bsymbolic'); + LinkRes.Add('-m'); + LinkRes.Add('elf_i386_be'); + LinkRes.Add('-shared'); + LinkRes.Add('-Bsymbolic'); { Write path to search libraries } HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First); while assigned(HPath) do begin - LinkRes.Add(maybequoted('-L'+HPath.Str)); + LinkRes.Add('-L'+HPath.Str); HPath:=TCmdStrListItem(HPath.Next); end; HPath:=TCmdStrListItem(LibrarySearchPath.First); while assigned(HPath) do begin - LinkRes.Add(maybequoted('-L'+HPath.Str)); + LinkRes.Add('-L'+HPath.Str); HPath:=TCmdStrListItem(HPath.Next); end; @@ -293,7 +296,7 @@ begin begin s:=ObjectFiles.GetFirst; if s<>'' then - LinkRes.AddFileName(maybequoted(s)); + LinkRes.AddFileName(s); end; { LinkRes.Add('-lroot \'); @@ -306,7 +309,7 @@ begin While not StaticLibFiles.Empty do begin S:=StaticLibFiles.GetFirst; - LinkRes.AddFileName(maybequoted(s)) + LinkRes.AddFileName(s) end; end; diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index e9956bcb96..54134b3e26 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -366,15 +366,16 @@ begin if (not isdll) then begin + LinkRes.Add('-arch'); case target_info.system of system_powerpc_darwin: - LinkRes.Add('-arch ppc'); + LinkRes.Add('ppc'); system_i386_darwin: - LinkRes.Add('-arch i386'); + LinkRes.Add('i386'); system_powerpc64_darwin: - LinkRes.Add('-arch ppc64'); + LinkRes.Add('ppc64'); system_x86_64_darwin: - LinkRes.Add('-arch x86_64'); + LinkRes.Add('x86_64'); end; end; { Write path to search libraries } @@ -382,7 +383,7 @@ begin while assigned(HPath) do begin if LdSupportsNoResponseFile then - LinkRes.Add(maybequoted('-L'+HPath.Str)) + LinkRes.Add('-L'+HPath.Str) else LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')'); HPath:=TCmdStrListItem(HPath.Next); @@ -391,7 +392,7 @@ begin while assigned(HPath) do begin if LdSupportsNoResponseFile then - LinkRes.Add(maybequoted('-L'+HPath.Str)) + LinkRes.Add('-L'+HPath.Str) else LinkRes.Add('SEARCH_DIR('+maybequoted(HPath.Str)+')'); HPath:=TCmdStrListItem(HPath.Next); @@ -402,13 +403,13 @@ begin HPath:=TCmdStrListItem(current_module.localframeworksearchpath.First); while assigned(HPath) do begin - LinkRes.Add(maybequoted('-F'+HPath.Str)); + LinkRes.Add('-F'+HPath.Str); HPath:=TCmdStrListItem(HPath.Next); end; HPath:=TCmdStrListItem(FrameworkSearchPath.First); while assigned(HPath) do begin - LinkRes.Add(maybequoted('-F'+HPath.Str)); + LinkRes.Add('-F'+HPath.Str); HPath:=TCmdStrListItem(HPath.Next); end; end; @@ -432,7 +433,10 @@ begin begin s:=ObjectFiles.GetFirst; if s<>'' then - LinkRes.AddFileName(maybequoted(s)); + if LdSupportsNoResponseFile then + LinkRes.AddFileName(s) + else + LinkRes.AddFileName(maybequoted(s)); end; if not LdSupportsNoResponseFile then LinkRes.Add(')'); @@ -445,7 +449,10 @@ begin While not StaticLibFiles.Empty do begin S:=StaticLibFiles.GetFirst; - LinkRes.AddFileName(maybequoted(s)) + if LdSupportsNoResponseFile then + LinkRes.AddFileName(s) + else + LinkRes.AddFileName(maybequoted(s)) end; if not LdSupportsNoResponseFile then LinkRes.Add(')'); @@ -495,7 +502,10 @@ begin { frameworks for Darwin } if IsDarwin then while not FrameworkFiles.empty do - LinkRes.Add('-framework '+FrameworkFiles.GetFirst); + begin + LinkRes.Add('-framework'); + LinkRes.Add(FrameworkFiles.GetFirst); + end; { objects which must be at the end } if linklibc and @@ -516,7 +526,10 @@ begin { ignore the fact that our relocations are in non-writable sections, } { will be fixed once we have pic support } if isdll and IsDarwin Then - LinkRes.Add('-read_only_relocs suppress'); + begin + LinkRes.Add('-read_only_relocs'); + LinkRes.Add('suppress'); + end; { Write and Close response } linkres.writetodisk; linkres.Free;