mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 23:01:55 +02:00
* lineinfo fixed for binary writer
* add tai_directive to replace old tai_direct calls in powerpc git-svn-id: trunk@1139 -
This commit is contained in:
parent
1f8c074ab4
commit
82faa95118
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/08/10]
|
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/09/08]
|
||||||
#
|
#
|
||||||
default: all
|
default: all
|
||||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince
|
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince
|
||||||
@ -234,6 +234,7 @@ override PACKAGE_NAME=compiler
|
|||||||
override PACKAGE_VERSION=2.0.0
|
override PACKAGE_VERSION=2.0.0
|
||||||
unexport FPC_VERSION FPC_COMPILERINFO
|
unexport FPC_VERSION FPC_COMPILERINFO
|
||||||
CYCLETARGETS=i386 powerpc sparc arm x86_64
|
CYCLETARGETS=i386 powerpc sparc arm x86_64
|
||||||
|
ALLTARGETS=$(CYCLETARGETS) m68k
|
||||||
ifdef ALPHA
|
ifdef ALPHA
|
||||||
PPC_TARGET=alpha
|
PPC_TARGET=alpha
|
||||||
endif
|
endif
|
||||||
@ -2617,14 +2618,14 @@ tempclean:
|
|||||||
-$(DEL) $(PPCROSSNAME) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC)
|
-$(DEL) $(PPCROSSNAME) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC)
|
||||||
execlean :
|
execlean :
|
||||||
-$(DEL) ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) $(EXENAME)
|
-$(DEL) ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) $(EXENAME)
|
||||||
$(addsuffix _clean,$(CYCLETARGETS)):
|
$(addsuffix _clean,$(ALLTARGETS)):
|
||||||
-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
|
-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
|
||||||
-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
|
-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
|
||||||
-$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
|
-$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
|
||||||
cycleclean: cleanall $(addsuffix _clean,$(PPC_TARGET))
|
cycleclean: cleanall $(addsuffix _clean,$(PPC_TARGET))
|
||||||
-$(DEL) $(EXENAME)
|
-$(DEL) $(EXENAME)
|
||||||
clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
|
clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
|
||||||
distclean: tempclean execlean cleanall $(addsuffix _clean,$(CYCLETARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
|
distclean: tempclean execlean cleanall $(addsuffix _clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
|
||||||
$(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(COMPILERUTILSDIR)/msg2inc.pp
|
$(MSG2INC): $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(COMPILERUTILSDIR)/msg2inc.pp
|
||||||
$(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
|
$(COMPILER) -FE. $(COMPILERUTILSDIR)/msg2inc.pp
|
||||||
msgtxt.inc: $(MSGFILE)
|
msgtxt.inc: $(MSGFILE)
|
||||||
|
@ -34,6 +34,9 @@ unexport FPC_VERSION FPC_COMPILERINFO
|
|||||||
# Which platforms are ready for inclusion in the cycle
|
# Which platforms are ready for inclusion in the cycle
|
||||||
CYCLETARGETS=i386 powerpc sparc arm x86_64
|
CYCLETARGETS=i386 powerpc sparc arm x86_64
|
||||||
|
|
||||||
|
# All supported targets used for clean
|
||||||
|
ALLTARGETS=$(CYCLETARGETS) m68k
|
||||||
|
|
||||||
# Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
|
# Allow ALPHA, POWERPC, M68K, I386 defines for target cpu
|
||||||
ifdef ALPHA
|
ifdef ALPHA
|
||||||
PPC_TARGET=alpha
|
PPC_TARGET=alpha
|
||||||
@ -294,7 +297,7 @@ tempclean:
|
|||||||
execlean :
|
execlean :
|
||||||
-$(DEL) ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) $(EXENAME)
|
-$(DEL) ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcsparc$(EXEEXT) $(EXENAME)
|
||||||
|
|
||||||
$(addsuffix _clean,$(CYCLETARGETS)):
|
$(addsuffix _clean,$(ALLTARGETS)):
|
||||||
-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
|
-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
|
||||||
-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
|
-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
|
||||||
-$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
|
-$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
|
||||||
@ -304,7 +307,7 @@ cycleclean: cleanall $(addsuffix _clean,$(PPC_TARGET))
|
|||||||
|
|
||||||
clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
|
clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
|
||||||
|
|
||||||
distclean: tempclean execlean cleanall $(addsuffix _clean,$(CYCLETARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
|
distclean: tempclean execlean cleanall $(addsuffix _clean,$(ALLTARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
@ -50,6 +50,7 @@ interface
|
|||||||
sec_code,sec_data,sec_rodata,sec_bss,sec_threadvar,
|
sec_code,sec_data,sec_rodata,sec_bss,sec_threadvar,
|
||||||
sec_common, { used for executable creation }
|
sec_common, { used for executable creation }
|
||||||
sec_custom, { custom section, no prefix }
|
sec_custom, { custom section, no prefix }
|
||||||
|
sec_stub, { used for darwin import stubs }
|
||||||
{ stabs }
|
{ stabs }
|
||||||
sec_stab,sec_stabstr,
|
sec_stab,sec_stabstr,
|
||||||
{ win32 }
|
{ win32 }
|
||||||
@ -185,8 +186,7 @@ interface
|
|||||||
procedure writebytes(var data;len:aint);
|
procedure writebytes(var data;len:aint);
|
||||||
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);virtual;abstract;
|
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);virtual;abstract;
|
||||||
procedure writesymbol(p:tasmsymbol);virtual;abstract;
|
procedure writesymbol(p:tasmsymbol);virtual;abstract;
|
||||||
procedure writestabs(offset:aint;p:pchar;nidx,nother,line:longint;reloc:boolean);virtual;abstract;
|
procedure writestab(offset:aint;ps:tasmsymbol;nidx,nother,line:longint;p:pchar);virtual;abstract;
|
||||||
procedure writesymstabs(offset:aint;p:pchar;ps:tasmsymbol;nidx,nother,line:longint;reloc:boolean);virtual;abstract;
|
|
||||||
procedure beforealloc;virtual;
|
procedure beforealloc;virtual;
|
||||||
procedure beforewrite;virtual;
|
procedure beforewrite;virtual;
|
||||||
procedure afteralloc;virtual;
|
procedure afteralloc;virtual;
|
||||||
@ -575,6 +575,7 @@ implementation
|
|||||||
'code','data','rodata','bss','threadvar',
|
'code','data','rodata','bss','threadvar',
|
||||||
'common',
|
'common',
|
||||||
'note',
|
'note',
|
||||||
|
'text',
|
||||||
'stab','stabstr',
|
'stab','stabstr',
|
||||||
'idata2','idata4','idata5','idata6','idata7','edata',
|
'idata2','idata4','idata5','idata6','idata7','edata',
|
||||||
'eh_frame',
|
'eh_frame',
|
||||||
|
@ -50,6 +50,7 @@ interface
|
|||||||
ait_datablock,
|
ait_datablock,
|
||||||
ait_symbol,
|
ait_symbol,
|
||||||
ait_symbol_end, { needed to calc the size of a symbol }
|
ait_symbol_end, { needed to calc the size of a symbol }
|
||||||
|
ait_directive,
|
||||||
ait_label,
|
ait_label,
|
||||||
{ the const_xx must be below each other so it can be used as
|
{ the const_xx must be below each other so it can be used as
|
||||||
array index }
|
array index }
|
||||||
@ -87,9 +88,7 @@ interface
|
|||||||
ait_regalloc,
|
ait_regalloc,
|
||||||
ait_tempalloc,
|
ait_tempalloc,
|
||||||
{ used to mark assembler blocks and inlined functions }
|
{ used to mark assembler blocks and inlined functions }
|
||||||
ait_marker,
|
ait_marker
|
||||||
{ special symbol for darwin pic code }
|
|
||||||
ait_non_lazy_symbol_pointer
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -111,6 +110,7 @@ interface
|
|||||||
'datablock',
|
'datablock',
|
||||||
'symbol',
|
'symbol',
|
||||||
'symbol_end',
|
'symbol_end',
|
||||||
|
'symbol_directive',
|
||||||
'label',
|
'label',
|
||||||
'const_128bit',
|
'const_128bit',
|
||||||
'const_64bit',
|
'const_64bit',
|
||||||
@ -144,8 +144,7 @@ interface
|
|||||||
'cut',
|
'cut',
|
||||||
'regalloc',
|
'regalloc',
|
||||||
'tempalloc',
|
'tempalloc',
|
||||||
'marker',
|
'marker'
|
||||||
'non_lazy_symbol_pointer'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -158,7 +157,7 @@ interface
|
|||||||
{$endif arm}
|
{$endif arm}
|
||||||
{$ifdef m68k}
|
{$ifdef m68k}
|
||||||
{ m68k only }
|
{ m68k only }
|
||||||
,top_reglist
|
,top_regset
|
||||||
{$endif m68k}
|
{$endif m68k}
|
||||||
{ i386 only});
|
{ i386 only});
|
||||||
|
|
||||||
@ -204,7 +203,7 @@ interface
|
|||||||
const
|
const
|
||||||
SkipInstr = [ait_comment, ait_symbol,ait_section
|
SkipInstr = [ait_comment, ait_symbol,ait_section
|
||||||
,ait_stab, ait_function_name, ait_force_line
|
,ait_stab, ait_function_name, ait_force_line
|
||||||
,ait_regalloc, ait_tempalloc, ait_symbol_end];
|
,ait_regalloc, ait_tempalloc, ait_symbol_end, ait_directive];
|
||||||
|
|
||||||
{ ait_* types which do not have line information (and hence which are of type
|
{ ait_* types which do not have line information (and hence which are of type
|
||||||
tai, otherwise, they are of type tailineinfo }
|
tai, otherwise, they are of type tailineinfo }
|
||||||
@ -215,8 +214,7 @@ interface
|
|||||||
ait_const_8bit,ait_const_16bit,ait_const_32bit,ait_const_64bit,ait_const_128bit,
|
ait_const_8bit,ait_const_16bit,ait_const_32bit,ait_const_64bit,ait_const_128bit,
|
||||||
ait_const_sleb128bit,ait_const_uleb128bit,
|
ait_const_sleb128bit,ait_const_uleb128bit,
|
||||||
ait_const_rva_symbol,ait_const_indirect_symbol,
|
ait_const_rva_symbol,ait_const_indirect_symbol,
|
||||||
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_real_128bit,
|
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_real_128bit
|
||||||
ait_non_lazy_symbol_pointer
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -303,6 +301,18 @@ interface
|
|||||||
procedure derefimpl;override;
|
procedure derefimpl;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
tasmdirective=(asd_non_lazy_symbol_pointer,asd_indirect_symbol,asd_lazy_symbol_pointer,
|
||||||
|
asd_extern,asd_nasm_import);
|
||||||
|
|
||||||
|
tai_directive = class(tailineinfo)
|
||||||
|
name : pstring;
|
||||||
|
directive : tasmdirective;
|
||||||
|
constructor Create(_directive:tasmdirective;const _name:string);
|
||||||
|
destructor Destroy;override;
|
||||||
|
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
|
||||||
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Generates an assembler label }
|
{ Generates an assembler label }
|
||||||
tai_label = class(tai)
|
tai_label = class(tai)
|
||||||
is_global : boolean;
|
is_global : boolean;
|
||||||
@ -624,6 +634,10 @@ interface
|
|||||||
regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized');
|
regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized');
|
||||||
tempallocstr : array[boolean] of string[10]=('released','allocated');
|
tempallocstr : array[boolean] of string[10]=('released','allocated');
|
||||||
stabtypestr : array[tstabtype] of string[5]=('stabs','stabn','stabd');
|
stabtypestr : array[tstabtype] of string[5]=('stabs','stabn','stabd');
|
||||||
|
directivestr : array[tasmdirective] of string[24]=(
|
||||||
|
'non_lazy_symbol_pointer','indirect_symbol','lazy_symbol_pointer',
|
||||||
|
'extern','nasm_import'
|
||||||
|
);
|
||||||
|
|
||||||
var
|
var
|
||||||
{ array with all class types for tais }
|
{ array with all class types for tais }
|
||||||
@ -1040,6 +1054,41 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{****************************************************************************
|
||||||
|
TAI_SYMBOL_END
|
||||||
|
****************************************************************************}
|
||||||
|
|
||||||
|
constructor tai_directive.Create(_directive:tasmdirective;const _name:string);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
typ:=ait_directive;
|
||||||
|
name:=stringdup(_name);
|
||||||
|
directive:=_directive;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor tai_directive.Destroy;
|
||||||
|
begin
|
||||||
|
stringdispose(name);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
constructor tai_directive.ppuload(t:taitype;ppufile:tcompilerppufile);
|
||||||
|
begin
|
||||||
|
inherited ppuload(t,ppufile);
|
||||||
|
name:=stringdup(ppufile.getstring);
|
||||||
|
directive:=tasmdirective(ppufile.getbyte);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tai_directive.ppuwrite(ppufile:tcompilerppufile);
|
||||||
|
begin
|
||||||
|
inherited ppuwrite(ppufile);
|
||||||
|
ppufile.putstring(name^);
|
||||||
|
ppufile.putbyte(byte(directive));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TAI_CONST
|
TAI_CONST
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
@ -197,6 +197,7 @@ implementation
|
|||||||
'.text','.data','.data','.bss','.threadvar',
|
'.text','.data','.data','.bss','.threadvar',
|
||||||
'common',
|
'common',
|
||||||
'.note',
|
'.note',
|
||||||
|
'__TEXT', { stubs }
|
||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
@ -218,14 +219,27 @@ implementation
|
|||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
case target_info.system of
|
case target_info.system of
|
||||||
system_powerpc_darwin, system_i386_OS2, system_i386_EMX: ;
|
system_i386_OS2,
|
||||||
|
system_i386_EMX : ;
|
||||||
|
system_powerpc_darwin :
|
||||||
|
begin
|
||||||
|
if atype=sec_stub then
|
||||||
|
AsmWrite('.section ');
|
||||||
|
end;
|
||||||
else
|
else
|
||||||
AsmWrite('.section ');
|
AsmWrite('.section ');
|
||||||
end;
|
end;
|
||||||
s:=sectionname(atype,aname);
|
s:=sectionname(atype,aname);
|
||||||
AsmWrite(s);
|
AsmWrite(s);
|
||||||
if atype=sec_fpc then
|
case atype of
|
||||||
|
sec_fpc :
|
||||||
AsmWrite(', "a", @progbits');
|
AsmWrite(', "a", @progbits');
|
||||||
|
sec_stub :
|
||||||
|
begin
|
||||||
|
if target_info.system=system_powerpc_darwin then
|
||||||
|
AsmWrite(',__symbol_stub1,symbol_stubs,pure_instructions,16');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
AsmLn;
|
AsmLn;
|
||||||
CurrSecType:=atype;
|
CurrSecType:=atype;
|
||||||
end;
|
end;
|
||||||
@ -753,8 +767,13 @@ implementation
|
|||||||
else if tai_marker(hp).kind=InlineEnd then
|
else if tai_marker(hp).kind=InlineEnd then
|
||||||
dec(InlineLevel);
|
dec(InlineLevel);
|
||||||
|
|
||||||
ait_non_lazy_symbol_pointer:
|
ait_directive :
|
||||||
AsmWriteLn('.non_lazy_symbol_pointer');
|
begin
|
||||||
|
AsmWrite('.'+directivestr[tai_directive(hp).directive]+' ');
|
||||||
|
if assigned(tai_directive(hp).name) then
|
||||||
|
AsmWrite(tai_directive(hp).name^);
|
||||||
|
AsmLn;
|
||||||
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
internalerror(10000);
|
internalerror(10000);
|
||||||
|
@ -877,7 +877,7 @@ Unit AoptObj;
|
|||||||
{$define rangewason}
|
{$define rangewason}
|
||||||
{$r-}
|
{$r-}
|
||||||
{$endif}
|
{$endif}
|
||||||
function tAOptObj.getjumplabelwithsym(sym: tasmlabel): tai;
|
function tAOptObj.getlabelwithsym(sym: tasmlabel): tai;
|
||||||
begin
|
begin
|
||||||
if (sym.labelnr >= labelinfo^.lowlabel) and
|
if (sym.labelnr >= labelinfo^.lowlabel) and
|
||||||
(sym.labelnr <= labelinfo^.highlabel) then { range check, a jump can go past an assembler block! }
|
(sym.labelnr <= labelinfo^.highlabel) then { range check, a jump can go past an assembler block! }
|
||||||
|
@ -806,6 +806,8 @@ Implementation
|
|||||||
result:=true;
|
result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
const
|
||||||
|
N_Function = $24; { function or const }
|
||||||
var
|
var
|
||||||
ofs,
|
ofs,
|
||||||
nline,
|
nline,
|
||||||
@ -862,15 +864,10 @@ Implementation
|
|||||||
ofs:=0;
|
ofs:=0;
|
||||||
relocsym:=nil;
|
relocsym:=nil;
|
||||||
end;
|
end;
|
||||||
{ External references (AB_EXTERNAL and AB_COMMON) need a symbol relocation }
|
if (nidx=N_Function) and
|
||||||
if assigned(relocsym) then
|
target_info.use_function_relative_addresses then
|
||||||
begin
|
ofs:=0;
|
||||||
objectdata.writesymbol(relocsym);
|
objectdata.writestab(ofs,relocsym,nidx,nother,nline,pstr);
|
||||||
objectoutput.exportsymbol(relocsym);
|
|
||||||
objectdata.writeSymStabs(ofs,pstr,relocsym,nidx,nother,nline,true);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
objectdata.writeStabs(ofs,pstr,nidx,nother,nline,false);
|
|
||||||
end;
|
end;
|
||||||
if assigned(pendquote) then
|
if assigned(pendquote) then
|
||||||
pendquote^:='"';
|
pendquote^:='"';
|
||||||
|
@ -107,4 +107,14 @@ implementation
|
|||||||
CDebugInfo[t]:=c;
|
CDebugInfo[t]:=c;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
const
|
||||||
|
dbg_none_info : tdbginfo =
|
||||||
|
(
|
||||||
|
id : dbg_none;
|
||||||
|
idtxt : 'NONE';
|
||||||
|
);
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterDebugInfo(dbg_none_info,tdebuginfo);
|
||||||
end.
|
end.
|
||||||
|
@ -358,6 +358,7 @@ interface
|
|||||||
'.text','.data','.rodata','.bss','.tbss',
|
'.text','.data','.rodata','.bss','.tbss',
|
||||||
'common',
|
'common',
|
||||||
'.note',
|
'.note',
|
||||||
|
'.text',
|
||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
@ -380,9 +381,6 @@ interface
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure T386NasmAssembler.WriteTree(p:taasmoutput);
|
procedure T386NasmAssembler.WriteTree(p:taasmoutput);
|
||||||
const
|
|
||||||
regallocstr : array[tregalloctype] of string[10]=(' allocated',' released',' sync',' resized');
|
|
||||||
tempallocstr : array[boolean] of string[10]=(' released',' allocated');
|
|
||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
hp : tai;
|
hp : tai;
|
||||||
@ -747,6 +745,21 @@ interface
|
|||||||
else if tai_marker(hp).kind=InlineEnd then
|
else if tai_marker(hp).kind=InlineEnd then
|
||||||
dec(InlineLevel);
|
dec(InlineLevel);
|
||||||
|
|
||||||
|
ait_directive :
|
||||||
|
begin
|
||||||
|
case tai_directive(hp).directive of
|
||||||
|
asd_nasm_import :
|
||||||
|
AsmWrite('import ');
|
||||||
|
asd_extern :
|
||||||
|
AsmWrite('EXTERN ');
|
||||||
|
else
|
||||||
|
internalerror(200509191);
|
||||||
|
end;
|
||||||
|
if assigned(tai_directive(hp).name) then
|
||||||
|
AsmWrite(tai_directive(hp).name^);
|
||||||
|
AsmLn;
|
||||||
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
internalerror(10000);
|
internalerror(10000);
|
||||||
end;
|
end;
|
||||||
|
@ -70,8 +70,7 @@ interface
|
|||||||
function sectionname(atype:tasmsectiontype;const aname:string):string;override;
|
function sectionname(atype:tasmsectiontype;const aname:string):string;override;
|
||||||
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);override;
|
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);override;
|
||||||
procedure writesymbol(p:tasmsymbol);override;
|
procedure writesymbol(p:tasmsymbol);override;
|
||||||
procedure writestabs(offset:aint;p:pchar;nidx,nother,line:longint;reloc:boolean);override;
|
procedure writestab(offset:aint;ps:tasmsymbol;nidx,nother,line:longint;p:pchar);override;
|
||||||
procedure writesymstabs(offset:aint;p:pchar;ps:tasmsymbol;nidx,nother,line:longint;reloc:boolean);override;
|
|
||||||
procedure beforealloc;override;
|
procedure beforealloc;override;
|
||||||
procedure beforewrite;override;
|
procedure beforewrite;override;
|
||||||
procedure afteralloc;override;
|
procedure afteralloc;override;
|
||||||
@ -557,6 +556,7 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
'.text','.data','.data','.bss','.threadvar',
|
'.text','.data','.data','.bss','.threadvar',
|
||||||
'common',
|
'common',
|
||||||
'.note',
|
'.note',
|
||||||
|
'.text',
|
||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
@ -660,74 +660,14 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcoffobjectdata.writestabs(offset:aint;p:pchar;nidx,nother,line:longint;reloc : boolean);
|
procedure tcoffobjectdata.writestab(offset:aint;ps:tasmsymbol;nidx,nother,line:longint;p:pchar);
|
||||||
var
|
var
|
||||||
stab : coffstab;
|
stab : coffstab;
|
||||||
curraddr : longint;
|
curraddr : longint;
|
||||||
begin
|
begin
|
||||||
{ local var can be at offset -1 !! PM }
|
{ Win32 does not need an offset if a symbol is provided }
|
||||||
if reloc then
|
if win32 and assigned(ps) then
|
||||||
begin
|
|
||||||
if (offset=-1) then
|
|
||||||
begin
|
|
||||||
if currsec=nil then
|
|
||||||
offset:=0
|
|
||||||
else
|
|
||||||
offset:=currsec.datasize;
|
|
||||||
end;
|
|
||||||
if (currsec<>nil) then
|
|
||||||
inc(offset,currsec.datapos);
|
|
||||||
end;
|
|
||||||
if assigned(p) and (p[0]<>#0) then
|
|
||||||
begin
|
|
||||||
stab.strpos:=stabstrsec.datasize;
|
|
||||||
stabstrsec.write(p^,strlen(p)+1);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
stab.strpos:=0;
|
|
||||||
stab.ntype:=nidx;
|
|
||||||
stab.ndesc:=line;
|
|
||||||
stab.nother:=nother;
|
|
||||||
stab.nvalue:=offset;
|
|
||||||
StabsSec.write(stab,sizeof(stab));
|
|
||||||
{ when the offset is not 0 then write a relocation, take also the
|
|
||||||
hdrstab into account with the offset }
|
|
||||||
if reloc then
|
|
||||||
begin
|
|
||||||
{ current address }
|
|
||||||
curraddr:=StabsSec.mempos+StabsSec.datasize;
|
|
||||||
if DLLSource and RelocSection then
|
|
||||||
{ avoid relocation in the .stab section
|
|
||||||
because it ends up in the .reloc section instead }
|
|
||||||
StabsSec.addsectionreloc(curraddr-4,currsec,RELOC_RVA)
|
|
||||||
else
|
|
||||||
StabsSec.addsectionreloc(curraddr-4,currsec,RELOC_ABSOLUTE);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tcoffobjectdata.writesymstabs(offset:aint;p:pchar;ps:tasmsymbol;nidx,nother,line:longint;reloc:boolean);
|
|
||||||
var
|
|
||||||
stab : coffstab;
|
|
||||||
curraddr : longint;
|
|
||||||
begin
|
|
||||||
{ do not use the size stored in offset field
|
|
||||||
this is DJGPP specific ! PM }
|
|
||||||
if win32 then
|
|
||||||
offset:=0;
|
offset:=0;
|
||||||
{ local var can be at offset -1 !! PM }
|
|
||||||
if reloc then
|
|
||||||
begin
|
|
||||||
if (offset=-1) then
|
|
||||||
begin
|
|
||||||
if currsec=nil then
|
|
||||||
offset:=0
|
|
||||||
else
|
|
||||||
offset:=currsec.datasize;
|
|
||||||
end;
|
|
||||||
if (currsec<>nil) then
|
|
||||||
inc(offset,currsec.mempos);
|
|
||||||
end;
|
|
||||||
if assigned(p) and (p[0]<>#0) then
|
if assigned(p) and (p[0]<>#0) then
|
||||||
begin
|
begin
|
||||||
stab.strpos:=StabStrSec.datasize;
|
stab.strpos:=StabStrSec.datasize;
|
||||||
@ -740,9 +680,7 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
stab.nother:=nother;
|
stab.nother:=nother;
|
||||||
stab.nvalue:=offset;
|
stab.nvalue:=offset;
|
||||||
StabsSec.write(stab,sizeof(stab));
|
StabsSec.write(stab,sizeof(stab));
|
||||||
{ when the offset is not 0 then write a relocation, take also the
|
if assigned(ps) then
|
||||||
hdrstab into account with the offset }
|
|
||||||
if reloc then
|
|
||||||
begin
|
begin
|
||||||
{ current address }
|
{ current address }
|
||||||
curraddr:=StabsSec.mempos+StabsSec.datasize;
|
curraddr:=StabsSec.mempos+StabsSec.datasize;
|
||||||
@ -786,7 +724,7 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
{ create stabs sections if debugging }
|
{ create stabs sections if debugging }
|
||||||
if (cs_debuginfo in aktmoduleswitches) then
|
if (cs_debuginfo in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
writestabs(0,nil,0,0,0,false);
|
writestab(0,nil,0,0,0,nil);
|
||||||
{ write zero pchar and name together (PM) }
|
{ write zero pchar and name together (PM) }
|
||||||
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
||||||
stabstrsec.write(s[1],length(s));
|
stabstrsec.write(s[1],length(s));
|
||||||
@ -1077,7 +1015,7 @@ const go32v2stub : array[0..2047] of byte=(
|
|||||||
if StabsSec<>nil then
|
if StabsSec<>nil then
|
||||||
begin
|
begin
|
||||||
{ first stabs for main source }
|
{ first stabs for main source }
|
||||||
writestabs(0,nil,0,0,0,false);
|
writestab(0,nil,0,0,0,nil);
|
||||||
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
||||||
stabstrsec.write(s[1],length(s));
|
stabstrsec.write(s[1],length(s));
|
||||||
{ header stab }
|
{ header stab }
|
||||||
|
@ -72,8 +72,7 @@ interface
|
|||||||
function sectionname(atype:tasmsectiontype;const aname:string):string;override;
|
function sectionname(atype:tasmsectiontype;const aname:string):string;override;
|
||||||
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);override;
|
procedure writereloc(data,len:aint;p:tasmsymbol;relative:TAsmRelocationType);override;
|
||||||
procedure writesymbol(p:tasmsymbol);override;
|
procedure writesymbol(p:tasmsymbol);override;
|
||||||
procedure writestabs(offset:aint;p:pchar;nidx,nother,line:longint;reloc:boolean);override;
|
procedure writestab(offset:aint;ps:tasmsymbol;nidx,nother,line:longint;p:pchar);override;
|
||||||
procedure writesymstabs(offset:aint;p:pchar;ps:tasmsymbol;nidx,nother,line:longint;reloc:boolean);override;
|
|
||||||
procedure beforealloc;override;
|
procedure beforealloc;override;
|
||||||
procedure beforewrite;override;
|
procedure beforewrite;override;
|
||||||
end;
|
end;
|
||||||
@ -355,6 +354,7 @@ implementation
|
|||||||
{$endif userodata}
|
{$endif userodata}
|
||||||
'common',
|
'common',
|
||||||
'.note',
|
'.note',
|
||||||
|
'.text', { darwin stubs }
|
||||||
'.stab','.stabstr',
|
'.stab','.stabstr',
|
||||||
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
'.eh_frame',
|
'.eh_frame',
|
||||||
@ -429,20 +429,10 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure telf32objectdata.writestabs(offset:aint;p:pchar;nidx,nother,line:longint;reloc : boolean);
|
procedure telf32objectdata.writestab(offset:aint;ps:tasmsymbol;nidx,nother,line:longint;p:pchar);
|
||||||
var
|
var
|
||||||
stab : telf32stab;
|
stab : telf32stab;
|
||||||
begin
|
begin
|
||||||
if reloc then
|
|
||||||
begin
|
|
||||||
if (offset=-1) then
|
|
||||||
begin
|
|
||||||
if currsec=nil then
|
|
||||||
offset:=0
|
|
||||||
else
|
|
||||||
offset:=currsec.datasize;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
fillchar(stab,sizeof(telf32stab),0);
|
fillchar(stab,sizeof(telf32stab),0);
|
||||||
if assigned(p) and (p[0]<>#0) then
|
if assigned(p) and (p[0]<>#0) then
|
||||||
begin
|
begin
|
||||||
@ -454,31 +444,7 @@ implementation
|
|||||||
stab.nother:=nother;
|
stab.nother:=nother;
|
||||||
stab.nvalue:=offset;
|
stab.nvalue:=offset;
|
||||||
stabssec.write(stab,sizeof(stab));
|
stabssec.write(stab,sizeof(stab));
|
||||||
{ when the offset is not 0 then write a relocation, take also the
|
if assigned(ps) then
|
||||||
hdrstab into account with the offset }
|
|
||||||
if reloc then
|
|
||||||
stabssec.addsectionreloc(stabssec.datasize-4,currsec,RELOC_ABSOLUTE);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure telf32objectdata.writesymstabs(offset:aint;p:pchar;ps:tasmsymbol;nidx,nother,line:longint;reloc:boolean);
|
|
||||||
var
|
|
||||||
stab : telf32stab;
|
|
||||||
begin
|
|
||||||
fillchar(stab,sizeof(telf32stab),0);
|
|
||||||
if assigned(p) and (p[0]<>#0) then
|
|
||||||
begin
|
|
||||||
stab.strpos:=stabstrsec.datasize;
|
|
||||||
stabstrsec.write(p^,strlen(p)+1);
|
|
||||||
end;
|
|
||||||
stab.ntype:=nidx;
|
|
||||||
stab.ndesc:=line;
|
|
||||||
stab.nother:=nother;
|
|
||||||
stab.nvalue:=0;
|
|
||||||
stabssec.write(stab,sizeof(stab));
|
|
||||||
{ when the offset is not 0 then write a relocation, take also the
|
|
||||||
hdrstab into account with the offset }
|
|
||||||
if reloc then
|
|
||||||
stabssec.addsymreloc(stabssec.datasize-4,ps,RELOC_ABSOLUTE);
|
stabssec.addsymreloc(stabssec.datasize-4,ps,RELOC_ABSOLUTE);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -501,7 +467,7 @@ implementation
|
|||||||
{ create stabs sections if debugging }
|
{ create stabs sections if debugging }
|
||||||
if (cs_debuginfo in aktmoduleswitches) then
|
if (cs_debuginfo in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
writestabs(0,nil,0,0,0,false);
|
writestab(0,nil,0,0,0,nil);
|
||||||
{ write zero pchar and name together (PM) }
|
{ write zero pchar and name together (PM) }
|
||||||
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
s:=#0+SplitFileName(current_module.mainsource^)+#0;
|
||||||
stabstrsec.write(s[1],length(s));
|
stabstrsec.write(s[1],length(s));
|
||||||
|
@ -257,7 +257,7 @@ implementation
|
|||||||
{ PIC data }
|
{ PIC data }
|
||||||
{$ifdef powerpc}
|
{$ifdef powerpc}
|
||||||
if target_info.system=system_powerpc_darwin then
|
if target_info.system=system_powerpc_darwin then
|
||||||
asmlist[al_picdata].concat(tai_simple.create(ait_non_lazy_symbol_pointer));
|
asmlist[al_picdata].concat(tai_directive.create(asd_non_lazy_symbol_pointer,''));
|
||||||
{$endif powerpc}
|
{$endif powerpc}
|
||||||
|
|
||||||
{ Resource strings }
|
{ Resource strings }
|
||||||
|
@ -39,10 +39,6 @@ interface
|
|||||||
procedure WriteAsmList;override;
|
procedure WriteAsmList;override;
|
||||||
Function DoAssemble:boolean;override;
|
Function DoAssemble:boolean;override;
|
||||||
procedure WriteExternals;
|
procedure WriteExternals;
|
||||||
{$ifdef GDB}
|
|
||||||
procedure WriteFileLineInfo(var fileinfo : tfileposinfo);
|
|
||||||
procedure WriteFileEndInfo;
|
|
||||||
{$endif}
|
|
||||||
procedure WriteAsmFileHeader;
|
procedure WriteAsmFileHeader;
|
||||||
private
|
private
|
||||||
procedure WriteInstruction(hp : tai);
|
procedure WriteInstruction(hp : tai);
|
||||||
@ -77,20 +73,9 @@ interface
|
|||||||
'csect', {data}
|
'csect', {data}
|
||||||
'csect', {read only data}
|
'csect', {read only data}
|
||||||
'csect', {bss} 'csect',
|
'csect', {bss} 'csect',
|
||||||
'csect','csect','csect','csect','','','','','','','','',''
|
'csect','csect','csect','csect','','','','','','','','','',''
|
||||||
);
|
);
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
var
|
|
||||||
n_line : byte; { different types of source lines }
|
|
||||||
linecount,
|
|
||||||
includecount : longint;
|
|
||||||
funcname : pchar;
|
|
||||||
stabslastfileinfo : tfileposinfo;
|
|
||||||
isInFunction: Boolean;
|
|
||||||
firstLineInFunction: longint;
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
t64bitarray = array[0..7] of byte;
|
t64bitarray = array[0..7] of byte;
|
||||||
t32bitarray = array[0..3] of byte;
|
t32bitarray = array[0..3] of byte;
|
||||||
@ -559,7 +544,7 @@ var
|
|||||||
GetAdjacentTaiSymbol:= true;
|
GetAdjacentTaiSymbol:= true;
|
||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
ait_stab_function_name:
|
ait_function_name:
|
||||||
hp:=tai(hp.next);
|
hp:=tai(hp.next);
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -610,16 +595,6 @@ var
|
|||||||
AsmWrite(s);
|
AsmWrite(s);
|
||||||
AsmWriteLn('[PR]');
|
AsmWriteLn('[PR]');
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
if ((cs_debuginfo in aktmoduleswitches) or
|
|
||||||
(cs_gdb_lineinfo in aktglobalswitches)) then
|
|
||||||
begin
|
|
||||||
//info for debuggers:
|
|
||||||
firstLineInFunction:= stabslastfileinfo.line;
|
|
||||||
AsmWriteLn(#9'beginf ' + tostr(firstLineInFunction));
|
|
||||||
isInFunction:= true;
|
|
||||||
end;
|
|
||||||
{$endif}
|
|
||||||
{Write all labels: }
|
{Write all labels: }
|
||||||
hp:= first;
|
hp:= first;
|
||||||
repeat
|
repeat
|
||||||
@ -697,85 +672,6 @@ var
|
|||||||
(#9'dc.l'#9,#9'dc.w'#9,#9'dc.b'#9);
|
(#9'dc.l'#9,#9'dc.w'#9,#9'dc.b'#9);
|
||||||
|
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
procedure TPPCMPWAssembler.WriteFileLineInfo(var fileinfo : tfileposinfo);
|
|
||||||
var
|
|
||||||
curr_n : byte;
|
|
||||||
begin
|
|
||||||
if not ((cs_debuginfo in aktmoduleswitches) or
|
|
||||||
(cs_gdb_lineinfo in aktglobalswitches)) then
|
|
||||||
exit;
|
|
||||||
{ file changed ? (must be before line info) }
|
|
||||||
if (fileinfo.fileindex<>0) and
|
|
||||||
(stabslastfileinfo.fileindex<>fileinfo.fileindex) then
|
|
||||||
begin
|
|
||||||
infile:=current_module.sourcefiles.get_file(fileinfo.fileindex);
|
|
||||||
if assigned(infile) then
|
|
||||||
begin
|
|
||||||
(*
|
|
||||||
if includecount=0 then
|
|
||||||
curr_n:=n_sourcefile
|
|
||||||
else
|
|
||||||
curr_n:=n_includefile;
|
|
||||||
if (infile.path^<>'') then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(#9'.stabs "'+lower(BsToSlash(FixPath(infile.path^,false)))+'",'+
|
|
||||||
tostr(curr_n)+',0,0,'+target_asm.labelprefix+'text'+ToStr(IncludeCount));
|
|
||||||
end;
|
|
||||||
|
|
||||||
AsmWriteLn(#9'.stabs "'+lower(FixFileName(infile.name^))+'",'+
|
|
||||||
tostr(curr_n)+',0,0,'+target_asm.labelprefix+'text'+ToStr(IncludeCount));
|
|
||||||
*)
|
|
||||||
AsmWriteLn(#9'file '''+lower(FixFileName(infile.name^))+'''');
|
|
||||||
|
|
||||||
(*
|
|
||||||
AsmWriteLn(target_asm.labelprefix+'text'+ToStr(IncludeCount)+':');
|
|
||||||
*)
|
|
||||||
|
|
||||||
inc(includecount);
|
|
||||||
{ force new line info }
|
|
||||||
stabslastfileinfo.line:=-1;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{ line changed ? }
|
|
||||||
if (stabslastfileinfo.line<>fileinfo.line) and (fileinfo.line<>0) then
|
|
||||||
begin
|
|
||||||
(*
|
|
||||||
if (n_line=n_textline) and assigned(funcname) and
|
|
||||||
(target_info.use_function_relative_addresses) then
|
|
||||||
begin
|
|
||||||
AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
|
|
||||||
AsmWrite(#9'.stabn '+tostr(n_line)+',0,'+tostr(fileinfo.line)+','+
|
|
||||||
target_asm.labelprefix+'l'+tostr(linecount)+' - ');
|
|
||||||
AsmWritePChar(FuncName);
|
|
||||||
AsmLn;
|
|
||||||
inc(linecount);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(fileinfo.line));
|
|
||||||
*)
|
|
||||||
if isInFunction then
|
|
||||||
AsmWriteln(#9'line '+ tostr(fileinfo.line - firstLineInFunction + 1));
|
|
||||||
end;
|
|
||||||
stabslastfileinfo:=fileinfo;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TPPCMPWAssembler.WriteFileEndInfo;
|
|
||||||
|
|
||||||
begin
|
|
||||||
if not ((cs_debuginfo in aktmoduleswitches) or
|
|
||||||
(cs_gdb_lineinfo in aktglobalswitches)) then
|
|
||||||
exit;
|
|
||||||
AsmLn;
|
|
||||||
(*
|
|
||||||
AsmWriteLn(ait_section2str(sec_code));
|
|
||||||
AsmWriteLn(#9'.stabs "",'+tostr(n_sourcefile)+',0,0,'+target_asm.labelprefix+'etext');
|
|
||||||
AsmWriteLn(target_asm.labelprefix+'etext:');
|
|
||||||
*)
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
procedure TPPCMPWAssembler.WriteTree(p:TAAsmoutput);
|
procedure TPPCMPWAssembler.WriteTree(p:TAAsmoutput);
|
||||||
var
|
var
|
||||||
s,
|
s,
|
||||||
@ -813,13 +709,6 @@ var
|
|||||||
begin
|
begin
|
||||||
hp1 := hp as tailineinfo;
|
hp1 := hp as tailineinfo;
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
{ write debug info }
|
|
||||||
if (cs_debuginfo in aktmoduleswitches) or
|
|
||||||
(cs_gdb_lineinfo in aktglobalswitches) then
|
|
||||||
WriteFileLineInfo(hp1.fileinfo);
|
|
||||||
{$endif GDB}
|
|
||||||
|
|
||||||
if do_line then
|
if do_line then
|
||||||
begin
|
begin
|
||||||
{ load infile }
|
{ load infile }
|
||||||
@ -899,9 +788,6 @@ var
|
|||||||
|
|
||||||
AsmLn;
|
AsmLn;
|
||||||
AsmWriteLn(#9+secnames[tai_section(hp).sectype]+' '+cur_CSECT_name+cur_CSECT_class);
|
AsmWriteLn(#9+secnames[tai_section(hp).sectype]+' '+cur_CSECT_name+cur_CSECT_class);
|
||||||
{$ifdef GDB}
|
|
||||||
lastfileinfo.line:=-1;
|
|
||||||
{$endif GDB}
|
|
||||||
end;
|
end;
|
||||||
LasTSec:=tai_section(hp).sectype;
|
LasTSec:=tai_section(hp).sectype;
|
||||||
end;
|
end;
|
||||||
@ -1185,11 +1071,6 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
ait_direct:
|
|
||||||
begin
|
|
||||||
AsmWritePChar(tai_direct(hp).str);
|
|
||||||
AsmLn;
|
|
||||||
end;
|
|
||||||
ait_symbol:
|
ait_symbol:
|
||||||
begin
|
begin
|
||||||
if tai_symbol(hp).sym.typ=AT_FUNCTION then
|
if tai_symbol(hp).sym.typ=AT_FUNCTION then
|
||||||
@ -1208,16 +1089,6 @@ var
|
|||||||
InternalError(2003071301);
|
InternalError(2003071301);
|
||||||
end;
|
end;
|
||||||
ait_symbol_end:
|
ait_symbol_end:
|
||||||
{$ifdef GDB}
|
|
||||||
if isInFunction then
|
|
||||||
if ((cs_debuginfo in aktmoduleswitches) or
|
|
||||||
(cs_gdb_lineinfo in aktglobalswitches)) then
|
|
||||||
begin
|
|
||||||
//info for debuggers:
|
|
||||||
AsmWriteLn(#9'endf ' + tostr(stabslastfileinfo.line));
|
|
||||||
isInFunction:= false;
|
|
||||||
end
|
|
||||||
{$endif GDB}
|
|
||||||
;
|
;
|
||||||
ait_instruction:
|
ait_instruction:
|
||||||
WriteInstruction(hp);
|
WriteInstruction(hp);
|
||||||
@ -1374,12 +1245,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPPCMPWAssembler.WriteAsmList;
|
procedure TPPCMPWAssembler.WriteAsmList;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
var
|
var
|
||||||
fileinfo : tfileposinfo;
|
|
||||||
{$endif GDB}
|
|
||||||
hal : tasmlist;
|
hal : tasmlist;
|
||||||
begin
|
begin
|
||||||
{$ifdef EXTDEBUG}
|
{$ifdef EXTDEBUG}
|
||||||
@ -1387,24 +1253,6 @@ var
|
|||||||
comment(v_info,'Start writing MPW-styled assembler output for '+current_module.mainsource^);
|
comment(v_info,'Start writing MPW-styled assembler output for '+current_module.mainsource^);
|
||||||
{$endif}
|
{$endif}
|
||||||
LasTSec:=sec_none;
|
LasTSec:=sec_none;
|
||||||
{$ifdef GDB}
|
|
||||||
FillChar(stabslastfileinfo,sizeof(stabslastfileinfo),0);
|
|
||||||
{$endif GDB}
|
|
||||||
{$ifdef GDB}
|
|
||||||
//n_line:=n_bssline;
|
|
||||||
funcname:=nil;
|
|
||||||
linecount:=1;
|
|
||||||
includecount:=0;
|
|
||||||
fileinfo.fileindex:=1;
|
|
||||||
fileinfo.line:=1;
|
|
||||||
|
|
||||||
isInFunction:= false;
|
|
||||||
firstLineInFunction:= 0;
|
|
||||||
|
|
||||||
{ Write main file }
|
|
||||||
WriteFileLineInfo(fileinfo);
|
|
||||||
|
|
||||||
{$endif GDB}
|
|
||||||
|
|
||||||
WriteAsmFileHeader;
|
WriteAsmFileHeader;
|
||||||
WriteExternals;
|
WriteExternals;
|
||||||
@ -1416,10 +1264,6 @@ var
|
|||||||
AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]);
|
AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ifdef GDB}
|
|
||||||
WriteFileEndInfo;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
AsmWriteLn(#9'end');
|
AsmWriteLn(#9'end');
|
||||||
AsmLn;
|
AsmLn;
|
||||||
|
|
||||||
|
@ -369,14 +369,13 @@ const
|
|||||||
asmlist[al_imports]:=TAAsmoutput.create;
|
asmlist[al_imports]:=TAAsmoutput.create;
|
||||||
|
|
||||||
asmlist[al_imports].concat(Tai_section.Create(sec_data,'',0));
|
asmlist[al_imports].concat(Tai_section.Create(sec_data,'',0));
|
||||||
asmlist[al_imports].concat(Tai_direct.create(strpnew('.section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16')));
|
asmlist[al_imports].concat(Tai_section.create(sec_stub,'',0));
|
||||||
asmlist[al_imports].concat(Tai_align.Create(4));
|
asmlist[al_imports].concat(Tai_align.Create(4));
|
||||||
result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
|
result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION);
|
||||||
asmlist[al_imports].concat(Tai_symbol.Create(result,0));
|
asmlist[al_imports].concat(Tai_symbol.Create(result,0));
|
||||||
asmlist[al_imports].concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+s)));
|
asmlist[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
|
||||||
l1 := objectlibrary.newasmsymbol('L'+s+'$lazy_ptr',AB_EXTERNAL,AT_FUNCTION);
|
l1 := objectlibrary.newasmsymbol('L'+s+'$lazy_ptr',AB_EXTERNAL,AT_FUNCTION);
|
||||||
reference_reset_symbol(href,l1,0);
|
reference_reset_symbol(href,l1,0);
|
||||||
{$ifdef powerpc}
|
|
||||||
href.refaddr := addr_hi;
|
href.refaddr := addr_hi;
|
||||||
asmlist[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
|
asmlist[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href));
|
||||||
href.refaddr := addr_lo;
|
href.refaddr := addr_lo;
|
||||||
@ -384,13 +383,10 @@ const
|
|||||||
asmlist[al_imports].concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href));
|
asmlist[al_imports].concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href));
|
||||||
asmlist[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12));
|
asmlist[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12));
|
||||||
asmlist[al_imports].concat(taicpu.op_none(A_BCTR));
|
asmlist[al_imports].concat(taicpu.op_none(A_BCTR));
|
||||||
{$else powerpc}
|
|
||||||
internalerror(2004010502);
|
|
||||||
{$endif powerpc}
|
|
||||||
asmlist[al_imports].concat(Tai_section.Create(sec_data,'',0));
|
asmlist[al_imports].concat(Tai_section.Create(sec_data,'',0));
|
||||||
asmlist[al_imports].concat(Tai_direct.create(strpnew('.lazy_symbol_pointer')));
|
asmlist[al_imports].concat(tai_directive.create(asd_lazy_symbol_pointer,''));
|
||||||
asmlist[al_imports].concat(Tai_symbol.Create(l1,0));
|
asmlist[al_imports].concat(Tai_symbol.Create(l1,0));
|
||||||
asmlist[al_imports].concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+s)));
|
asmlist[al_imports].concat(tai_directive.create(asd_indirect_symbol,s));
|
||||||
asmlist[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
|
asmlist[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ implementation
|
|||||||
|
|
||||||
{$ifdef cpufpemu}
|
{$ifdef cpufpemu}
|
||||||
{ Normal types }
|
{ Normal types }
|
||||||
{ we use the same types as without emulator, the only
|
(* we use the same types as without emulator, the only
|
||||||
difference is that direct calls to the emulator are generated
|
difference is that direct calls to the emulator are generated
|
||||||
if (cs_fp_emulation in aktmoduleswitches) then
|
if (cs_fp_emulation in aktmoduleswitches) then
|
||||||
begin
|
begin
|
||||||
@ -135,7 +135,7 @@ implementation
|
|||||||
addtype('Extended',pbestrealtype^);
|
addtype('Extended',pbestrealtype^);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
}
|
*)
|
||||||
{$endif cpufpemu}
|
{$endif cpufpemu}
|
||||||
begin
|
begin
|
||||||
addtype('Single',s32floattype);
|
addtype('Single',s32floattype);
|
||||||
@ -510,6 +510,7 @@ implementation
|
|||||||
aiclass[ait_datablock]:=tai_datablock;
|
aiclass[ait_datablock]:=tai_datablock;
|
||||||
aiclass[ait_symbol]:=tai_symbol;
|
aiclass[ait_symbol]:=tai_symbol;
|
||||||
aiclass[ait_symbol_end]:=tai_symbol_end;
|
aiclass[ait_symbol_end]:=tai_symbol_end;
|
||||||
|
aiclass[ait_directive]:=tai_directive;
|
||||||
aiclass[ait_label]:=tai_label;
|
aiclass[ait_label]:=tai_label;
|
||||||
aiclass[ait_const_64bit]:=tai_const;
|
aiclass[ait_const_64bit]:=tai_const;
|
||||||
aiclass[ait_const_32bit]:=tai_const;
|
aiclass[ait_const_32bit]:=tai_const;
|
||||||
|
@ -848,7 +848,7 @@ Begin
|
|||||||
arraydef,
|
arraydef,
|
||||||
floatdef :
|
floatdef :
|
||||||
SetSize(tabstractvarsym(sym).getsize,false);
|
SetSize(tabstractvarsym(sym).getsize,false);
|
||||||
{ makes no sense when using sse instructions (FK)
|
(* makes no sense when using sse instructions (FK)
|
||||||
arraydef :
|
arraydef :
|
||||||
begin
|
begin
|
||||||
{ for arrays try to get the element size, take care of
|
{ for arrays try to get the element size, take care of
|
||||||
@ -859,7 +859,7 @@ Begin
|
|||||||
harrdef:=tarraydef(harrdef.elementtype.def);
|
harrdef:=tarraydef(harrdef.elementtype.def);
|
||||||
SetSize(harrdef.elesize,false);
|
SetSize(harrdef.elesize,false);
|
||||||
end;
|
end;
|
||||||
}
|
*)
|
||||||
end;
|
end;
|
||||||
hasvar:=true;
|
hasvar:=true;
|
||||||
SetupVar:=true;
|
SetupVar:=true;
|
||||||
|
@ -209,6 +209,7 @@ const
|
|||||||
{$ifdef powerpc}platform_select='-b elf32-powerpc -m elf32ppclinux';{$endif}
|
{$ifdef powerpc}platform_select='-b elf32-powerpc -m elf32ppclinux';{$endif}
|
||||||
{$ifdef sparc} platform_select='-b elf32-sparc -m elf32_sparc';{$endif}
|
{$ifdef sparc} platform_select='-b elf32-sparc -m elf32_sparc';{$endif}
|
||||||
{$ifdef arm} platform_select='';{$endif} {unknown :( }
|
{$ifdef arm} platform_select='';{$endif} {unknown :( }
|
||||||
|
{$ifdef m68k} platform_select='';{$endif} {unknown :( }
|
||||||
|
|
||||||
{$ifdef m68k}
|
{$ifdef m68k}
|
||||||
var
|
var
|
||||||
|
@ -241,14 +241,8 @@ implementation
|
|||||||
hp2:=twin32imported_item(hp1.imported_items.first);
|
hp2:=twin32imported_item(hp1.imported_items.first);
|
||||||
while assigned(hp2) do
|
while assigned(hp2) do
|
||||||
begin
|
begin
|
||||||
{$warning TODO nasm lib, tai_direct not supported}
|
asmlist[al_imports].concat(tai_directive.create(asd_extern,hp2.func^));
|
||||||
{if (aktoutputformat in [as_i386_tasm,as_i386_masm]) then
|
asmlist[al_imports].concat(tai_directive.create(asd_nasm_import,hp2.func^+' '+hp1.dllname^+' '+hp2.name^));
|
||||||
p:=strpnew(#9+'EXTRN '+hp2.func^)
|
|
||||||
else
|
|
||||||
p:=strpnew(#9+'EXTERN '+hp2.func^);
|
|
||||||
asmlist[al_imports].concat(tai_direct.create(p));
|
|
||||||
p:=strpnew(#9+'import '+hp2.func^+' '+hp1.dllname^+' '+hp2.name^);
|
|
||||||
asmlist[al_imports].concat(tai_direct.create(p));}
|
|
||||||
hp2:=twin32imported_item(hp2.next);
|
hp2:=twin32imported_item(hp2.next);
|
||||||
end;
|
end;
|
||||||
hp1:=timportlist(hp1.next);
|
hp1:=timportlist(hp1.next);
|
||||||
|
@ -60,13 +60,13 @@ implementation
|
|||||||
|
|
||||||
secnames : array[TAsmSectionType] of string[4] = ('',
|
secnames : array[TAsmSectionType] of string[4] = ('',
|
||||||
'CODE','DATA','DATA','BSS','',
|
'CODE','DATA','DATA','BSS','',
|
||||||
'','','','','','',
|
'','','','','','','',
|
||||||
'','','','','','',''
|
'','','','','','',''
|
||||||
);
|
);
|
||||||
|
|
||||||
secnamesml64 : array[TAsmSectionType] of string[7] = ('',
|
secnamesml64 : array[TAsmSectionType] of string[7] = ('',
|
||||||
'_TEXT','_DATE','_DATA','_BSS','',
|
'_TEXT','_DATE','_DATA','_BSS','',
|
||||||
'','','','',
|
'','','','','',
|
||||||
'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
|
'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
|
||||||
'','',''
|
'','',''
|
||||||
);
|
);
|
||||||
@ -787,6 +787,22 @@ implementation
|
|||||||
else if tai_marker(hp).kind=InlineEnd then
|
else if tai_marker(hp).kind=InlineEnd then
|
||||||
dec(InlineLevel);
|
dec(InlineLevel);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ait_directive :
|
||||||
|
begin
|
||||||
|
case tai_directive(hp).directive of
|
||||||
|
asd_nasm_import :
|
||||||
|
AsmWrite('import ');
|
||||||
|
asd_extern :
|
||||||
|
AsmWrite('EXTRN ');
|
||||||
|
else
|
||||||
|
internalerror(200509192);
|
||||||
|
end;
|
||||||
|
if assigned(tai_directive(hp).name) then
|
||||||
|
AsmWrite(tai_directive(hp).name^);
|
||||||
|
AsmLn;
|
||||||
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
internalerror(10000);
|
internalerror(10000);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user