mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 08:30:28 +02:00
+ new globalsymbolmangleprefix/suffix constant set to '@"\01' resp. '"'
for llvm, and empty for other targets: o the '@' is required to mark a global/static symbol identifier in llvm o the double quotes are required in case special characters are involved o the \01 means that the name should not be mangled by llvm (e.g., by default it still adds the C-prefix to all symbol names, and replaces some special characters with alternatives) * apply this prefix/suffix in all name mangling routines git-svn-id: branches/hlcgllvm@26995 -
This commit is contained in:
parent
41a53ef037
commit
6b7ed0234c
@ -428,7 +428,7 @@ implementation
|
|||||||
|
|
||||||
constructor TAsmLabel.Createglobal(AList:TFPHashObjectList;const modulename:TSymStr;nr:longint;ltyp:TAsmLabelType);
|
constructor TAsmLabel.Createglobal(AList:TFPHashObjectList;const modulename:TSymStr;nr:longint;ltyp:TAsmLabelType);
|
||||||
begin
|
begin
|
||||||
inherited Create(AList,'_$'+modulename+'$_L'+asmlabeltypeprefix[ltyp]+tostr(nr),AB_GLOBAL,AT_DATA);
|
inherited Create(AList,(globalsymbolmangleprefix+'_$')+modulename+'$_L'+asmlabeltypeprefix[ltyp]+tostr(nr)+globalsymbolmanglesuffix,AB_GLOBAL,AT_DATA);
|
||||||
labelnr:=nr;
|
labelnr:=nr;
|
||||||
labeltype:=ltyp;
|
labeltype:=ltyp;
|
||||||
is_set:=false;
|
is_set:=false;
|
||||||
|
@ -369,11 +369,20 @@ interface
|
|||||||
syscall_convention : string = 'LEGACY';
|
syscall_convention : string = 'LEGACY';
|
||||||
{$endif powerpc}
|
{$endif powerpc}
|
||||||
|
|
||||||
|
{$ifdef llvm}
|
||||||
|
{ the \01 means: don't mangle the symbol name coming after it }
|
||||||
|
globalsymbolmangleprefix='@"\01';
|
||||||
|
globalsymbolmanglesuffix='"';
|
||||||
|
{$else llvm}
|
||||||
|
globalsymbolmangleprefix='';
|
||||||
|
globalsymbolmanglesuffix='';
|
||||||
|
{$endif llvm}
|
||||||
{ default name of the C-style "main" procedure of the library/program }
|
{ default name of the C-style "main" procedure of the library/program }
|
||||||
{ (this will be prefixed with the target_info.cprefix) }
|
{ (this will be prefixed with the target_info.cprefix) }
|
||||||
defaultmainaliasname = 'main';
|
defaultmainaliasname = 'main';
|
||||||
mainaliasname : string = defaultmainaliasname;
|
mainaliasname : string = defaultmainaliasname;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
default_settings : TSettings = (
|
default_settings : TSettings = (
|
||||||
alignment : (
|
alignment : (
|
||||||
|
@ -1296,10 +1296,6 @@ implementation
|
|||||||
{ add an underscore on darwin. }
|
{ add an underscore on darwin. }
|
||||||
if (target_info.system in systems_darwin) then
|
if (target_info.system in systems_darwin) then
|
||||||
result := '_' + result;
|
result := '_' + result;
|
||||||
{$ifdef llvm}
|
|
||||||
{ in LLVM, all non-procedure local symbols have to start with an '@' }
|
|
||||||
result:='@'+result;
|
|
||||||
{$endif llvm}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function make_dllmangledname(const dllname,importname:TSymStr;import_nr : word; pco : tproccalloption):TSymStr;
|
function make_dllmangledname(const dllname,importname:TSymStr;import_nr : word; pco : tproccalloption):TSymStr;
|
||||||
@ -5271,7 +5267,7 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$ifndef jvm}
|
{$ifndef jvm}
|
||||||
mangledname:=defaultmangledname;
|
mangledname:=globalsymbolmangleprefix+defaultmangledname+globalsymbolmanglesuffix;
|
||||||
{$else not jvm}
|
{$else not jvm}
|
||||||
mangledname:=jvmmangledbasename(false);
|
mangledname:=jvmmangledbasename(false);
|
||||||
if (po_has_importdll in procoptions) then
|
if (po_has_importdll in procoptions) then
|
||||||
@ -5649,9 +5645,9 @@ implementation
|
|||||||
_mangledname:=stringdup(minilzw_encode(s));
|
_mangledname:=stringdup(minilzw_encode(s));
|
||||||
{$else}
|
{$else}
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
_mangledname:=s;
|
_mangledname:=llvmglobalprefix+s+llvmglobalsuffix;
|
||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
_mangledname:=stringdup(s);
|
_mangledname:=stringdup(globalsymbolmangleprefix+s+globalsymbolmanglesuffix);
|
||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
|
@ -1659,7 +1659,7 @@ implementation
|
|||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
result:=target_info.cprefix+'OBJC_IVAR_$_'+tobjectdef(owner.defowner).objextname^+'.'+RealName;
|
result:=globalsymbolmangleprefix+target_info.cprefix+'OBJC_IVAR_$_'+tobjectdef(owner.defowner).objextname^+'.'+RealName+globalsymbolmanglesuffix;
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
cachedmangledname:=result;
|
cachedmangledname:=result;
|
||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
@ -1865,12 +1865,12 @@ implementation
|
|||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
{$ifdef compress}
|
{$ifdef compress}
|
||||||
{$error add ansistring support for symansistr}
|
{$error add ansistring support for symansistr}
|
||||||
_mangledname:=stringdup(minilzw_encode(make_mangledname(prefix,owner,usename)));
|
_mangledname:=stringdup(minilzw_encode(llvmglobalprefix+make_mangledname(prefix,owner,usename)+llvmglobalsuffix));
|
||||||
{$else compress}
|
{$else compress}
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
_mangledname:=make_mangledname(prefix,owner,usename);
|
_mangledname:=llvmglobalprefix+make_mangledname(prefix,owner,usename)+llvmglobalsuffix;
|
||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
_mangledname:=stringdup(make_mangledname(prefix,owner,usename));
|
_mangledname:=stringdup(globalsymbolmangleprefix+make_mangledname(prefix,owner,usename)+globalsymbolmanglesuffix);
|
||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
{$endif compress}
|
{$endif compress}
|
||||||
{$endif jvm}
|
{$endif jvm}
|
||||||
@ -1922,9 +1922,9 @@ implementation
|
|||||||
_mangledname:=stringdup(minilzw_encode(s));
|
_mangledname:=stringdup(minilzw_encode(s));
|
||||||
{$else}
|
{$else}
|
||||||
{$ifdef symansistr}
|
{$ifdef symansistr}
|
||||||
_mangledname:=s;
|
_mangledname:=llvmglobalprefix+s+llvmglobalsuffix;
|
||||||
{$else symansistr}
|
{$else symansistr}
|
||||||
_mangledname:=stringdup(s);
|
_mangledname:=stringdup(globalsymbolmangleprefix+s+globalsymbolmanglesuffix);
|
||||||
{$endif symansistr}
|
{$endif symansistr}
|
||||||
{$endif}
|
{$endif}
|
||||||
include(varoptions,vo_has_mangledname);
|
include(varoptions,vo_has_mangledname);
|
||||||
@ -2165,7 +2165,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
case abstyp of
|
case abstyp of
|
||||||
toasm :
|
toasm :
|
||||||
mangledname:=asmname^;
|
mangledname:=globalsymbolmangleprefix+asmname^+globalsymbolmanglesuffix;
|
||||||
toaddr :
|
toaddr :
|
||||||
mangledname:='$'+tostr(addroffset);
|
mangledname:='$'+tostr(addroffset);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user