mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 06:29:25 +01:00
* Merged TElfObjSection.secshidx and TCoffObjSection.secidx into TObjSection.index.
git-svn-id: trunk@21848 -
This commit is contained in:
parent
75420e78a8
commit
3b3da49ad6
@ -188,6 +188,7 @@ interface
|
||||
procedure SetSecOptions(Aoptions:TObjSectionOptions);
|
||||
public
|
||||
ObjData : TObjData;
|
||||
index : longword; { index of section in section headers }
|
||||
SecSymIdx : longint; { index for the section in symtab }
|
||||
SecAlign : shortint; { alignment of the section }
|
||||
{ section Data }
|
||||
|
||||
@ -107,7 +107,6 @@ interface
|
||||
coffrelocs,
|
||||
coffrelocpos : aword;
|
||||
public
|
||||
secidx : longword;
|
||||
constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
|
||||
procedure addsymsizereloc(ofs:aword;p:TObjSymbol;symsize:aword;reloctype:TObjRelocationType);
|
||||
procedure fixuprelocs(Exe:TExeOutput);override;
|
||||
@ -1186,14 +1185,14 @@ const pemagic : array[0..3] of byte = (
|
||||
with TCoffObjSection(p) do
|
||||
begin
|
||||
Inc(plongword(arg)^);
|
||||
secidx:=plongword(arg)^;
|
||||
index:=plongword(arg)^;
|
||||
|
||||
secsymidx:=symidx;
|
||||
{ Both GNU and Microsoft toolchains write section symbols using
|
||||
storage class 3 (STATIC).
|
||||
No reason to use COFF_SYM_SECTION, it is silently converted to 3 by
|
||||
PE binutils and causes warnings with DJGPP binutils. }
|
||||
write_symbol(name,mempos,secidx,COFF_SYM_LOCAL,1);
|
||||
write_symbol(name,mempos,index,COFF_SYM_LOCAL,1);
|
||||
{ AUX }
|
||||
fillchar(secrec,sizeof(secrec),0);
|
||||
secrec.len:=Size;
|
||||
@ -1321,13 +1320,13 @@ const pemagic : array[0..3] of byte = (
|
||||
AB_GLOBAL :
|
||||
begin
|
||||
globalval:=COFF_SYM_GLOBAL;
|
||||
sectionval:=TCoffObjSection(objsym.objsection).secidx;
|
||||
sectionval:=objsym.objsection.index;
|
||||
value:=objsym.address;
|
||||
end;
|
||||
AB_LOCAL :
|
||||
begin
|
||||
globalval:=COFF_SYM_LOCAL;
|
||||
sectionval:=TCoffObjSection(objsym.objsection).secidx;
|
||||
sectionval:=objsym.objsection.index;
|
||||
value:=objsym.address;
|
||||
end;
|
||||
else
|
||||
|
||||
@ -39,7 +39,6 @@ interface
|
||||
type
|
||||
TElfObjSection = class(TObjSection)
|
||||
public
|
||||
secshidx : longint; { index for the section in symtab }
|
||||
shstridx,
|
||||
shtype,
|
||||
shflags,
|
||||
@ -692,7 +691,7 @@ implementation
|
||||
constructor TElfObjSection.create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);
|
||||
begin
|
||||
inherited create(AList,Aname,Aalign,aoptions);
|
||||
secshidx:=0;
|
||||
index:=0;
|
||||
shstridx:=0;
|
||||
encodesechdrflags(aoptions,shtype,shflags);
|
||||
shlink:=0;
|
||||
@ -709,7 +708,7 @@ implementation
|
||||
decodesechdrflags(Ashtype,Ashflags,aoptions);
|
||||
inherited create(aobjdata.ObjSectionList,Aname,Aalign,aoptions);
|
||||
objdata:=aobjdata;
|
||||
secshidx:=0;
|
||||
index:=0;
|
||||
shstridx:=0;
|
||||
shtype:=AshType;
|
||||
shflags:=AshFlags;
|
||||
@ -1049,7 +1048,7 @@ implementation
|
||||
else
|
||||
begin
|
||||
if assigned(objsym.objsection) then
|
||||
elfsym.st_shndx:=TElfObjSection(objsym.objsection).secshidx
|
||||
elfsym.st_shndx:=objsym.objsection.index
|
||||
else
|
||||
elfsym.st_shndx:=SHN_UNDEF;
|
||||
objsym.symidx:=symidx;
|
||||
@ -1084,9 +1083,9 @@ implementation
|
||||
begin
|
||||
{ create the reloc section }
|
||||
if relocs_use_addend then
|
||||
relocsect:=TElfObjSection.create_ext(data,'.rela'+s.name,SHT_RELA,0,symtabsect.secshidx,s.secshidx,4,3*sizeof(pint))
|
||||
relocsect:=TElfObjSection.create_ext(data,'.rela'+s.name,SHT_RELA,0,symtabsect.index,s.index,4,3*sizeof(pint))
|
||||
else
|
||||
relocsect:=TElfObjSection.create_ext(data,'.rel'+s.name,SHT_REL,0,symtabsect.secshidx,s.secshidx,4,2*sizeof(pint));
|
||||
relocsect:=TElfObjSection.create_ext(data,'.rel'+s.name,SHT_REL,0,symtabsect.index,s.index,4,2*sizeof(pint));
|
||||
{ add the relocations }
|
||||
for i:=0 to s.Objrelocations.count-1 do
|
||||
begin
|
||||
@ -1180,7 +1179,7 @@ implementation
|
||||
if (TElfObjSection(p).shtype in [SHT_SYMTAB,SHT_STRTAB,SHT_REL,SHT_RELA]) then
|
||||
exit;
|
||||
TObjSection(p).secsymidx:=symtabsect.symidx;
|
||||
symtabsect.writeInternalSymbol(0,STT_SECTION,TElfObjSection(p).secshidx);
|
||||
symtabsect.writeInternalSymbol(0,STT_SECTION,TObjSection(p).index);
|
||||
end;
|
||||
|
||||
|
||||
@ -1212,7 +1211,7 @@ implementation
|
||||
symtabsect.WriteSymbol(objsym);
|
||||
end;
|
||||
{ update the .symtab section header }
|
||||
symtabsect.shlink:=TElfObjSection(symtabsect.fstrsec).secshidx;
|
||||
symtabsect.shlink:=symtabsect.fstrsec.index;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1254,7 +1253,7 @@ implementation
|
||||
|
||||
procedure TElfObjectOutput.section_count_sections(p:TObject;arg:pointer);
|
||||
begin
|
||||
TElfObjSection(p).secshidx:=pword(arg)^;
|
||||
TElfObjSection(p).index:=pword(arg)^;
|
||||
inc(pword(arg)^);
|
||||
end;
|
||||
|
||||
@ -1335,7 +1334,7 @@ implementation
|
||||
{$endif arm}
|
||||
header.e_version:=1;
|
||||
header.e_shoff:=shoffset;
|
||||
header.e_shstrndx:=shstrtabsect.secshidx;
|
||||
header.e_shstrndx:=shstrtabsect.index;
|
||||
|
||||
header.e_shnum:=nsections;
|
||||
header.e_ehsize:=sizeof(telfheader);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user