diff -ru fpcbuild-2.2.4/fpcsrc/compiler/systems/t_linux.pas fpcbuild-2.2.4-new/fpcsrc/compiler/systems/t_linux.pas --- fpcbuild-2.2.4/fpcsrc/compiler/systems/t_linux.pas 2008-09-01 23:33:56.000000000 +0200 +++ fpcbuild-2.2.4-new/fpcsrc/compiler/systems/t_linux.pas 2010-05-20 00:20:21.294477957 +0200 @@ -385,18 +385,22 @@ see also issue #8210 regarding a discussion no idea about the other non i386 CPUs (FK) } + { crtbegin[S].o and crti.o should not be used with absolute paths + as FindFile is not locating appropriate library for x86 when + compiling on x86_64 machine (should use /usr/lib32/...). Let + ld find the right one to link with if found in system. } {$ifdef x86_64} if current_module.islibrary then begin if librarysearchpath.FindFile('crtbeginS.o',false,s) then - AddFileName(s); + AddFileName('crtbeginS.o'); end else {$endif x86_64} if librarysearchpath.FindFile('crtbegin.o',false,s) then - AddFileName(s); + AddFileName('crtbegin.o'); if librarysearchpath.FindFile('crti.o',false,s) then - AddFileName(s); + AddFileName('crti.o'); end; { main objectfiles } while not ObjectFiles.Empty do @@ -462,12 +466,22 @@ see also issue #8210 regarding a discussion no idea about the other non i386 CPUs (FK) } + { crtend[S].o and crtn.o should not be used with absolute paths + as FindFile is not locating appropriate library for x86 when + compiling on x86_64 machine (should use /usr/lib32/...). Let + ld find the right one to link with if found in system. } {$ifdef x86_64} if current_module.islibrary then - found1:=librarysearchpath.FindFile('crtendS.o',false,s1) + begin + found1:=librarysearchpath.FindFile('crtendS.o',false,s1); + if found1 then s1:='crtendS.o'; + end else {$endif x86_64} + begin found1:=librarysearchpath.FindFile('crtend.o',false,s1); + if found1 then s1:='crtend.o'; + end; found2:=librarysearchpath.FindFile('crtn.o',false,s2); if found1 or found2 then begin @@ -475,7 +489,7 @@ if found1 then AddFileName(s1); if found2 then - AddFileName(s2); + AddFileName('crtn.o'); Add(')'); end; end;