mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 18:49:16 +02:00
- removed TCoffObjData.afteralloc, calculating MemPos there is useless because every call to afteralloc is immediately followed by call to TObjData.resetsections that resets all MemPos back to zero.
- PE_FILE_RELOCS_STRIPPED flag is meaningless for object files. - Don't write PE_FILE_BYTES_REVERSED_LO as well, it is deprecated and GNU tools don't write it either. - Don't set PE_FILE_32_BIT_MACHINE flag in x86_64 object files. git-svn-id: trunk@21710 -
This commit is contained in:
parent
022d842b06
commit
0c32756ef3
@ -124,7 +124,6 @@ interface
|
|||||||
procedure CreateDebugSections;override;
|
procedure CreateDebugSections;override;
|
||||||
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
||||||
procedure writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
|
procedure writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
|
||||||
procedure afteralloc;override;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TDJCoffObjData = class(TCoffObjData)
|
TDJCoffObjData = class(TCoffObjData)
|
||||||
@ -1123,22 +1122,6 @@ const pemagic : array[0..3] of byte = (
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCoffObjData.afteralloc;
|
|
||||||
var
|
|
||||||
mempos : qword;
|
|
||||||
i : longint;
|
|
||||||
begin
|
|
||||||
inherited afteralloc;
|
|
||||||
{ DJ Coff requires mempositions }
|
|
||||||
if not win32 then
|
|
||||||
begin
|
|
||||||
mempos:=0;
|
|
||||||
for i:=0 to ObjSectionList.Count-1 do
|
|
||||||
mempos:=TObjSection(ObjSectionList[i]).setmempos(mempos);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TDJCoffObjData
|
TDJCoffObjData
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -1419,11 +1402,9 @@ const pemagic : array[0..3] of byte = (
|
|||||||
|
|
||||||
function TCoffObjOutput.writedata(data:TObjData):boolean;
|
function TCoffObjOutput.writedata(data:TObjData):boolean;
|
||||||
var
|
var
|
||||||
orgdatapos,
|
|
||||||
datapos,
|
datapos,
|
||||||
sympos : aword;
|
sympos : aword;
|
||||||
i : longint;
|
i : longint;
|
||||||
gotreloc : boolean;
|
|
||||||
header : tcoffheader;
|
header : tcoffheader;
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
@ -1439,9 +1420,7 @@ const pemagic : array[0..3] of byte = (
|
|||||||
{ Sections first }
|
{ Sections first }
|
||||||
layoutsections(datapos);
|
layoutsections(datapos);
|
||||||
{ relocs }
|
{ relocs }
|
||||||
orgdatapos:=datapos;
|
|
||||||
ObjSectionList.ForEachCall(@section_set_reloc_datapos,@datapos);
|
ObjSectionList.ForEachCall(@section_set_reloc_datapos,@datapos);
|
||||||
gotreloc:=(orgdatapos<>datapos);
|
|
||||||
{ Symbols }
|
{ Symbols }
|
||||||
sympos:=datapos;
|
sympos:=datapos;
|
||||||
|
|
||||||
@ -1453,22 +1432,15 @@ const pemagic : array[0..3] of byte = (
|
|||||||
header.syms:=symidx;
|
header.syms:=symidx;
|
||||||
if win32 then
|
if win32 then
|
||||||
begin
|
begin
|
||||||
{$ifdef arm}
|
{$ifndef x86_64}
|
||||||
header.flag:=PE_FILE_32BIT_MACHINE or
|
header.flag:=PE_FILE_32BIT_MACHINE or
|
||||||
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
||||||
{$else arm}
|
{$else x86_64}
|
||||||
header.flag:=PE_FILE_BYTES_REVERSED_LO or PE_FILE_32BIT_MACHINE or
|
header.flag:=PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
||||||
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
{$endif x86_64}
|
||||||
{$endif arm}
|
|
||||||
if not gotreloc then
|
|
||||||
header.flag:=header.flag or PE_FILE_RELOCS_STRIPPED;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
header.flag:=COFF_FLAG_AR32WR or COFF_FLAG_NOLINES or COFF_FLAG_NOLSYMS;
|
||||||
header.flag:=COFF_FLAG_AR32WR or COFF_FLAG_NOLINES or COFF_FLAG_NOLSYMS;
|
|
||||||
if not gotreloc then
|
|
||||||
header.flag:=header.flag or COFF_FLAG_NORELOCS;
|
|
||||||
end;
|
|
||||||
FWriter.write(header,sizeof(header));
|
FWriter.write(header,sizeof(header));
|
||||||
{ Section headers }
|
{ Section headers }
|
||||||
ObjSectionList.ForEachCall(@section_write_header,nil);
|
ObjSectionList.ForEachCall(@section_write_header,nil);
|
||||||
|
Loading…
Reference in New Issue
Block a user