* Factored a common linker script building block into separate method.

git-svn-id: trunk@21730 -
This commit is contained in:
sergei 2012-06-28 17:18:02 +00:00
parent fdbe35aadf
commit 346fbef445
2 changed files with 31 additions and 22 deletions

View File

@ -116,6 +116,7 @@ interface
property ImportLibraryList:TFPHashObjectList read FImportLibraryList;
procedure DefaultLinkScript;virtual;abstract;
procedure ConcatGenericSections(secnames:string);
procedure ScriptAddSourceStatements(AddSharedAsStatic:boolean);virtual;
public
IsSharedLibrary : boolean;
UseStabs : boolean;
@ -897,6 +898,35 @@ Implementation
end;
procedure TInternalLinker.ScriptAddSourceStatements(AddSharedAsStatic:boolean);
var
s,s2: TCmdStr;
begin
while not ObjectFiles.Empty do
begin
s:=ObjectFiles.GetFirst;
if s<>'' then
LinkScript.Concat('READOBJECT '+MaybeQuoted(s));
end;
while not StaticLibFiles.Empty do
begin
s:=StaticLibFiles.GetFirst;
if s<>'' then
LinkScript.Concat('READSTATICLIBRARY '+MaybeQuoted(s));
end;
if not AddSharedAsStatic then
exit;
while not SharedLibFiles.Empty do
begin
S:=SharedLibFiles.GetFirst;
if FindLibraryFile(s,target_info.staticClibprefix,target_info.staticClibext,s2) then
LinkScript.Concat('READSTATICLIBRARY '+MaybeQuoted(s2))
else
Comment(V_Error,'Import library not found for '+S);
end;
end;
procedure TInternalLinker.Load_ReadObject(const para:TCmdStr);
var
objdata : TObjData;

View File

@ -939,31 +939,10 @@ implementation
procedure TInternalLinkerWin.DefaultLinkScript;
var
s,s2 : TCmdStr;
begin
ScriptAddSourceStatements(true);
with LinkScript do
begin
while not ObjectFiles.Empty do
begin
s:=ObjectFiles.GetFirst;
if s<>'' then
Concat('READOBJECT '+MaybeQuoted(s));
end;
while not StaticLibFiles.Empty do
begin
s:=StaticLibFiles.GetFirst;
if s<>'' then
Concat('READSTATICLIBRARY '+MaybeQuoted(s));
end;
While not SharedLibFiles.Empty do
begin
S:=SharedLibFiles.GetFirst;
if FindLibraryFile(s,target_info.staticClibprefix,target_info.staticClibext,s2) then
Concat('READSTATICLIBRARY '+MaybeQuoted(s2))
else
Comment(V_Error,'Import library not found for '+S);
end;
if IsSharedLibrary then
Concat('ISSHAREDLIBRARY');
ConcatEntryName;