* only specify the "unnamed_addr" flag for initialised data if its symbol is

a tasmlabel, since otherwise the address needs to remain unique

git-svn-id: trunk@31654 -
This commit is contained in:
Jonas Maebe 2015-09-12 23:33:46 +00:00
parent 7a08319d2e
commit 2741b37f28
3 changed files with 10 additions and 3 deletions

View File

@ -150,7 +150,8 @@ interface
taillvmdeclflag =
(
ldf_definition, { definition as opposed to (an external) declaration }
ldf_tls { tls definition }
ldf_tls, { tls definition }
ldf_unnamed_addr { address doesn't matter, only content }
);
taillvmdeclflags = set of taillvmdeclflag;

View File

@ -948,10 +948,12 @@ implementation
end;
if (ldf_tls in taillvmdecl(hp).flags) then
writer.AsmWrite('thread_local ');
if ldf_unnamed_addr in taillvmdecl(hp).flags then
writer.AsmWrite('unnamed_addr ');
{ todo: handle more different section types (mainly
Objective-C }
if taillvmdecl(hp).sec in [sec_rodata,sec_rodata_norel] then
writer.AsmWrite('unnamed_addr constant ')
writer.AsmWrite('constant ')
else
writer.AsmWrite('global ');
if not assigned(taillvmdecl(hp).initdata) then

View File

@ -160,6 +160,7 @@ implementation
procedure tllvmtai_typedconstbuilder.finalize_asmlist(sym: tasmsymbol; def: tdef; section: TAsmSectiontype; const secname: TSymStr; alignment: shortint; const options: ttcasmlistoptions);
var
newasmlist: tasmlist;
decl: taillvmdecl;
begin
{ todo }
if section = sec_user then
@ -167,7 +168,10 @@ implementation
newasmlist:=tasmlist.create;
{ llvm declaration with as initialisation data all the elements from the
original asmlist }
newasmlist.concat(taillvmdecl.createdef(sym,def,fasmlist,section,alignment));
decl:=taillvmdecl.createdef(sym,def,fasmlist,section,alignment);
if tcalo_is_lab in options then
include(decl.flags,ldf_unnamed_addr);
newasmlist.concat(decl);
fasmlist:=newasmlist;
end;