* Excluded oso_executable from attributes of user sections. User sections may currently be specified only for variables and typed consts, which are not executable.

* Fixed TLS directory size written to PE header when cross-compiling. It must be the value for target, not for host.

git-svn-id: trunk@18024 -
This commit is contained in:
sergei 2011-07-27 14:10:22 +00:00
parent 134f941937
commit c9f92c0323
2 changed files with 6 additions and 2 deletions

View File

@ -913,7 +913,7 @@ implementation
function TObjData.sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
const
secoptions : array[TAsmSectiontype] of TObjSectionOptions = ([],
{user} [oso_Data,oso_load,oso_write,oso_executable,oso_keep],
{user} [oso_Data,oso_load,oso_write,oso_keep],
{code} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep],
{Data} [oso_Data,oso_load,oso_write,oso_keep],
{ TODO: Fix sec_rodata be read-only-with-relocs}

View File

@ -282,14 +282,17 @@ interface
{$ifdef i386}
COFF_MAGIC = $14c;
COFF_OPT_MAGIC = $10b;
TLSDIR_SIZE = $18;
{$endif i386}
{$ifdef arm}
COFF_MAGIC = $1c0;
COFF_OPT_MAGIC = $10b;
TLSDIR_SIZE = $18;
{$endif arm}
{$ifdef x86_64}
COFF_MAGIC = $8664;
COFF_OPT_MAGIC = $20b;
TLSDIR_SIZE = $28;
{$endif x86_64}
function ReadDLLImports(const dllname:string;readdllproc:Treaddllproc):boolean;
@ -2324,7 +2327,8 @@ const pemagic : array[0..3] of byte = (
begin
tlssymbol:=tlsexesymbol.ObjSymbol;
peoptheader.DataDirectory[PE_DATADIR_TLS].vaddr:=tlssymbol.address;
peoptheader.DataDirectory[PE_DATADIR_TLS].size:=Sizeof(tlsdirectory);
{ sizeof(TlsDirectory) is different on host and target when cross-compiling }
peoptheader.DataDirectory[PE_DATADIR_TLS].size:=TLSDIR_SIZE;
if IsSharedLibrary then
begin
{ Here we should reset __FPC_tls_callbacks value to nil }