mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 07:09:38 +01:00
* .o files belonging to the unit are first searched in the same dir
as the .ppu
This commit is contained in:
parent
a23e3f0a2f
commit
35801981d1
@ -49,7 +49,7 @@ Type
|
||||
Constructor Create;virtual;
|
||||
Destructor Destroy;override;
|
||||
procedure AddModuleFiles(hp:tmodule);
|
||||
Procedure AddObject(const S,unitpath : String);
|
||||
Procedure AddObject(const S,unitpath : String;isunit:boolean);
|
||||
Procedure AddStaticLibrary(const S : String);
|
||||
Procedure AddSharedLibrary(S : String);
|
||||
Procedure AddStaticCLibrary(const S : String);
|
||||
@ -83,7 +83,7 @@ Type
|
||||
var
|
||||
Linker : TLinker;
|
||||
|
||||
function FindObjectFile(s : string;const unitpath:string) : string;
|
||||
function FindObjectFile(s : string;const unitpath:string;isunit:boolean) : string;
|
||||
function FindLibraryFile(s:string;const prefix,ext:string;var foundfile : string) : boolean;
|
||||
|
||||
procedure InitLinker;
|
||||
@ -111,23 +111,26 @@ type
|
||||
*****************************************************************************}
|
||||
|
||||
{ searches an object file }
|
||||
function FindObjectFile(s:string;const unitpath:string) : string;
|
||||
function FindObjectFile(s:string;const unitpath:string;isunit:boolean) : string;
|
||||
var
|
||||
found : boolean;
|
||||
foundfile : string;
|
||||
s1 : string;
|
||||
begin
|
||||
findobjectfile:='';
|
||||
if s='' then
|
||||
exit;
|
||||
{ when it does not belong to the unit then check if
|
||||
the specified file exists without searching any paths }
|
||||
if not isunit then
|
||||
begin
|
||||
if FileExists(FixFileName(s)) then
|
||||
begin
|
||||
foundfile:=ScriptFixFileName(s);
|
||||
found:=true;
|
||||
end;
|
||||
end;
|
||||
if pos('.',s)=0 then
|
||||
s:=s+target_info.objext;
|
||||
s1:=FixFileName(s);
|
||||
if FileExists(s1) then
|
||||
begin
|
||||
Findobjectfile:=ScriptFixFileName(s);
|
||||
exit;
|
||||
end;
|
||||
{ find object file
|
||||
1. specified unit path (if specified)
|
||||
2. cwd
|
||||
@ -284,7 +287,7 @@ begin
|
||||
{ unit files }
|
||||
while not linkunitofiles.empty do
|
||||
begin
|
||||
AddObject(linkunitofiles.getusemask(mask),path^);
|
||||
AddObject(linkunitofiles.getusemask(mask),path^,true);
|
||||
end;
|
||||
while not linkunitstaticlibs.empty do
|
||||
AddStaticLibrary(linkunitstaticlibs.getusemask(mask));
|
||||
@ -294,7 +297,7 @@ begin
|
||||
{ Other needed .o and libs, specified using $L,$LINKLIB,external }
|
||||
mask:=link_allways;
|
||||
while not linkotherofiles.empty do
|
||||
AddObject(linkotherofiles.Getusemask(mask),path^);
|
||||
AddObject(linkotherofiles.Getusemask(mask),path^,false);
|
||||
while not linkotherstaticlibs.empty do
|
||||
AddStaticCLibrary(linkotherstaticlibs.Getusemask(mask));
|
||||
while not linkothersharedlibs.empty do
|
||||
@ -303,9 +306,9 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
Procedure TLinker.AddObject(const S,unitpath : String);
|
||||
Procedure TLinker.AddObject(const S,unitpath : String;isunit:boolean);
|
||||
begin
|
||||
ObjectFiles.Concat(FindObjectFile(s,unitpath));
|
||||
ObjectFiles.Concat(FindObjectFile(s,unitpath,isunit));
|
||||
end;
|
||||
|
||||
|
||||
@ -579,7 +582,7 @@ begin
|
||||
exemap:=texemap.create(current_module.mapfilename^);
|
||||
|
||||
{ read objects }
|
||||
readobj(FindObjectFile('prt0',''));
|
||||
readobj(FindObjectFile('prt0','',false));
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
@ -651,7 +654,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.34 2003-02-12 22:04:59 carl
|
||||
Revision 1.35 2003-04-26 09:16:07 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.34 2003/02/12 22:04:59 carl
|
||||
- removed my stupid hello debug code
|
||||
|
||||
Revision 1.33 2002/11/15 01:58:48 peter
|
||||
|
||||
@ -294,10 +294,10 @@ begin
|
||||
if found then LinkRes.AddFileName(s+' \');}
|
||||
|
||||
if prtobj<>'' then
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'')+' \');
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'',false)+' \');
|
||||
|
||||
if isdll then
|
||||
LinkRes.AddFileName(FindObjectFile('func.o','')+' \');
|
||||
LinkRes.AddFileName(FindObjectFile('func.o','',false)+' \');
|
||||
|
||||
if librarysearchpath.FindFile('init_term_dyn.o',s) then
|
||||
LinkRes.AddFileName(s+' \');
|
||||
@ -305,7 +305,7 @@ begin
|
||||
else
|
||||
begin
|
||||
if prtobj<>'' then
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'')+' \');
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'',false)+' \');
|
||||
end;
|
||||
|
||||
{ main objectfiles }
|
||||
@ -470,7 +470,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2002-10-05 12:43:29 carl
|
||||
Revision 1.4 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.3 2002/10/05 12:43:29 carl
|
||||
* fixes for Delphi 6 compilation
|
||||
(warning : Some features do not work under Delphi)
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ begin
|
||||
end;
|
||||
|
||||
{ add objectfiles, start with prt0 always }
|
||||
LinkRes.AddFileName(FindObjectFile('prt0',''));
|
||||
LinkRes.AddFileName(FindObjectFile('prt0','',false));
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
@ -516,7 +516,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2003-03-23 23:28:33 hajny
|
||||
Revision 1.2 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.1 2003/03/23 23:28:33 hajny
|
||||
+ emx target added
|
||||
|
||||
|
||||
|
||||
@ -314,7 +314,7 @@ begin
|
||||
LinkRes.Add('INPUT(');
|
||||
{ add objectfiles, start with prt0 always }
|
||||
if prtobj<>'' then
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,''));
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then
|
||||
begin
|
||||
@ -516,7 +516,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2003-01-18 16:16:13 marco
|
||||
Revision 1.4 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.3 2003/01/18 16:16:13 marco
|
||||
* Small fix for netbsd
|
||||
|
||||
Revision 1.2 2002/09/09 17:34:17 peter
|
||||
|
||||
@ -145,7 +145,7 @@ begin
|
||||
ScriptRes.Add(' .text 0x1000+SIZEOF_HEADERS : {');
|
||||
ScriptRes.Add(' . = ALIGN(16);');
|
||||
{ add objectfiles, start with prt0 always }
|
||||
ScriptRes.Add(' '+GetShortName(FindObjectFile('prt0',''))+'(.text)');
|
||||
ScriptRes.Add(' '+GetShortName(FindObjectFile('prt0','',false))+'(.text)');
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
@ -362,7 +362,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2002-09-06 15:03:51 carl
|
||||
Revision 1.2 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.1 2002/09/06 15:03:51 carl
|
||||
* moved files to systems directory
|
||||
|
||||
Revision 1.25 2002/08/12 15:08:44 carl
|
||||
|
||||
@ -327,7 +327,7 @@ begin
|
||||
LinkRes.Add('INPUT(');
|
||||
{ add objectfiles, start with prt0 always }
|
||||
if prtobj<>'' then
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,''));
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then
|
||||
begin
|
||||
@ -549,7 +549,11 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2002-12-14 13:02:45 carl
|
||||
Revision 1.7 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.6 2002/12/14 13:02:45 carl
|
||||
- remove extra ifdef i386 (avoir compilation errors)
|
||||
|
||||
Revision 1.5 2002/12/06 17:51:43 peter
|
||||
|
||||
@ -344,7 +344,7 @@ begin
|
||||
|
||||
{ add objectfiles, start with nwpre always }
|
||||
LinkRes.Add ('INPUT (');
|
||||
s2 := FindObjectFile('nwpre','');
|
||||
s2 := FindObjectFile('nwpre','',false);
|
||||
Comment (V_Debug,'adding Object File '+s2);
|
||||
LinkRes.Add (s2);
|
||||
|
||||
@ -354,10 +354,10 @@ begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
if s<>'' then
|
||||
begin
|
||||
s2 := FindObjectFile (s,'');
|
||||
s2 := FindObjectFile (s,'',false);
|
||||
Comment (V_Debug,'adding Object File '+s2);
|
||||
LinkRes.Add (s2);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ output file (nlm), add to nlmconv }
|
||||
@ -382,14 +382,14 @@ begin
|
||||
S:=lower (StaticLibFiles.GetFirst);
|
||||
if s<>'' then
|
||||
begin
|
||||
{ad: that's a hack !
|
||||
{ad: that's a hack !
|
||||
whith -XX we get the .a files as static libs (in addition to the
|
||||
imported libraries}
|
||||
if (pos ('.a',s) <> 0) OR (pos ('.A', s) <> 0) then
|
||||
begin
|
||||
S2 := FindObjectFile(s,'');
|
||||
S2 := FindObjectFile(s,'',false);
|
||||
LinkRes.Add (S2);
|
||||
Comment(V_Debug,'adding Object File (StaticLibFiles) '+S2);
|
||||
Comment(V_Debug,'adding Object File (StaticLibFiles) '+S2);
|
||||
end else
|
||||
begin
|
||||
i:=Pos(target_info.staticlibext,S);
|
||||
@ -398,7 +398,7 @@ begin
|
||||
S := S + '.imp'; S2 := '';
|
||||
librarysearchpath.FindFile(S,S2);
|
||||
NLMConvLinkFile.Add('IMPORT @'+S2);
|
||||
Comment(V_Debug,'IMPORT @'+s2);
|
||||
Comment(V_Debug,'IMPORT @'+s2);
|
||||
end;
|
||||
end
|
||||
end;
|
||||
@ -425,8 +425,8 @@ begin
|
||||
librarysearchpath.FindFile(S,S3);
|
||||
NLMConvLinkFile.Add('IMPORT @'+S3);
|
||||
NLMConvLinkFile.Add('MODULE '+s2);
|
||||
Comment(V_Debug,'MODULE '+S2);
|
||||
Comment(V_Debug,'IMPORT @'+S3);
|
||||
Comment(V_Debug,'MODULE '+S2);
|
||||
Comment(V_Debug,'IMPORT @'+S3);
|
||||
end
|
||||
end;
|
||||
end;
|
||||
@ -548,7 +548,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2003-03-22 14:51:27 armin
|
||||
Revision 1.7 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.6 2003/03/22 14:51:27 armin
|
||||
* support -k for additional nlmvonv headeroptions, -m i386nw for win32, support -sh
|
||||
|
||||
Revision 1.5 2003/03/21 22:36:42 armin
|
||||
|
||||
@ -397,7 +397,7 @@ begin
|
||||
end;
|
||||
|
||||
{ add objectfiles, start with prt0 always }
|
||||
LinkRes.AddFileName(FindObjectFile('prt0',''));
|
||||
LinkRes.AddFileName(FindObjectFile('prt0','',false));
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
@ -516,7 +516,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 2003-03-23 23:31:54 hajny
|
||||
Revision 1.6 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.5 2003/03/23 23:31:54 hajny
|
||||
+ platform extensions unified
|
||||
|
||||
Revision 1.4 2003/03/17 13:36:39 peter
|
||||
|
||||
@ -309,7 +309,7 @@ begin
|
||||
LinkRes.Add('INPUT(');
|
||||
{ add objectfiles, start with prt0 always }
|
||||
if prtobj<>'' then
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,''));
|
||||
LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
|
||||
{ try to add crti and crtbegin if linking to C }
|
||||
if linklibc then { Needed in sunos? }
|
||||
begin
|
||||
@ -486,7 +486,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2002-09-09 17:34:17 peter
|
||||
Revision 1.3 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.2 2002/09/09 17:34:17 peter
|
||||
* tdicationary.replace added to replace and item in a dictionary. This
|
||||
is only allowed for the same name
|
||||
* varsyms are inserted in symtable before the types are parsed. This
|
||||
|
||||
@ -912,12 +912,12 @@ begin
|
||||
{ profiling of shared libraries is currently not supported }
|
||||
LinkRes.Add('INPUT(');
|
||||
if isdll then
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wdllprt0','')))
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wdllprt0','',false)))
|
||||
else
|
||||
if (cs_profile in aktmoduleswitches) then
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('gprt0','')))
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('gprt0','',false)))
|
||||
else
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wprt0','')));
|
||||
LinkRes.AddFileName(MaybeQuoted(FindObjectFile('wprt0','',false)));
|
||||
while not ObjectFiles.Empty do
|
||||
begin
|
||||
s:=ObjectFiles.GetFirst;
|
||||
@ -1628,7 +1628,11 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 2003-04-12 15:43:40 peter
|
||||
Revision 1.13 2003-04-26 09:16:08 peter
|
||||
* .o files belonging to the unit are first searched in the same dir
|
||||
as the .ppu
|
||||
|
||||
Revision 1.12 2003/04/12 15:43:40 peter
|
||||
* convert registers for importssection
|
||||
|
||||
Revision 1.11 2003/01/06 20:19:52 peter
|
||||
|
||||
Loading…
Reference in New Issue
Block a user