+ custom section name support for llvm

git-svn-id: trunk@32400 -
This commit is contained in:
Jonas Maebe 2015-11-21 12:36:26 +00:00
parent 92ba1c90a1
commit 91e8f4c439
3 changed files with 19 additions and 3 deletions

View File

@ -165,9 +165,11 @@ interface
sec: TAsmSectiontype;
alignment: shortint;
flags: taillvmdeclflags;
secname: TSymStr;
constructor createdecl(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
constructor createdef(_namesym: tasmsymbol; _def: tdef; _initdata: tasmlist; _sec: tasmsectiontype; _alignment: shortint);
constructor createtls(_namesym: tasmsymbol; _def: tdef; _alignment: shortint);
procedure setsecname(const name: TSymStr);
destructor destroy; override;
end;
@ -221,6 +223,14 @@ uses
end;
procedure taillvmdecl.setsecname(const name: TSymStr);
begin
if sec<>sec_user then
internalerror(2015111501);
secname:=name;
end;
destructor taillvmdecl.destroy;
begin
initdata.free;

View File

@ -1001,6 +1001,13 @@ implementation
end;
dec(fdecllevel);
end;
{ custom section name? }
if taillvmdecl(hp).sec=sec_user then
begin
writer.AsmWrite(', section "');
writer.AsmWrite(taillvmdecl(hp).secname);
writer.AsmWrite('"');
end;
{ alignment }
writer.AsmWrite(', align ');
writer.AsmWriteln(tostr(taillvmdecl(hp).alignment));

View File

@ -162,13 +162,12 @@ implementation
newasmlist: tasmlist;
decl: taillvmdecl;
begin
{ todo }
if section = sec_user then
internalerror(2014052904);
newasmlist:=tasmlist.create;
{ llvm declaration with as initialisation data all the elements from the
original asmlist }
decl:=taillvmdecl.createdef(sym,def,fasmlist,section,alignment);
if section=sec_user then
decl.setsecname(secname);
if tcalo_is_lab in options then
include(decl.flags,ldf_unnamed_addr);
{ TODO: tcalo_no_dead_strip: add to @llvm.user meta-variable }