* fixed importing of variables from shared libraries, but disabled

PIC support for now. You have to save/restore r31 when you us it! :)
    Also, it's not necessary to support the imported variables
This commit is contained in:
Jonas Maebe 2004-03-05 22:17:11 +00:00
parent 61e09d9dea
commit e823822f49
3 changed files with 27 additions and 38 deletions

View File

@ -988,9 +988,12 @@ implementation
include(vs.varoptions,vo_is_dll_var)
else
include(vs.varoptions,vo_is_C_var);
if (not is_dll) or
(target_info.system <> system_powerpc_darwin) then
vs.set_mangledname(C_Name);
if (is_dll) and
(target_info.system = system_powerpc_darwin) then
C_Name := target_info.Cprefix+C_Name;
vs.set_mangledname(C_Name);
if export_var then
begin
inc(vs.refs);
@ -1167,7 +1170,12 @@ implementation
end.
{
$Log$
Revision 1.70 2004-03-05 21:13:22 jonas
Revision 1.71 2004-03-05 22:17:11 jonas
* fixed importing of variables from shared libraries, but disabled
PIC support for now. You have to save/restore r31 when you us it! :)
Also, it's not necessary to support the imported variables
Revision 1.70 2004/03/05 21:13:22 jonas
* fixed wrong name mangling for imported variables under Darwin
Revision 1.69 2004/03/04 17:24:42 peter

View File

@ -68,8 +68,8 @@ unit nppcld;
end;
reference_reset_symbol(ref,l,0);
ref.base:=current_procinfo.got;
ref.relsymbol:=current_procinfo.gotlabel;
{ ref.base:=current_procinfo.got;
ref.relsymbol:=current_procinfo.gotlabel;}
reference_reset_base(location.reference,cg.getaddressregister(exprasmlist),0);
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,ref,location.reference.base);
end
@ -87,7 +87,12 @@ begin
end.
{
$Log$
Revision 1.1 2004-03-02 17:32:12 florian
Revision 1.2 2004-03-05 22:17:11 jonas
* fixed importing of variables from shared libraries, but disabled
PIC support for now. You have to save/restore r31 when you us it! :)
Also, it's not necessary to support the imported variables
Revision 1.1 2004/03/02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented

View File

@ -55,7 +55,6 @@ implementation
procedure generatesmartlib;override;
private
procedure darwinimportproc(aprocdef:tprocdef;const func,module : string;index : longint;const name : string);
procedure importvariable_str(const s:string;const name,module:string);
end;
timportlibbsd=class(timportlib)
@ -149,26 +148,7 @@ implementation
procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
begin
importvariable_str(vs.mangledname,name,module);
end;
procedure timportlibdarwin.importvariable_str(const s:string;const name,module:string);
var
hp1 : timportlist;
hp2 : tdarwinimported_item;
begin
{ search for the module }
hp1:=timportlist(current_module.imports.first);
{ generate a new item ? }
if not(assigned(hp1)) then
begin
hp1:=timportlist.create('imports');
current_module.imports.concat(hp1);
end;
hp2:=tdarwinimported_item.create_var(s,name);
hp2.procdef:=nil;
hp1.imported_items.concat(hp2);
{ this is handled in the nppcld.pas tppcloadnode }
end;
@ -256,15 +236,6 @@ implementation
importsSection.concat(Tai_symbol.Create(l1,0));
importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+symname)));
importsSection.concat(tai_const_symbol.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
end
else
begin
importsSection.concat(Tai_section.Create(sec_data));
importsSection.concat(Tai_direct.create(strpnew('.non_lazy_symbol_pointer')));
importsSection.concat(Tai_symbol.Createname(hp2.func^,AT_FUNCTION,0));
importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+hp2.name^)));
importsSection.concat(Tai_const.create_32bit(0));
end;
hp2:=tdarwinimported_item(hp2.next);
end;
@ -760,7 +731,12 @@ initialization
end.
{
$Log$
Revision 1.11 2004-03-02 00:36:33 olle
Revision 1.12 2004-03-05 22:17:11 jonas
* fixed importing of variables from shared libraries, but disabled
PIC support for now. You have to save/restore r31 when you us it! :)
Also, it's not necessary to support the imported variables
Revision 1.11 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.10 2004/02/27 10:21:05 florian