This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linker for OOP


My request is simple.  Allowing the following expression provides
great benefits for OO languages.

SubClassMVIndex_y EQU RootClassMVIndex_MAX .PLUS 4 ; => 8

So, global symbol `SubClassMVIndex_y' is assembled into object file
as expression as is, and which is resoved in link phase to 8.

---
Mikiya Matsuzaka

************************************************************************
====================================
------- FILE1.m -------
RootClass
{
   Class*   isa;

   classMethod_1
   instanceMethod_1
   instanceMethod_2
}
-----------------------
         ||
         \/

;; MV for Member Variable, CM for ClassMethod, IM for InstanceMethod
RootClassMVIndex_isa  EQU     0     ; => 0
RootClassMVIndex_MAX  EQU     4     ; => 4

RootClassCMIndex_1    EQU     0     ; => 0
RootClassCMIndex_MAX  EQU     4     ; => 4

RootClassIMIndex_1    EQU     0     ; => 0
RootClassIMIndex_2    EQU     4     ; => 4
RootClassIMIndex_MAX  EQU     8     ; => 8

====================================

------- FILE2.m -------
SubClass: RootClass
{
   int  x, y;

   classMethod_2
   instanceMethod_1
   instanceMethod_3
   instanceMethod_4
}
-----------------------
         ||
         \/

;; MV for Member Variable, CM for ClassMethod, IM for InstanceMethod
SubClassMVIndex_x    EQU    RootClassMVIndex_MAX .PLUS 0    ; => 4
SubClassMVIndex_y    EQU    RootClassMVIndex_MAX .PLUS 4    ; => 8
SubClassMVIndex_MAX  EQU    RootClassMVIndex_MAX .PLUS 8    ; => 12

SubClassCMIndex_2    EQU    RootClassCMIndex_1 .PLUS 0      ; => 4
SubClassCMIndex_MAX  EQU    RootClassCMIndex_1 .PLUS 4      ; => 8

SubClassIMIndex_1 EQU RootClassIMIndex_1 ; => 0

SubClassIMIndex_3    EQU    RootClassIMIndex_MAX .PLUS 0    ; => 8
SubClassIMIndex_4    EQU    RootClassIMIndex_MAX .PLUS 4    ; => 12
SubClassIMIndex_MAX  EQU    RootClassIMIndex_MAX .PLUS 8    ; => 16

====================================
************************************************************************
               ||
               \/

============== a.out ===============
Metaclass {
   Class*  isa;
   IMP     method[] = {
       classMethod_1,
       classMethod_2
   };
}

RootClass {
   Class*  isa;
   Class*  super;
   IMP     method[] = {
       RootClass:instanceMethod_1,
       RootClass:instanceMethod_2,
   };
}

SubClass {
Class* isa;
Class* super; IMP method[] = {
SubClass:instanceMethod_1,
RootClass:instanceMethod_2,
SubClass:instanceMethod_3,
SubClass:instanceMethod_4,
};
}


====================================
*************************************************************************


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]