Browse Source

* 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

Jonas Maebe 21 years ago
parent
commit
e823822f49
3 changed files with 27 additions and 38 deletions
  1. 12 4
      compiler/pdecvar.pas
  2. 8 3
      compiler/powerpc/nppcld.pas
  3. 7 31
      compiler/systems/t_bsd.pas

+ 12 - 4
compiler/pdecvar.pas

@@ -988,9 +988,12 @@ implementation
                     include(vs.varoptions,vo_is_dll_var)
                     include(vs.varoptions,vo_is_dll_var)
                    else
                    else
                     include(vs.varoptions,vo_is_C_var);
                     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
                    if export_var then
                     begin
                     begin
                       inc(vs.refs);
                       inc(vs.refs);
@@ -1167,7 +1170,12 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $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
     * fixed wrong name mangling for imported variables under Darwin
 
 
   Revision 1.69  2004/03/04 17:24:42  peter
   Revision 1.69  2004/03/04 17:24:42  peter

+ 8 - 3
compiler/powerpc/nppcld.pas

@@ -68,8 +68,8 @@ unit nppcld;
                     end;
                     end;
 
 
                   reference_reset_symbol(ref,l,0);
                   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);
                   reference_reset_base(location.reference,cg.getaddressregister(exprasmlist),0);
                   cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,ref,location.reference.base);
                   cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,ref,location.reference.base);
                 end
                 end
@@ -87,7 +87,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $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
     * make cycle fixed
     + pic support for darwin
     + pic support for darwin
     + support of importing vars from shared libs on darwin implemented
     + support of importing vars from shared libs on darwin implemented

+ 7 - 31
compiler/systems/t_bsd.pas

@@ -55,7 +55,6 @@ implementation
       procedure generatesmartlib;override;
       procedure generatesmartlib;override;
      private
      private
       procedure darwinimportproc(aprocdef:tprocdef;const func,module : string;index : longint;const name : string);
       procedure darwinimportproc(aprocdef:tprocdef;const func,module : string;index : longint;const name : string);
-      procedure importvariable_str(const s:string;const name,module:string);
     end;
     end;
 
 
     timportlibbsd=class(timportlib)
     timportlibbsd=class(timportlib)
@@ -149,26 +148,7 @@ implementation
 
 
     procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
     procedure timportlibdarwin.importvariable(vs:tvarsym;const name,module:string);
       begin
       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;
       end;
 
 
 
 
@@ -256,15 +236,6 @@ implementation
                       importsSection.concat(Tai_symbol.Create(l1,0));
                       importsSection.concat(Tai_symbol.Create(l1,0));
                       importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+symname)));
                       importsSection.concat(Tai_direct.create(strpnew((#9+'.indirect_symbol ')+symname)));
                       importsSection.concat(tai_const_symbol.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0));
                       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;
                     end;
                    hp2:=tdarwinimported_item(hp2.next);
                    hp2:=tdarwinimported_item(hp2.next);
                 end;
                 end;
@@ -760,7 +731,12 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $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*
     * big transformation of Tai_[const_]Symbol.Create[data]name*
 
 
   Revision 1.10  2004/02/27 10:21:05  florian
   Revision 1.10  2004/02/27 10:21:05  florian