|
Lines 388-408
Link Here
|
| 388 |
{ try to add crti and crtbegin if linking to C } |
388 |
{ try to add crti and crtbegin if linking to C } |
| 389 |
if linklibc and (libctype<>uclibc) then |
389 |
if linklibc and (libctype<>uclibc) then |
| 390 |
begin |
390 |
begin |
|
|
391 |
{ crtbegin[S|T].o and crti.o should not be used with absolute paths |
| 392 |
as FindFile is not locating appropriate library for x86 when |
| 393 |
compiling on x86_64 machine (should use /usr/lib32/...). Let |
| 394 |
ld find the right one to link with if found in system. } |
| 391 |
{ crti.o must come first } |
395 |
{ crti.o must come first } |
| 392 |
if librarysearchpath.FindFile('crti.o',false,s) then |
396 |
if librarysearchpath.FindFile('crti.o',false,s) then |
| 393 |
AddFileName(s); |
397 |
AddFileName('crti.o'); |
| 394 |
{ then the crtbegin* } |
398 |
{ then the crtbegin* } |
| 395 |
if cs_create_pic in current_settings.moduleswitches then |
399 |
if cs_create_pic in current_settings.moduleswitches then |
| 396 |
begin |
400 |
begin |
| 397 |
if librarysearchpath.FindFile('crtbeginS.o',false,s) then |
401 |
if librarysearchpath.FindFile('crtbeginS.o',false,s) then |
| 398 |
AddFileName(s); |
402 |
AddFileName('crtbeginS.o'); |
| 399 |
end |
403 |
end |
| 400 |
else |
404 |
else |
| 401 |
if (cs_link_staticflag in current_settings.globalswitches) and |
405 |
if (cs_link_staticflag in current_settings.globalswitches) and |
| 402 |
librarysearchpath.FindFile('crtbeginT.o',false,s) then |
406 |
librarysearchpath.FindFile('crtbeginT.o',false,s) then |
| 403 |
AddFileName(s) |
407 |
AddFileName('crtbeginT.o') |
| 404 |
else if librarysearchpath.FindFile('crtbegin.o',false,s) then |
408 |
else if librarysearchpath.FindFile('crtbegin.o',false,s) then |
| 405 |
AddFileName(s); |
409 |
AddFileName('crtbegin.o'); |
| 406 |
end; |
410 |
end; |
| 407 |
{ main objectfiles } |
411 |
{ main objectfiles } |
| 408 |
while not ObjectFiles.Empty do |
412 |
while not ObjectFiles.Empty do |
|
Lines 481-491
Link Here
|
| 481 |
{ objects which must be at the end } |
485 |
{ objects which must be at the end } |
| 482 |
if linklibc and (libctype<>uclibc) then |
486 |
if linklibc and (libctype<>uclibc) then |
| 483 |
begin |
487 |
begin |
|
|
488 |
{ crtend[S].o and crtn.o should not be used with absolute paths |
| 489 |
as FindFile is not locating appropriate library for x86 when |
| 490 |
compiling on x86_64 machine (should use /usr/lib32/...). Let |
| 491 |
ld find the right one to link with if found in system. } |
| 484 |
if cs_create_pic in current_settings.moduleswitches then |
492 |
if cs_create_pic in current_settings.moduleswitches then |
| 485 |
found1:=librarysearchpath.FindFile('crtendS.o',false,s1) |
493 |
begin |
|
|
494 |
found1:=librarysearchpath.FindFile('crtendS.o',false,s1); |
| 495 |
if found1 then s1:='crtendS.o'; |
| 496 |
end |
| 486 |
else |
497 |
else |
| 487 |
found1:=librarysearchpath.FindFile('crtend.o',false,s1); |
498 |
begin |
|
|
499 |
found1:=librarysearchpath.FindFile('crtend.o',false,s1); |
| 500 |
if found1 then s1:='crtend.o'; |
| 501 |
end; |
| 488 |
found2:=librarysearchpath.FindFile('crtn.o',false,s2); |
502 |
found2:=librarysearchpath.FindFile('crtn.o',false,s2); |
|
|
503 |
if found2 then s2:='crtn.o'; |
| 489 |
if found1 or found2 then |
504 |
if found1 or found2 then |
| 490 |
begin |
505 |
begin |
| 491 |
Add('INPUT('); |
506 |
Add('INPUT('); |