* Do not write COFF string table into EXE if COFF symbol table is not present. It fixes loading of stripped DLL on Win9x. Bug #12629.

git-svn-id: trunk@12352 -
This commit is contained in:
yury 2008-12-12 14:54:14 +00:00
parent aa21ff308e
commit 9cc15bd994

View File

@ -2170,9 +2170,11 @@ const pemagic : array[0..3] of byte = (
fillchar(header,sizeof(header),0);
header.mach:=COFF_MAGIC;
header.nsects:=nsects;
header.sympos:=sympos;
if hassymbols then
header.syms:=nsyms;
begin
header.sympos:=sympos;
header.syms:=nsyms;
end;
if win32 then
header.opthdr:=sizeof(tcoffpeoptheader)
else
@ -2280,15 +2282,17 @@ const pemagic : array[0..3] of byte = (
ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
{ Section data }
ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil);
{ Optional Symbols }
if SymPos<>FWriter.Size then
internalerror(200602252);
if hassymbols then
ExeSymbolList.ForEachCall(@globalsyms_write_symbol,nil);
{ Strings }
i:=FCoffStrs.size+4;
FWriter.write(i,4);
FWriter.writearray(FCoffStrs);
begin
{ Optional Symbols }
if SymPos<>FWriter.Size then
internalerror(200602252);
ExeSymbolList.ForEachCall(@globalsyms_write_symbol,nil);
{ Strings }
i:=FCoffStrs.size+4;
FWriter.write(i,4);
FWriter.writearray(FCoffStrs);
end;
{ Release }
FCoffStrs.Free;
FCoffSyms.Free;