mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-08 10:39:29 +02:00
* Fixed oso_debug section attribute being not preserved while reading/writing DJCOFF object files.
* Fixed header data positions for DJCOFF executables, they need adjustment by stub size. * Fixed symbol values in DJCOFF executables, they must be absolute. * Fixed missing oso_common flag on TExeOutput.commonObjSection, causing incorrect COFF relocations to this section. git-svn-id: trunk@21408 -
This commit is contained in:
parent
3a2afe27aa
commit
8814f56081
@ -1596,6 +1596,8 @@ implementation
|
||||
AddObjData(internalObjData);
|
||||
{ Common Data section }
|
||||
commonObjSection:=internalObjData.createsection(sec_bss,'');
|
||||
{ setting SecOptions acts as 'include' }
|
||||
commonObjSection.SecOptions:=[oso_common];
|
||||
end;
|
||||
|
||||
|
||||
|
@ -226,6 +226,7 @@ interface
|
||||
nsects : word;
|
||||
nsyms,
|
||||
sympos : aword;
|
||||
datapos_offset: longword;
|
||||
function totalheadersize:longword;
|
||||
procedure ExeSectionList_pass2_header(p:TObject;arg:pointer);
|
||||
procedure write_symbol(const name:string;value:aword;section:smallint;typ,aux:byte);
|
||||
@ -244,6 +245,7 @@ interface
|
||||
|
||||
TDJCoffexeoutput = class(TCoffexeoutput)
|
||||
constructor create;override;
|
||||
procedure MemPos_Header;override;
|
||||
end;
|
||||
|
||||
TPECoffexeoutput = class(TCoffexeoutput)
|
||||
@ -729,6 +731,8 @@ const pemagic : array[0..3] of byte = (
|
||||
else
|
||||
result:=COFF_STYP_DATA;
|
||||
end
|
||||
else if oso_debug in aoptions then
|
||||
result:=COFF_STYP_NOLOAD
|
||||
else
|
||||
result:=COFF_STYP_REG;
|
||||
end;
|
||||
@ -743,6 +747,8 @@ const pemagic : array[0..3] of byte = (
|
||||
result:=[oso_load]
|
||||
else if flags and COFF_STYP_DATA<>0 then
|
||||
result:=[oso_data,oso_load]
|
||||
else if flags and COFF_STYP_NOLOAD<>0 then
|
||||
result:=[oso_data,oso_debug]
|
||||
else
|
||||
result:=[oso_data]
|
||||
end;
|
||||
@ -2086,7 +2092,10 @@ const pemagic : array[0..3] of byte = (
|
||||
if assigned(exesec) then
|
||||
begin
|
||||
secval:=exesec.secsymidx;
|
||||
value:=address-exesec.mempos;
|
||||
if win32 then
|
||||
value:=address-exesec.mempos
|
||||
else
|
||||
value:=address;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -2137,7 +2146,7 @@ const pemagic : array[0..3] of byte = (
|
||||
sechdr.datasize:=Size;
|
||||
end;
|
||||
if (Size>0) then
|
||||
sechdr.datapos:=datapos;
|
||||
sechdr.datapos:=datapos-datapos_offset;
|
||||
sechdr.nrelocs:=0;
|
||||
sechdr.relocpos:=0;
|
||||
if win32 then
|
||||
@ -2393,7 +2402,7 @@ const pemagic : array[0..3] of byte = (
|
||||
header.mach:=COFF_MAGIC;
|
||||
header.nsects:=nsects;
|
||||
if writeDbgStrings then
|
||||
header.sympos:=sympos;
|
||||
header.sympos:=sympos-datapos_offset;
|
||||
if hassymbols then
|
||||
header.syms:=nsyms;
|
||||
if win32 then
|
||||
@ -2556,11 +2565,18 @@ const pemagic : array[0..3] of byte = (
|
||||
constructor TDJCoffexeoutput.create;
|
||||
begin
|
||||
inherited createcoff(false);
|
||||
datapos_offset:=sizeof(go32v2stub);
|
||||
CExeSection:=TDJCoffExeSection;
|
||||
CObjData:=TDJCoffObjData;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDJCoffexeoutput.MemPos_Header;
|
||||
begin
|
||||
{ Headers are not loaded, first 4K page is reserved }
|
||||
CurrMemPos:=$1000;
|
||||
end;
|
||||
|
||||
constructor TPECoffexeoutput.create;
|
||||
begin
|
||||
inherited createcoff(true);
|
||||
|
Loading…
Reference in New Issue
Block a user