From 5c8193fd4c3cab3100d37244ebccb7708d946e72 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 23 Mar 1999 16:22:43 +0000 Subject: [PATCH] * crtbegin/crtend only added if found --- compiler/link.pas | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/compiler/link.pas b/compiler/link.pas index 1607f62ce7..986ab96cfd 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -346,10 +346,16 @@ begin { add objectfiles, start with prt0 always } if prtobj<>'' then WriteRes(FindObjectFile(prtobj)); - if {linklibc this is only for linux }linux_link_c then + { try to add crti and crtbegin, they are normally not required, but + adding can sometimes be usefull } + if linux_link_c then begin - WriteRes(search('crti.o',librarysearchpath,found)+'crti.o'); - WriteRes(search('crtbegin.o',librarysearchpath,found)+'crtbegin.o'); + s:=search('crtbegin.o',librarysearchpath,found)+'crtbegin.o'; + if found then + WriteRes(s); + s:=search('crti.o',librarysearchpath,found)+'crti.o'; + if found then + WriteRes(s); end; while not ObjectFiles.Empty do begin @@ -359,8 +365,12 @@ begin end; if linux_link_c then begin - WriteRes(search('crtend.o',librarysearchpath,found)+'crtend.o'); - WriteRes(search('crtn.o',librarysearchpath,found)+'crtn.o'); + s:=search('crtend.o',librarysearchpath,found)+'crtend.o'; + if found then + WriteRes(s); + s:=search('crtn.o',librarysearchpath,found)+'crtn.o'; + if found then + WriteRes(s); end; { Write sharedlibraries like -l } @@ -552,7 +562,10 @@ end; end. { $Log$ - Revision 1.47 1999-02-05 16:45:47 michael + Revision 1.48 1999-03-23 16:22:43 peter + * crtbegin/crtend only added if found + + Revision 1.47 1999/02/05 16:45:47 michael + Fixed gluing of options Revision 1.46 1999/02/05 08:54:26 pierre