* fixed library creating on x86_64-linux

git-svn-id: trunk@5828 -
This commit is contained in:
florian 2007-01-06 20:27:59 +00:00
parent 881fb4d392
commit db3f8575ae
3 changed files with 42 additions and 7 deletions

View File

@ -39,7 +39,14 @@ interface
type type
TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL); TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL); TAsmsymtype=(
AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL,
{
the address of this code label is taken somewhere in the code
so it must be taken care of it when creating pic
}
AT_ADDR
);
{ is the label only there for getting an DataOffset (e.g. for i/o { is the label only there for getting an DataOffset (e.g. for i/o
checks -> alt_addr) or is it a jump target (alt_jump), for debug checks -> alt_addr) or is it a jump target (alt_jump), for debug
@ -298,7 +305,10 @@ implementation
constructor TAsmLabel.Createlocal(AList:TFPHashObjectList;nr:longint;ltyp:TAsmLabelType); constructor TAsmLabel.Createlocal(AList:TFPHashObjectList;nr:longint;ltyp:TAsmLabelType);
begin begin
inherited Create(AList,target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_LABEL); if ltyp=alt_addr then
inherited Create(AList,target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_ADDR)
else
inherited Create(AList,target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_LABEL);
labelnr:=nr; labelnr:=nr;
labeltype:=ltyp; labeltype:=ltyp;
is_set:=false; is_set:=false;

View File

@ -584,9 +584,31 @@ implementation
'fpc', 'fpc',
'' ''
); );
secnames_pic : array[TAsmSectiontype] of string[17] = ('',
'.text',
'.data.rel',
'.data.rel',
'.bss',
'.threadvar',
'.pdata',
'', { stubs }
'.stab',
'.stabstr',
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
'.eh_frame',
'.debug_frame','.debug_info','.debug_line','.debug_abbrev',
'.fpc',
'.toc'
);
var var
sep : string[3]; sep : string[3];
secname : string;
begin begin
if (cs_create_pic in current_settings.moduleswitches) and
not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
secname:=secnames_pic[atype]
else
secname:=secnames[atype];
if (use_smartlink_section and if (use_smartlink_section and
(aname<>'')) or (atype=sec_fpc) then (aname<>'')) or (atype=sec_fpc) then
begin begin
@ -598,10 +620,10 @@ implementation
else else
sep:='.n_'; sep:='.n_';
end; end;
result:=secnames[atype]+sep+aname result:=secname+sep+aname
end end
else else
result:=secnames[atype]; result:=secname;
end; end;
@ -752,7 +774,10 @@ implementation
if assigned(objreloc.symbol) then if assigned(objreloc.symbol) then
begin begin
if objreloc.symbol.symidx=-1 then if objreloc.symbol.symidx=-1 then
internalerror(200603012); begin
writeln(objreloc.symbol.Name);
internalerror(200603012);
end;
relsym:=objreloc.symbol.symidx; relsym:=objreloc.symbol.symidx;
end end
else else

View File

@ -2249,7 +2249,7 @@ implementation
currsym:=objdata.symbolref(oper[opidx]^.ref^.symbol); currsym:=objdata.symbolref(oper[opidx]^.ref^.symbol);
{$ifdef x86_64} {$ifdef x86_64}
if oper[opidx]^.ref^.refaddr=addr_pic then if oper[opidx]^.ref^.refaddr=addr_pic then
currabsreloc:=RELOC_PLT32 currabsreloc:=RELOC_GOTPCREL
else else
{$endif x86_64} {$endif x86_64}
currabsreloc:=RELOC_ABSOLUTE; currabsreloc:=RELOC_ABSOLUTE;
@ -2267,7 +2267,7 @@ implementation
currsym:=objdata.symbolref(oper[opidx]^.ref^.symbol); currsym:=objdata.symbolref(oper[opidx]^.ref^.symbol);
{$ifdef x86_64} {$ifdef x86_64}
if oper[opidx]^.ref^.refaddr=addr_pic then if oper[opidx]^.ref^.refaddr=addr_pic then
currabsreloc:=RELOC_PLT32 currabsreloc:=RELOC_GOTPCREL
else else
{$endif x86_64} {$endif x86_64}
currabsreloc:=RELOC_ABSOLUTE32; currabsreloc:=RELOC_ABSOLUTE32;