mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-24 05:59:34 +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);
|
||||
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;
|
||||
labeltype:=ltyp;
|
||||
is_set:=false;
|
||||
|
@ -369,11 +369,20 @@ interface
|
||||
syscall_convention : string = 'LEGACY';
|
||||
{$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 }
|
||||
{ (this will be prefixed with the target_info.cprefix) }
|
||||
defaultmainaliasname = 'main';
|
||||
mainaliasname : string = defaultmainaliasname;
|
||||
|
||||
|
||||
const
|
||||
default_settings : TSettings = (
|
||||
alignment : (
|
||||
|
@ -1296,10 +1296,6 @@ implementation
|
||||
{ add an underscore on darwin. }
|
||||
if (target_info.system in systems_darwin) then
|
||||
result := '_' + result;
|
||||
{$ifdef llvm}
|
||||
{ in LLVM, all non-procedure local symbols have to start with an '@' }
|
||||
result:='@'+result;
|
||||
{$endif llvm}
|
||||
end;
|
||||
|
||||
function make_dllmangledname(const dllname,importname:TSymStr;import_nr : word; pco : tproccalloption):TSymStr;
|
||||
@ -5271,7 +5267,7 @@ implementation
|
||||
exit;
|
||||
end;
|
||||
{$ifndef jvm}
|
||||
mangledname:=defaultmangledname;
|
||||
mangledname:=globalsymbolmangleprefix+defaultmangledname+globalsymbolmanglesuffix;
|
||||
{$else not jvm}
|
||||
mangledname:=jvmmangledbasename(false);
|
||||
if (po_has_importdll in procoptions) then
|
||||
@ -5649,9 +5645,9 @@ implementation
|
||||
_mangledname:=stringdup(minilzw_encode(s));
|
||||
{$else}
|
||||
{$ifdef symansistr}
|
||||
_mangledname:=s;
|
||||
_mangledname:=llvmglobalprefix+s+llvmglobalsuffix;
|
||||
{$else symansistr}
|
||||
_mangledname:=stringdup(s);
|
||||
_mangledname:=stringdup(globalsymbolmangleprefix+s+globalsymbolmanglesuffix);
|
||||
{$endif symansistr}
|
||||
{$endif}
|
||||
{$endif jvm}
|
||||
|
@ -1659,7 +1659,7 @@ implementation
|
||||
{$endif symansistr}
|
||||
else
|
||||
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}
|
||||
cachedmangledname:=result;
|
||||
{$else symansistr}
|
||||
@ -1865,12 +1865,12 @@ implementation
|
||||
{$endif symansistr}
|
||||
{$ifdef compress}
|
||||
{$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}
|
||||
{$ifdef symansistr}
|
||||
_mangledname:=make_mangledname(prefix,owner,usename);
|
||||
_mangledname:=llvmglobalprefix+make_mangledname(prefix,owner,usename)+llvmglobalsuffix;
|
||||
{$else symansistr}
|
||||
_mangledname:=stringdup(make_mangledname(prefix,owner,usename));
|
||||
_mangledname:=stringdup(globalsymbolmangleprefix+make_mangledname(prefix,owner,usename)+globalsymbolmanglesuffix);
|
||||
{$endif symansistr}
|
||||
{$endif compress}
|
||||
{$endif jvm}
|
||||
@ -1922,9 +1922,9 @@ implementation
|
||||
_mangledname:=stringdup(minilzw_encode(s));
|
||||
{$else}
|
||||
{$ifdef symansistr}
|
||||
_mangledname:=s;
|
||||
_mangledname:=llvmglobalprefix+s+llvmglobalsuffix;
|
||||
{$else symansistr}
|
||||
_mangledname:=stringdup(s);
|
||||
_mangledname:=stringdup(globalsymbolmangleprefix+s+globalsymbolmanglesuffix);
|
||||
{$endif symansistr}
|
||||
{$endif}
|
||||
include(varoptions,vo_has_mangledname);
|
||||
@ -2165,7 +2165,7 @@ implementation
|
||||
begin
|
||||
case abstyp of
|
||||
toasm :
|
||||
mangledname:=asmname^;
|
||||
mangledname:=globalsymbolmangleprefix+asmname^+globalsymbolmanglesuffix;
|
||||
toaddr :
|
||||
mangledname:='$'+tostr(addroffset);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user