From de00a1d76d69d701c156015d5729b7c640f9d74b Mon Sep 17 00:00:00 2001 From: Jeppe Johansen Date: Sat, 27 Dec 2014 11:02:38 +0000 Subject: [PATCH] Implement simple support for .thumb_func in the ELF output. git-svn-id: branches/laksen/armiw@29340 - --- compiler/assemble.pas | 5 +++-- compiler/ogbase.pas | 13 +++++++++++++ compiler/ogelf.pas | 7 +++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/compiler/assemble.pas b/compiler/assemble.pas index cb1d0f0949..39af8f4d0b 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -1214,9 +1214,10 @@ Implementation asd_reference: { ignore for now, but should be added} ; +{$ifdef ARM} asd_thumb_func: - { ignore for now, but should be added} - ; + ObjData.ThumbFunc:=true; +{$endif ARM} else internalerror(2010011101); end; diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index 914e878fbf..68d3ab124b 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -233,6 +233,9 @@ interface ExeSection : TExeSection; USed : Boolean; VTRefList : TFPObjectList; +{$ifdef ARM} + ThumbFunc : boolean; +{$endif ARM} constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);virtual; destructor destroy;override; function write(const d;l:aword):aword; @@ -289,6 +292,9 @@ interface public CurrPass : byte; ExecStack : boolean; +{$ifdef ARM} + ThumbFunc : boolean; +{$endif ARM} constructor create(const n:string);virtual; destructor destroy;override; { Sections } @@ -984,6 +990,9 @@ implementation FCachedAsmSymbolList:=TFPObjectList.Create(false); { section class type for creating of new sections } FCObjSection:=TObjSection; +{$ifdef ARM} + ThumbFunc:=false; +{$endif ARM} end; @@ -1131,6 +1140,10 @@ implementation begin result:=CObjSection.create(FObjSectionList,aname,aalign,aoptions); result.ObjData:=self; +{$ifdef ARM} + result.ThumbFunc:=ThumbFunc; + ThumbFunc:=false; +{$endif ARM} end; FCurrObjSec:=result; end; diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index 359d74d598..ac22caed65 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -968,6 +968,13 @@ implementation elfsym.st_name:=nameidx; elfsym.st_size:=objsym.size; elfsym.st_value:=objsym.address; + +{$ifdef ARM} + if (objsym.typ=AT_FUNCTION) and + objsym.objsection.ThumbFunc then + inc(elfsym.st_value); +{$endif ARM} + case objsym.bind of AB_LOCAL : begin