* 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
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
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);
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;
labeltype:=ltyp;
is_set:=false;

View File

@ -584,9 +584,31 @@ implementation
'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
sep : string[3];
secname : string;
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
(aname<>'')) or (atype=sec_fpc) then
begin
@ -598,10 +620,10 @@ implementation
else
sep:='.n_';
end;
result:=secnames[atype]+sep+aname
result:=secname+sep+aname
end
else
result:=secnames[atype];
result:=secname;
end;
@ -752,7 +774,10 @@ implementation
if assigned(objreloc.symbol) then
begin
if objreloc.symbol.symidx=-1 then
internalerror(200603012);
begin
writeln(objreloc.symbol.Name);
internalerror(200603012);
end;
relsym:=objreloc.symbol.symidx;
end
else

View File

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