* Fixed writing debug link for external symbols file. Bug #13041.

git-svn-id: trunk@12686 -
This commit is contained in:
yury 2009-02-05 11:44:52 +00:00
parent 6f12cb03db
commit 89d466a3dc

View File

@ -2128,7 +2128,8 @@ const pemagic : array[0..3] of byte = (
dataExeSec, dataExeSec,
bssExeSec, bssExeSec,
idataExeSec : TExeSection; idataExeSec : TExeSection;
hassymbols : boolean; hassymbols,
writeDbgStrings : boolean;
procedure UpdateDataDir(const secname:string;idx:longint); procedure UpdateDataDir(const secname:string;idx:longint);
var var
@ -2158,6 +2159,7 @@ const pemagic : array[0..3] of byte = (
(ExeWriteMode=ewm_exefull) and (ExeWriteMode=ewm_exefull) and
not(cs_link_strip in current_settings.globalswitches) not(cs_link_strip in current_settings.globalswitches)
); );
writeDbgStrings:=hassymbols or ((ExeWriteMode=ewm_exeonly) and (cs_link_separate_dbg_file in current_settings.globalswitches));
{ Stub } { Stub }
if win32 then if win32 then
begin begin
@ -2170,11 +2172,10 @@ const pemagic : array[0..3] of byte = (
fillchar(header,sizeof(header),0); fillchar(header,sizeof(header),0);
header.mach:=COFF_MAGIC; header.mach:=COFF_MAGIC;
header.nsects:=nsects; header.nsects:=nsects;
if writeDbgStrings then
header.sympos:=sympos;
if hassymbols then if hassymbols then
begin header.syms:=nsyms;
header.sympos:=sympos;
header.syms:=nsyms;
end;
if win32 then if win32 then
header.opthdr:=sizeof(tcoffpeoptheader) header.opthdr:=sizeof(tcoffpeoptheader)
else else
@ -2288,12 +2289,13 @@ const pemagic : array[0..3] of byte = (
ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil); ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
{ Section data } { Section data }
ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil); ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil);
{ Optional Symbols }
if SymPos<>FWriter.Size then
internalerror(200602252);
if hassymbols then if hassymbols then
ExeSymbolList.ForEachCall(@globalsyms_write_symbol,nil);
if writeDbgStrings then
begin begin
{ Optional Symbols }
if SymPos<>FWriter.Size then
internalerror(200602252);
ExeSymbolList.ForEachCall(@globalsyms_write_symbol,nil);
{ Strings } { Strings }
i:=FCoffStrs.size+4; i:=FCoffStrs.size+4;
FWriter.write(i,4); FWriter.write(i,4);