mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:49:21 +02:00
+ new tcalo_no_dead_strip flag for the high level typed const builder to
indicate symbols that should never be removed by the linker o TODO for llvm, needs support for the @llvm.used array (only used for the compiler ident, so it's not that important git-svn-id: trunk@31677 -
This commit is contained in:
parent
bf10ae45de
commit
fa7ebba80d
@ -113,7 +113,9 @@ type
|
|||||||
{ this symbol is the start of a block of data that should be
|
{ this symbol is the start of a block of data that should be
|
||||||
dead-stripable/smartlinkable; may imply starting a new section, but
|
dead-stripable/smartlinkable; may imply starting a new section, but
|
||||||
not necessarily (depends on what the platform requirements are) }
|
not necessarily (depends on what the platform requirements are) }
|
||||||
tcalo_make_dead_strippable
|
tcalo_make_dead_strippable,
|
||||||
|
{ this symbol should never be removed by the linker }
|
||||||
|
tcalo_no_dead_strip
|
||||||
);
|
);
|
||||||
ttcasmlistoptions = set of ttcasmlistoption;
|
ttcasmlistoptions = set of ttcasmlistoption;
|
||||||
|
|
||||||
@ -865,7 +867,11 @@ implementation
|
|||||||
prelist:=tasmlist.create;
|
prelist:=tasmlist.create;
|
||||||
{ only now add items based on the symbolname, because it may be
|
{ only now add items based on the symbolname, because it may be
|
||||||
modified by the "section" specifier in case of a typed constant }
|
modified by the "section" specifier in case of a typed constant }
|
||||||
if tcalo_make_dead_strippable in options then
|
|
||||||
|
{ both in case the data should be dead strippable and never dead
|
||||||
|
stripped, it should be in a separate section (so this property doesn't
|
||||||
|
affect other data) }
|
||||||
|
if ([tcalo_no_dead_strip,tcalo_make_dead_strippable]*options)<>[] then
|
||||||
begin
|
begin
|
||||||
maybe_new_object_file(prelist);
|
maybe_new_object_file(prelist);
|
||||||
{ we always need a new section here, since if we started a new
|
{ we always need a new section here, since if we started a new
|
||||||
@ -877,6 +883,18 @@ implementation
|
|||||||
new_section(prelist,section,secname,const_align(alignment))
|
new_section(prelist,section,secname,const_align(alignment))
|
||||||
else
|
else
|
||||||
prelist.concat(cai_align.Create(const_align(alignment)));
|
prelist.concat(cai_align.Create(const_align(alignment)));
|
||||||
|
|
||||||
|
{ On Darwin, use .reference to ensure the data doesn't get dead stripped.
|
||||||
|
On other platforms, the data must be in the .fpc section (which is
|
||||||
|
kept via the linker script) }
|
||||||
|
if tcalo_no_dead_strip in options then
|
||||||
|
begin
|
||||||
|
if target_info.system in systems_darwin then
|
||||||
|
prelist.concat(tai_directive.Create(asd_reference,sym.name))
|
||||||
|
else if section<>sec_fpc then
|
||||||
|
internalerror(2015101402);
|
||||||
|
end;
|
||||||
|
|
||||||
if not(tcalo_is_lab in options) then
|
if not(tcalo_is_lab in options) then
|
||||||
if sym.bind=AB_GLOBAL then
|
if sym.bind=AB_GLOBAL then
|
||||||
prelist.concat(tai_symbol.Create_Global(sym,0))
|
prelist.concat(tai_symbol.Create_Global(sym,0))
|
||||||
|
@ -171,6 +171,7 @@ implementation
|
|||||||
decl:=taillvmdecl.createdef(sym,def,fasmlist,section,alignment);
|
decl:=taillvmdecl.createdef(sym,def,fasmlist,section,alignment);
|
||||||
if tcalo_is_lab in options then
|
if tcalo_is_lab in options then
|
||||||
include(decl.flags,ldf_unnamed_addr);
|
include(decl.flags,ldf_unnamed_addr);
|
||||||
|
{ TODO: tcalo_no_dead_strip: add to @llvm.user meta-variable }
|
||||||
newasmlist.concat(decl);
|
newasmlist.concat(decl);
|
||||||
fasmlist:=newasmlist;
|
fasmlist:=newasmlist;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user