mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 06:19:32 +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;
|
||||
function sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;override;
|
||||
procedure writereloc(data:aint;len:aword;p:TObjSymbol;reloctype:TObjRelocationType);override;
|
||||
procedure afteralloc;override;
|
||||
end;
|
||||
|
||||
TDJCoffObjData = class(TCoffObjData)
|
||||
@ -1123,22 +1122,6 @@ const pemagic : array[0..3] of byte = (
|
||||
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
|
||||
****************************************************************************}
|
||||
@ -1419,11 +1402,9 @@ const pemagic : array[0..3] of byte = (
|
||||
|
||||
function TCoffObjOutput.writedata(data:TObjData):boolean;
|
||||
var
|
||||
orgdatapos,
|
||||
datapos,
|
||||
sympos : aword;
|
||||
i : longint;
|
||||
gotreloc : boolean;
|
||||
header : tcoffheader;
|
||||
begin
|
||||
result:=false;
|
||||
@ -1439,9 +1420,7 @@ const pemagic : array[0..3] of byte = (
|
||||
{ Sections first }
|
||||
layoutsections(datapos);
|
||||
{ relocs }
|
||||
orgdatapos:=datapos;
|
||||
ObjSectionList.ForEachCall(@section_set_reloc_datapos,@datapos);
|
||||
gotreloc:=(orgdatapos<>datapos);
|
||||
{ Symbols }
|
||||
sympos:=datapos;
|
||||
|
||||
@ -1453,22 +1432,15 @@ const pemagic : array[0..3] of byte = (
|
||||
header.syms:=symidx;
|
||||
if win32 then
|
||||
begin
|
||||
{$ifdef arm}
|
||||
{$ifndef x86_64}
|
||||
header.flag:=PE_FILE_32BIT_MACHINE or
|
||||
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
||||
{$else arm}
|
||||
header.flag:=PE_FILE_BYTES_REVERSED_LO or PE_FILE_32BIT_MACHINE or
|
||||
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
||||
{$endif arm}
|
||||
if not gotreloc then
|
||||
header.flag:=header.flag or PE_FILE_RELOCS_STRIPPED;
|
||||
{$else x86_64}
|
||||
header.flag:=PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
|
||||
{$endif x86_64}
|
||||
end
|
||||
else
|
||||
begin
|
||||
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;
|
||||
header.flag:=COFF_FLAG_AR32WR or COFF_FLAG_NOLINES or COFF_FLAG_NOLSYMS;
|
||||
FWriter.write(header,sizeof(header));
|
||||
{ Section headers }
|
||||
ObjSectionList.ForEachCall(@section_write_header,nil);
|
||||
|
Loading…
Reference in New Issue
Block a user